/** * External dependencies */ import { Card, CardFooter, CardBody, Button } from '@wordpress/components'; import { Text } from '@woocommerce/experimental'; import { __ } from '@wordpress/i18n'; import { ONBOARDING_STORE_NAME, PAYMENT_GATEWAYS_STORE_NAME, Plugin, PaymentGateway, WCDataSelector, } from '@woocommerce/data'; import { useSelect } from '@wordpress/data'; /** * Internal dependencies */ import { Visa, MasterCard, Amex, ApplePay, Giropay, GooglePay, CB, DinersClub, Discover, UnionPay, JCB, Sofort, } from '../payments-welcome/cards'; import Banner from './banner'; import './payment-recommendations.scss'; export const PaymentMethods = () => (
); const WcPayBanner = () => { const WC_PAY_SETUP_URL = './admin.php?page=wc-settings&tab=checkout§ion=woocommerce_payments'; return (
{ __( 'Accept Payments and manage your business.', 'woocommerce' ) } { __( 'By using WooCommerce Payments you agree to be bound by our Terms of Service and acknowledge that you have read our Privacy Policy', 'woocommerce' ) }
{ __( 'Accepted payment methods include:', 'woocommerce' ) }
{ __( '& more.', 'woocommerce' ) }
); }; export const PaymentsRecommendationsBanner = () => { const { installedPaymentGateways, paymentGatewaySuggestions, isResolving, } = useSelect( ( select: WCDataSelector ) => { return { installedPaymentGateways: select( PAYMENT_GATEWAYS_STORE_NAME ).getPaymentGateways(), isResolving: select( ONBOARDING_STORE_NAME ).isResolving( 'getPaymentGatewaySuggestions' ), paymentGatewaySuggestions: select( ONBOARDING_STORE_NAME ).getPaymentGatewaySuggestions(), }; } ); const supportsWCPayments = paymentGatewaySuggestions && paymentGatewaySuggestions.filter( ( paymentGatewaySuggestion: Plugin ) => { return ( paymentGatewaySuggestion.id.indexOf( 'woocommerce_payments' ) === 0 ); } ).length === 1; const isWcPayInstalled = installedPaymentGateways.some( ( gateway: PaymentGateway ) => { return gateway.id === 'woocommerce_payments'; } ); const isWcPayEnabled = installedPaymentGateways.find( ( gateway: PaymentGateway ) => { return ( gateway.id === 'woocommerce_payments' && gateway.enabled === true ); } ); const isWcPayBannerExplat = true; if ( ! isResolving ) { if ( supportsWCPayments && isWcPayInstalled && ! isWcPayEnabled && isWcPayBannerExplat ) { // add tracks event here return ; } // add tracks event here because we want to know when the control is shown } return null; };