From 2902b8871bdb4b946345cbf7fb0205032b65a973 Mon Sep 17 00:00:00 2001 From: Joshua T Flowers Date: Mon, 3 Aug 2020 11:22:25 +0300 Subject: [PATCH] Only show WCPay task in US based stores (https://github.com/woocommerce/woocommerce-admin/pull/4899) --- plugins/woocommerce-admin/client/task-list/index.js | 11 +++++++++++ plugins/woocommerce-admin/client/task-list/tasks.js | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-admin/client/task-list/index.js b/plugins/woocommerce-admin/client/task-list/index.js index ef047ded92e..ba8d2f3f198 100644 --- a/plugins/woocommerce-admin/client/task-list/index.js +++ b/plugins/woocommerce-admin/client/task-list/index.js @@ -26,6 +26,7 @@ import { PLUGINS_STORE_NAME, OPTIONS_STORE_NAME, ONBOARDING_STORE_NAME, + SETTINGS_STORE_NAME, } from '@woocommerce/data'; /** @@ -34,6 +35,7 @@ import { import './style.scss'; import CartModal from 'dashboard/components/cart-modal'; import { getAllTasks, recordTaskViewEvent } from './tasks'; +import { getCountryCode } from 'dashboard/utils'; import { recordEvent } from 'lib/tracks'; import withSelect from 'wc-api/with-select'; @@ -142,6 +144,7 @@ class TaskDashboard extends Component { getAllTasks() { const { + countryCode, profileItems, query, taskListPayments, @@ -153,6 +156,7 @@ class TaskDashboard extends Component { } = this.props; return getAllTasks( { + countryCode, profileItems, taskListPayments, query, @@ -444,6 +448,7 @@ export default compose( withSelect( ( select ) => { const { getProfileItems } = select( ONBOARDING_STORE_NAME ); const { getOption } = select( OPTIONS_STORE_NAME ); + const { getSettings } = select( SETTINGS_STORE_NAME ); const { getActivePlugins, getInstalledPlugins, @@ -463,11 +468,17 @@ export default compose( const dismissedTasks = getOption( 'woocommerce_task_list_dismissed_tasks' ) || []; + const { general: generalSettings = {} } = getSettings( 'general' ); + const countryCode = getCountryCode( + generalSettings.woocommerce_default_country + ); + const activePlugins = getActivePlugins(); const installedPlugins = getInstalledPlugins(); return { activePlugins, + countryCode, dismissedTasks, isJetpackConnected: isJetpackConnected(), installedPlugins, diff --git a/plugins/woocommerce-admin/client/task-list/tasks.js b/plugins/woocommerce-admin/client/task-list/tasks.js index e81ab45ae0e..558ebf2dca8 100644 --- a/plugins/woocommerce-admin/client/task-list/tasks.js +++ b/plugins/woocommerce-admin/client/task-list/tasks.js @@ -45,6 +45,7 @@ export function recordTaskViewEvent( } export function getAllTasks( { + countryCode, profileItems, taskListPayments, query, @@ -166,7 +167,9 @@ export function getAllTasks( { } ); }, visible: - window.wcAdminFeatures.wcpay && woocommercePaymentsInstalled, + window.wcAdminFeatures.wcpay && + woocommercePaymentsInstalled && + countryCode === 'US', time: __( '2 minutes', 'woocommerce-admin' ), }, {