Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Navigation integration #9228

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/fix-navigation-feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Remove WooCommerce Navigation integration
51 changes: 1 addition & 50 deletions client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,11 @@ addFilter(
( pages ) => {
const { menuID, rootLink } = getMenuSettings();

const isNavigationEnabled =
window.wcAdminFeatures && window.wcAdminFeatures.navigation;
const connectionPageTitle = isNavigationEnabled
? 'WooPayments'
: __( 'Connect', 'woocommerce-payments' );

pages.push( {
container: ConnectAccountPage,
path: '/payments/connect',
wpOpenMenu: menuID,
breadcrumbs: [ rootLink, connectionPageTitle ],
navArgs: {
id: 'wc-payments',
},
breadcrumbs: [ rootLink, __( 'Connect', 'woocommerce-payments' ) ],
capability: 'manage_woocommerce',
} );

Expand All @@ -63,9 +54,6 @@ addFilter(
rootLink,
__( 'Onboarding', 'woocommerce-payments' ),
],
navArgs: {
id: 'wc-payments-onboarding',
},
capability: 'manage_woocommerce',
} );

Expand All @@ -74,9 +62,6 @@ addFilter(
path: '/payments/overview',
wpOpenMenu: menuID,
breadcrumbs: [ rootLink, __( 'Overview', 'woocommerce-payments' ) ],
navArgs: {
id: 'wc-payments-overview',
},
capability: 'manage_woocommerce',
} );

Expand All @@ -85,9 +70,6 @@ addFilter(
path: '/payments/deposits',
wpOpenMenu: menuID,
breadcrumbs: [ rootLink, __( 'Deposits', 'woocommerce-payments' ) ],
navArgs: {
id: 'wc-payments-deposits',
},
capability: 'manage_woocommerce',
} );
pages.push( {
Expand All @@ -102,10 +84,6 @@ addFilter(
],
__( 'Deposit details', 'woocommerce-payments' ),
],
navArgs: {
id: 'wc-payments-deposit-details',
parentPath: '/payments/deposits',
},
capability: 'manage_woocommerce',
} );
pages.push( {
Expand All @@ -116,9 +94,6 @@ addFilter(
rootLink,
__( 'Transactions', 'woocommerce-payments' ),
],
navArgs: {
id: 'wc-payments-transactions',
},
capability: 'manage_woocommerce',
} );
pages.push( {
Expand All @@ -133,20 +108,13 @@ addFilter(
],
__( 'Payment details', 'woocommerce-payments' ),
],
navArgs: {
id: 'wc-payments-transaction-details',
parentPath: '/payments/transactions',
},
capability: 'manage_woocommerce',
} );
pages.push( {
container: DisputesPage,
path: '/payments/disputes',
wpOpenMenu: menuID,
breadcrumbs: [ rootLink, __( 'Disputes', 'woocommerce-payments' ) ],
navArgs: {
id: 'wc-payments-disputes',
},
capability: 'manage_woocommerce',
} );

Expand All @@ -162,10 +130,6 @@ addFilter(
],
__( 'Dispute details', 'woocommerce-payments' ),
],
navArgs: {
id: 'wc-payments-disputes-details-legacy-redirect',
parentPath: '/payments/disputes',
},
capability: 'manage_woocommerce',
} );

