Update WC Tasks regarding wccom connection (#48128)

* update task manage wc marketplace

* add browse marketplace task

* remove wccom connection note inbox

* add changelog

* fix lint

* update doc comment

* update the ordering of inbox

* delete the store connect task

* rename to extend store

* update title to "Enhance your store with extensions"

* update spec
This commit is contained in:
Prahesa Kusuma Setia 2024-07-03 13:31:47 +07:00 committed by GitHub
parent 51d9baa74e
commit 60c4807e4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 18 additions and 54 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: update
Update WC Tasks in the WC Home. Rename to WooCommerce marketplace, add new browse marketplace, remove connect to woocomerce.com from inbox

View File

@ -2671,7 +2671,7 @@ function wc_update_870_prevent_listing_of_transient_files_directory() {
}
/**
* If it exists, remove and recreate the inbox note that asks users to connect to `Woo.com` so that the domain name is changed to the updated `WooCommerce.com`.
* If it exists, remove the inbox note that asks users to connect to `Woo.com`.
*/
function wc_update_890_update_connect_to_woocommerce_note() {
$note = Notes::get_note_by_name( WooSubscriptionsNotes::CONNECTION_NOTE_NAME );
@ -2685,8 +2685,6 @@ function wc_update_890_update_connect_to_woocommerce_note() {
return;
}
Notes::delete_notes_with_name( WooSubscriptionsNotes::CONNECTION_NOTE_NAME );
$new_note = WooSubscriptionsNotes::get_note();
$new_note->save();
}
/**

View File

@ -165,7 +165,7 @@ class TaskLists {
),
),
'tasks' => array(
'StoreConnect',
'ExtendStore',
'AdditionalPayments',
'GetMobileApp',
),

View File

@ -5,16 +5,16 @@ namespace Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks;
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
/**
* Connect store to WooCommerce.com Task
* ExtendStore Task
*/
class StoreConnect extends Task {
class ExtendStore extends Task {
/**
* ID.
*
* @return string
*/
public function get_id() {
return 'connect-store';
return 'extend-store';
}
/**
@ -23,7 +23,7 @@ class StoreConnect extends Task {
* @return string
*/
public function get_title() {
return __( 'Manage your WooCommerce.com Marketplace subscriptions', 'woocommerce' );
return __( 'Enhance your store with extensions', 'woocommerce' );
}
/**
@ -50,7 +50,7 @@ class StoreConnect extends Task {
* @return bool
*/
public function is_complete() {
return \WC_Helper::is_site_connected();
return $this->is_visited();
}
/**
@ -59,7 +59,7 @@ class StoreConnect extends Task {
* @return bool
*/
public function is_dismissable() {
return true;
return false;
}
/**
@ -68,6 +68,6 @@ class StoreConnect extends Task {
* @return string
*/
public function get_action_url() {
return admin_url( 'admin.php?page=wc-admin&tab=my-subscriptions&path=/extensions' );
return admin_url( 'admin.php?page=wc-admin&path=/extensions' );
}
}

View File

@ -19,7 +19,7 @@ use Automattic\WooCommerce\Admin\PageController;
class WooSubscriptionsNotes {
const LAST_REFRESH_OPTION_KEY = 'woocommerce_admin-wc-helper-last-refresh';
const NOTE_NAME = 'wc-admin-wc-helper-connection';
const CONNECTION_NOTE_NAME = 'wc-admin-wc-helper-connection';
const CONNECTION_NOTE_NAME = 'wc-admin-wc-helper-connection'; // deprecated.
const SUBSCRIPTION_NOTE_NAME = 'wc-admin-wc-helper-subscription';
const NOTIFY_WHEN_DAYS_LEFT = 60;
@ -63,7 +63,6 @@ class WooSubscriptionsNotes {
// The site just disconnected.
if ( ! empty( $old_token ) && empty( $new_token ) ) {
$this->remove_notes();
$this->add_no_connection_note();
return;
}
@ -124,7 +123,6 @@ class WooSubscriptionsNotes {
}
$this->remove_notes();
$this->add_no_connection_note();
}
}
@ -186,34 +184,6 @@ class WooSubscriptionsNotes {
Notes::delete_notes_with_name( self::SUBSCRIPTION_NOTE_NAME );
}
/**
* Adds a note prompting to connect to WooCommerce.com.
*/
public function add_no_connection_note() {
$note = self::get_note();
$note->save();
}
/**
* Get the WooCommerce.com connection note
*/
public static function get_note() {
$note = new Note();
$note->set_title( __( 'Connect to WooCommerce.com', 'woocommerce' ) );
$note->set_content( __( 'Connect to get important product notifications and updates.', 'woocommerce' ) );
$note->set_content_data( (object) array() );
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::CONNECTION_NOTE_NAME );
$note->set_source( 'woocommerce-admin' );
$note->add_action(
'connect',
__( 'Connect', 'woocommerce' ),
'?page=wc-addons&section=helper',
Note::E_WC_ADMIN_NOTE_UNACTIONED
);
return $note;
}
/**
* Gets the product_id (if any) associated with a note.
*

View File

@ -421,24 +421,16 @@ test.describe( 'Store owner can skip the core profiler', () => {
} );
test( 'Can connect to WooCommerce.com', async ( { page } ) => {
await test.step( 'Go to WC Home and make sure the connect button is visible', async () => {
await test.step( 'Go to WC Home and make sure the total sales is visible', async () => {
await page.goto( 'wp-admin/admin.php?page=wc-admin' );
await expect(
page.getByRole( 'heading', {
name: 'Connect to WooCommerce.com',
} )
).toBeVisible();
await page
.getByRole( 'menuitem', { name: 'Total sales' } )
.waitFor( { state: 'visible' } );
} );
await test.step( 'Click Connect and ensure we are redirected to the correct URL and connect store', async () => {
await page
.getByRole( 'link', { name: 'Connect', exact: true } )
.click();
await expect( page.url() ).toContain(
'?page=wc-admin&tab=my-subscriptions&path=%2Fextensions'
await test.step( 'Go to the extensions tab and connect store', async () => {
await page.goto(
'wp-admin/admin.php?page=wc-admin&tab=my-subscriptions&path=%2Fextensions'
);
await expect(
page.getByText(