2020-07-14 12:20:51 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2021-01-07 23:57:09 +00:00
|
|
|
import { Text } from '@woocommerce/experimental';
|
2020-07-14 12:20:51 +00:00
|
|
|
import { withSelect } from '@wordpress/data';
|
|
|
|
import { Fragment, useEffect } from '@wordpress/element';
|
|
|
|
import { applyFilters } from '@wordpress/hooks';
|
|
|
|
import { Icon, chevronRight, page } from '@wordpress/icons';
|
|
|
|
import { partial } from 'lodash';
|
|
|
|
import { List, Section } from '@woocommerce/components';
|
|
|
|
import {
|
|
|
|
ONBOARDING_STORE_NAME,
|
|
|
|
PLUGINS_STORE_NAME,
|
|
|
|
SETTINGS_STORE_NAME,
|
|
|
|
} from '@woocommerce/data';
|
2020-08-13 02:05:22 +00:00
|
|
|
import { compose } from 'redux';
|
2020-08-20 04:59:52 +00:00
|
|
|
import { recordEvent } from '@woocommerce/tracks';
|
2020-07-14 12:20:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import ActivityHeader from '../activity-header';
|
2021-12-14 16:56:42 +00:00
|
|
|
import { getCountryCode } from '~/dashboard/utils';
|
2020-07-14 12:20:51 +00:00
|
|
|
|
|
|
|
export const SETUP_TASK_HELP_ITEMS_FILTER =
|
|
|
|
'woocommerce_admin_setup_task_help_items';
|
|
|
|
|
2020-11-10 13:36:04 +00:00
|
|
|
function getHomeItems() {
|
|
|
|
return [
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Get Support', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/my-account/create-a-ticket/?utm_medium=product',
|
2020-11-10 13:36:04 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Home Screen', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/home-screen/?utm_medium=product',
|
2020-11-10 13:36:04 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Inbox', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/home-screen/?utm_medium=product#section-2',
|
2020-11-10 13:36:04 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Stats Overview', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/home-screen/?utm_medium=product#section-4',
|
2020-11-10 13:36:04 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Store Management', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/home-screen/?utm_medium=product#section-5',
|
2020-11-10 13:36:04 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Store Setup Checklist', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/woocommerce-setup-wizard?utm_medium=product#store-setup-checklist',
|
2020-11-10 13:36:04 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2020-07-14 12:20:51 +00:00
|
|
|
function getAppearanceItems() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
title: __(
|
|
|
|
'Showcase your products and tailor your shopping experience using Blocks',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-07-14 12:20:51 +00:00
|
|
|
),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/woocommerce-blocks/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: __(
|
|
|
|
'Manage Store Notice, Catalog View and Product Images',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-07-14 12:20:51 +00:00
|
|
|
),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/woocommerce-customizer/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'How to choose and change a theme', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/choose-change-theme/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2021-07-21 20:48:54 +00:00
|
|
|
function getMarketingItems( props ) {
|
|
|
|
const { activePlugins } = props;
|
|
|
|
|
|
|
|
return [
|
|
|
|
activePlugins.includes( 'mailpoet' ) && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Get started with Mailpoet', 'woocommerce' ),
|
2021-07-21 20:48:54 +00:00
|
|
|
link: 'https://kb.mailpoet.com/category/114-getting-started',
|
|
|
|
},
|
|
|
|
activePlugins.includes( 'google-listings-and-ads' ) && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Set up Google Listing & Ads', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/google-listings-and-ads/?utm_medium=product#get-started',
|
2021-07-21 20:48:54 +00:00
|
|
|
},
|
2022-04-12 12:26:54 +00:00
|
|
|
activePlugins.includes( 'pinterest-for-woocommerce' ) && {
|
|
|
|
title: __( 'Set up Pinterest for WooCommerce', 'woocommerce' ),
|
|
|
|
link: 'https://woocommerce.com/products/pinterest-for-woocommerce/',
|
|
|
|
},
|
2021-07-21 20:48:54 +00:00
|
|
|
activePlugins.includes( 'mailchimp-for-woocommerce' ) && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Connect Mailchimp for WooCommerce', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://mailchimp.com/help/connect-or-disconnect-mailchimp-for-woocommerce/',
|
2021-07-21 20:48:54 +00:00
|
|
|
},
|
|
|
|
activePlugins.includes( 'creative-mail-by-constant-contact' ) && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Set up Creative Mail for WooCommerce', 'woocommerce' ),
|
2021-07-21 20:48:54 +00:00
|
|
|
link: 'https://app.creativemail.com/kb/help/WooCommerce',
|
|
|
|
},
|
|
|
|
].filter( Boolean );
|
|
|
|
}
|
|
|
|
|
2021-06-28 18:18:42 +00:00
|
|
|
function getPaymentGatewaySuggestions( props ) {
|
|
|
|
const { paymentGatewaySuggestions } = props;
|
2020-07-14 12:20:51 +00:00
|
|
|
|
|
|
|
return [
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Which Payment Option is Right for Me?', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/premium-payment-gateway-extensions/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions.woocommerce_payments && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'WooCommerce Payments Start Up Guide', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/payments/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions.woocommerce_payments && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'WooCommerce Payments FAQs', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/documentation/woocommerce-payments/woocommerce-payments-faqs/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions.stripe && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Stripe Setup and Configuration', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/stripe/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions[ 'ppcp-gateway' ] && {
|
2020-07-14 12:20:51 +00:00
|
|
|
title: __(
|
|
|
|
'PayPal Checkout Setup and Configuration',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-07-14 12:20:51 +00:00
|
|
|
),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/2-0/woocommerce-paypal-payments/?utm_medium=product#section-3',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions.square_credit_card && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Square - Get started', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/woocommerce-square/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions.kco && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Klarna - Introduction', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/klarna-checkout/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions.klarna_payments && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Klarna - Introduction', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/klarna-payments/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions.payfast && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'PayFast Setup and Configuration', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/payfast-payment-gateway/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions.eway && {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Eway Setup and Configuration', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/eway/?utm_source=help_panel&utm_medium=product',
|
2020-08-07 00:09:10 +00:00
|
|
|
},
|
2020-07-14 12:20:51 +00:00
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Direct Bank Transfer (BACS)', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/bacs/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Cash on Delivery', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/cash-on-delivery/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
].filter( Boolean );
|
|
|
|
}
|
|
|
|
|
|
|
|
function getProductsItems() {
|
|
|
|
return [
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Adding and Managing Products', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/managing-products/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: __(
|
|
|
|
'Import products using the CSV Importer and Exporter',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-07-14 12:20:51 +00:00
|
|
|
),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/product-csv-importer-exporter/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Migrate products using Cart2Cart', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/products/cart2cart/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Learn more about setting up products', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/documentation/plugins/woocommerce/getting-started/setup-products/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
function getShippingItems( { activePlugins, countryCode } ) {
|
|
|
|
const showWCS =
|
|
|
|
countryCode === 'US' &&
|
|
|
|
! activePlugins.includes( 'woocommerce-services' );
|
|
|
|
return [
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Setting up Shipping Zones', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/setting-up-shipping-zones/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Core Shipping Options', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/documentation/plugins/woocommerce/getting-started/shipping/core-shipping-options/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Product Shipping Classes', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/product-shipping-classes/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
showWCS && {
|
|
|
|
title: __(
|
|
|
|
'WooCommerce Shipping setup and configuration',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-07-14 12:20:51 +00:00
|
|
|
),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/woocommerce-shipping-and-tax/?utm_source=help_panel&utm_medium=product#section-3',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: __(
|
|
|
|
'Learn more about configuring your shipping settings',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-07-14 12:20:51 +00:00
|
|
|
),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/plugins/woocommerce/getting-started/shipping/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
].filter( Boolean );
|
|
|
|
}
|
|
|
|
|
|
|
|
function getTaxItems( props ) {
|
2021-11-09 12:42:33 +00:00
|
|
|
const { countryCode, taskLists } = props;
|
|
|
|
const tasks = taskLists.reduce(
|
|
|
|
( acc, taskList ) => [ ...acc, ...taskList.tasks ],
|
|
|
|
[]
|
|
|
|
);
|
|
|
|
|
|
|
|
const task = tasks.find( ( t ) => t.id === 'tax' );
|
|
|
|
|
|
|
|
if ( ! task ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { additionalData } = task;
|
|
|
|
const { woocommerceTaxCountries = [], taxJarActivated } = additionalData;
|
2020-07-14 12:20:51 +00:00
|
|
|
|
|
|
|
const showWCS =
|
|
|
|
! taxJarActivated && // WCS integration doesn't work with the official TaxJar plugin.
|
2021-11-09 12:42:33 +00:00
|
|
|
woocommerceTaxCountries.includes( countryCode );
|
2020-07-14 12:20:51 +00:00
|
|
|
|
|
|
|
return [
|
|
|
|
{
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Setting up Taxes in WooCommerce', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/setting-up-taxes-in-woocommerce/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
showWCS && {
|
|
|
|
title: __(
|
2020-09-16 21:45:16 +00:00
|
|
|
'Automated Tax calculation using WooCommerce Tax',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-07-14 12:20:51 +00:00
|
|
|
),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/document/woocommerce-services/?utm_source=help_panel&utm_medium=product#section-10',
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
|
|
|
].filter( Boolean );
|
|
|
|
}
|
|
|
|
|
|
|
|
function getItems( props ) {
|
|
|
|
const { taskName } = props;
|
|
|
|
|
|
|
|
switch ( taskName ) {
|
|
|
|
case 'products':
|
|
|
|
return getProductsItems();
|
|
|
|
case 'appearance':
|
|
|
|
return getAppearanceItems();
|
|
|
|
case 'shipping':
|
|
|
|
return getShippingItems( props );
|
|
|
|
case 'tax':
|
|
|
|
return getTaxItems( props );
|
|
|
|
case 'payments':
|
2021-06-28 18:18:42 +00:00
|
|
|
return getPaymentGatewaySuggestions( props );
|
2021-07-21 20:48:54 +00:00
|
|
|
case 'marketing':
|
|
|
|
return getMarketingItems( props );
|
2020-07-14 12:20:51 +00:00
|
|
|
default:
|
2020-11-10 13:36:04 +00:00
|
|
|
return getHomeItems();
|
2020-07-14 12:20:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleOnItemClick( props, event ) {
|
|
|
|
const { taskName } = props;
|
|
|
|
|
|
|
|
// event isn't initially set when triggering link with the keyboard.
|
|
|
|
if ( ! event ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
props.recordEvent( 'help_panel_click', {
|
2021-03-15 23:44:53 +00:00
|
|
|
task_name: taskName || 'homescreen',
|
2020-07-14 12:20:51 +00:00
|
|
|
link: event.currentTarget.href,
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
function getListItems( props ) {
|
|
|
|
const itemsByType = getItems( props );
|
|
|
|
const genericDocsLink = {
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'WooCommerce Docs', 'woocommerce' ),
|
2022-06-21 08:37:34 +00:00
|
|
|
link: 'https://woocommerce.com/documentation/?utm_source=help_panel&utm_medium=product',
|
2020-07-14 12:20:51 +00:00
|
|
|
};
|
|
|
|
itemsByType.push( genericDocsLink );
|
|
|
|
|
2022-02-11 14:38:38 +00:00
|
|
|
/**
|
|
|
|
* Filter an array of help items for the setup task.
|
|
|
|
*
|
|
|
|
* @filter woocommerce_admin_setup_task_help_items
|
2022-03-18 11:45:14 +00:00
|
|
|
* @param {Array.<Object>} items Array items object based on task.
|
|
|
|
* @param {('products'|'appearance'|'shipping'|'tax'|'payments'|'marketing')} task url query parameters.
|
|
|
|
* @param {Object} props React component props.
|
2022-02-11 14:38:38 +00:00
|
|
|
*/
|
2020-07-14 12:20:51 +00:00
|
|
|
const filteredItems = applyFilters(
|
|
|
|
SETUP_TASK_HELP_ITEMS_FILTER,
|
|
|
|
itemsByType,
|
|
|
|
props.taskName,
|
|
|
|
props
|
|
|
|
);
|
|
|
|
|
|
|
|
// Filter out items that aren't objects without `title` and `link` properties.
|
|
|
|
let validatedItems = Array.isArray( filteredItems )
|
|
|
|
? filteredItems.filter(
|
|
|
|
( item ) => item instanceof Object && item.title && item.link
|
|
|
|
)
|
|
|
|
: [];
|
|
|
|
|
|
|
|
// Default empty array to the generic docs link.
|
|
|
|
if ( ! validatedItems.length ) {
|
|
|
|
validatedItems = [ genericDocsLink ];
|
|
|
|
}
|
|
|
|
|
|
|
|
const onClick = partial( handleOnItemClick, props );
|
|
|
|
|
|
|
|
return validatedItems.map( ( item ) => ( {
|
|
|
|
title: (
|
2021-06-28 01:14:59 +00:00
|
|
|
<Text
|
|
|
|
as="div"
|
|
|
|
variant="button"
|
|
|
|
weight="600"
|
|
|
|
size="14"
|
|
|
|
lineHeight="20px"
|
|
|
|
>
|
2020-07-14 12:20:51 +00:00
|
|
|
{ item.title }
|
|
|
|
</Text>
|
|
|
|
),
|
|
|
|
before: <Icon icon={ page } />,
|
|
|
|
after: <Icon icon={ chevronRight } />,
|
|
|
|
linkType: 'external',
|
|
|
|
target: '_blank',
|
|
|
|
href: item.link,
|
|
|
|
onClick,
|
|
|
|
} ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
export const HelpPanel = ( props ) => {
|
|
|
|
const { taskName } = props;
|
|
|
|
useEffect( () => {
|
|
|
|
props.recordEvent( 'help_panel_open', {
|
2021-03-15 23:44:53 +00:00
|
|
|
task_name: taskName || 'homescreen',
|
2020-07-14 12:20:51 +00:00
|
|
|
} );
|
|
|
|
}, [ taskName ] );
|
|
|
|
|
|
|
|
const listItems = getListItems( props );
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Fragment>
|
2022-03-30 09:00:04 +00:00
|
|
|
<ActivityHeader title={ __( 'Documentation', 'woocommerce' ) } />
|
2020-07-14 12:20:51 +00:00
|
|
|
<Section>
|
|
|
|
<List
|
|
|
|
items={ listItems }
|
|
|
|
className="woocommerce-quick-links__list"
|
|
|
|
/>
|
|
|
|
</Section>
|
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
HelpPanel.defaultProps = {
|
|
|
|
recordEvent,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withSelect( ( select ) => {
|
|
|
|
const { getSettings } = select( SETTINGS_STORE_NAME );
|
|
|
|
const { getActivePlugins } = select( PLUGINS_STORE_NAME );
|
|
|
|
const { general: generalSettings = {} } = getSettings( 'general' );
|
|
|
|
const activePlugins = getActivePlugins();
|
2021-06-28 18:18:42 +00:00
|
|
|
const paymentGatewaySuggestions = select( ONBOARDING_STORE_NAME )
|
|
|
|
.getPaymentGatewaySuggestions()
|
|
|
|
.reduce( ( suggestions, suggestion ) => {
|
|
|
|
const { id } = suggestion;
|
|
|
|
suggestions[ id ] = true;
|
|
|
|
return suggestions;
|
|
|
|
}, {} );
|
2021-11-09 12:42:33 +00:00
|
|
|
const taskLists = select( ONBOARDING_STORE_NAME ).getTaskLists();
|
2020-07-14 12:20:51 +00:00
|
|
|
|
|
|
|
const countryCode = getCountryCode(
|
|
|
|
generalSettings.woocommerce_default_country
|
|
|
|
);
|
|
|
|
|
|
|
|
return {
|
|
|
|
activePlugins,
|
|
|
|
countryCode,
|
2021-06-28 18:18:42 +00:00
|
|
|
paymentGatewaySuggestions,
|
2021-11-09 12:42:33 +00:00
|
|
|
taskLists,
|
2020-07-14 12:20:51 +00:00
|
|
|
};
|
|
|
|
} )
|
|
|
|
)( HelpPanel );
|