Expand All @@ -181,10 +145,6 @@ addFilter(
],
__( 'Challenge dispute', 'woocommerce-payments' ),
],
navArgs: {
id: 'wc-payments-disputes-challenge',
parentPath: '/payments/disputes',
},
capability: 'manage_woocommerce',
} );
pages.push( {
Expand Down Expand Up @@ -215,9 +175,6 @@ addFilter(
rootLink,
__( 'Card readers', 'woocommerce-payments' ),
],
navArgs: {
id: 'wc-payments-card-readers',
},
capability: 'manage_woocommerce',
} );
pages.push( {
Expand All @@ -228,9 +185,6 @@ addFilter(
rootLink,
__( 'Capital Loans', 'woocommerce-payments' ),
],
navArgs: {
id: 'wc-payments-capital',
},
capability: 'manage_woocommerce',
} );
if ( wcpaySettings && wcpaySettings.featureFlags.documents ) {
Expand All @@ -242,9 +196,6 @@ addFilter(
rootLink,
__( 'Documents', 'woocommerce-payments' ),
],
navArgs: {
id: 'wc-payments-documents',
},
capability: 'manage_woocommerce',
} );
}
Expand Down
99 changes: 28 additions & 71 deletions includes/admin/class-wc-payments-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,44 +147,28 @@ public function __construct(

$this->admin_child_pages = [
'wc-payments-overview' => [
'id' => 'wc-payments-overview',
'title' => __( 'Overview', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/overview',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 10,
],
'id' => 'wc-payments-overview',
'title' => __( 'Overview', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/overview',
],
'wc-payments-deposits' => [
'id' => 'wc-payments-deposits',
'title' => __( 'Deposits', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/deposits',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 20,
],
'id' => 'wc-payments-deposits',
'title' => __( 'Deposits', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/deposits',
],
'wc-payments-transactions' => [
'id' => 'wc-payments-transactions',
'title' => __( 'Transactions', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/transactions',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 30,
],
'id' => 'wc-payments-transactions',
'title' => __( 'Transactions', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/transactions',
],
'wc-payments-disputes' => [
'id' => 'wc-payments-disputes',
'title' => __( 'Disputes', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/disputes',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 40,
],
'id' => 'wc-payments-disputes',
'title' => __( 'Disputes', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/disputes',
],
];
}
Expand Down Expand Up @@ -317,12 +301,6 @@ public function add_payments_menu() {
'path' => $top_level_link,
'position' => '55.7', // After WooCommerce & Product menu items.
'icon' => $menu_icon,
'nav_args' => [
'title' => 'WooPayments',
'is_category' => $should_render_full_menu,
'menuId' => 'plugins',
'is_top_level' => true,
],
]
);

Expand All @@ -344,9 +322,6 @@ public function add_payments_menu() {
'parent' => 'wc-payments',
'path' => '/payments/onboarding',
'capability' => 'manage_woocommerce',
'nav_args' => [
'parent' => 'wc-payments',
],
]
);
remove_submenu_page( 'wc-admin&path=/payments/connect', 'wc-admin&path=/payments/onboarding' );
Expand All @@ -356,40 +331,28 @@ public function add_payments_menu() {
if ( $should_render_full_menu ) {
if ( $this->account->is_card_present_eligible() && $this->account->has_card_readers_available() ) {
$this->admin_child_pages['wc-payments-card-readers'] = [
'id' => 'wc-payments-card-readers',
'title' => __( 'Card Readers', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/card-readers',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 50,
],
'id' => 'wc-payments-card-readers',
'title' => __( 'Card Readers', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/card-readers',
];
}

if ( $this->account->get_capital()['has_previous_loans'] ) {
$this->admin_child_pages['wc-payments-capital'] = [
'id' => 'wc-payments-capital',
'title' => __( 'Capital Loans', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/loans',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 60,
],
'id' => 'wc-payments-capital',
'title' => __( 'Capital Loans', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/loans',
];
}

if ( WC_Payments_Features::is_documents_section_enabled() ) {
$this->admin_child_pages['wc-payments-documents'] = [
'id' => 'wc-payments-documents',
'title' => __( 'Documents', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/documents',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 50,
],
'id' => 'wc-payments-documents',
'title' => __( 'Documents', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/documents',
];
}

Expand All @@ -409,12 +372,6 @@ public function add_payments_menu() {
'parent' => 'woocommerce-settings-payments',
'screen_id' => 'woocommerce_page_wc-settings-checkout-woocommerce_payments',
'title' => 'WooPayments',
'nav_args' => [
'parent' => 'wc-payments',
'title' => __( 'Settings', 'woocommerce-payments' ),
'url' => 'wc-settings&tab=checkout&section=woocommerce_payments',
'order' => 99,
],
]
);
// Add the Settings submenu directly to the array, it's the only way to make it link to an absolute URL.
Expand Down
Loading