2022-04-20 04:28:31 +00:00
/ * *
* External dependencies
* /
import { Card , CardFooter , CardBody , Button } from '@wordpress/components' ;
2022-04-06 16:38:38 +00:00
import { Text } from '@woocommerce/experimental' ;
import { __ } from '@wordpress/i18n' ;
2022-04-26 02:55:44 +00:00
import { getAdminLink } from '@woocommerce/settings' ;
2022-05-16 22:07:42 +00:00
import interpolateComponents from '@automattic/interpolate-components' ;
import { Link } from '@woocommerce/components' ;
2022-04-20 04:28:31 +00:00
/ * *
* Internal dependencies
* /
2022-04-19 08:07:07 +00:00
import {
Visa ,
MasterCard ,
Amex ,
ApplePay ,
Giropay ,
GooglePay ,
CB ,
DinersClub ,
Discover ,
UnionPay ,
JCB ,
Sofort ,
} from '../payments-welcome/cards' ;
2022-04-20 07:29:29 +00:00
import WCPayBannerImage from './wcpay-banner-image' ;
2022-04-06 16:38:38 +00:00
import './payment-recommendations.scss' ;
2022-05-16 22:07:42 +00:00
import { getAdminSetting } from '~/utils/admin-settings' ;
2022-06-22 08:45:31 +00:00
import { usePaymentExperiment } from './use-payments-experiment' ;
2022-04-06 16:38:38 +00:00
2022-04-20 07:29:29 +00:00
export const PaymentMethodsIcons = ( ) = > (
2022-04-19 08:07:07 +00:00
< div className = "woocommerce-recommended-payments-banner__footer_icon_container" >
< Visa / >
< MasterCard / >
< Amex / >
< ApplePay / >
< GooglePay / >
< CB / >
< Giropay / >
< DinersClub / >
< Discover / >
< UnionPay / >
< JCB / >
< Sofort / >
< / div >
) ;
const WcPayBanner = ( ) = > {
2022-04-26 02:55:44 +00:00
const WC_PAY_SETUP_URL = getAdminLink (
2022-05-16 22:07:42 +00:00
'admin.php?wcpay-connect=1&_wpnonce=' +
getAdminSetting ( 'wcpay_welcome_page_connect_nonce' )
2022-04-26 02:55:44 +00:00
) ;
2022-05-16 22:07:42 +00:00
2022-04-06 16:38:38 +00:00
return (
< Card size = "medium" className = "woocommerce-recommended-payments-banner" >
< CardBody className = "woocommerce-recommended-payments-banner__body" >
< div className = "woocommerce-recommended-payments-banner__image_container" >
2022-04-20 07:29:29 +00:00
< WCPayBannerImage / >
2022-04-06 16:38:38 +00:00
< / div >
< div className = "woocommerce-recommended-payments-banner__text_container" >
< Text
variant = "title.small"
as = "p"
size = "24"
lineHeight = "28px"
padding = "0 20px 0 0"
>
{ __ (
'Accept Payments and manage your business.' ,
'woocommerce'
) }
< / Text >
< Text
className = {
'woocommerce-recommended-payments__header-heading'
}
variant = "caption"
as = "p"
size = "12"
lineHeight = "16px"
>
2022-05-16 22:07:42 +00:00
{ interpolateComponents ( {
mixedString : __ (
'By using WooCommerce Payments you agree to be bound by our {{tosLink}}Terms of Service{{/tosLink}} and acknowledge that you have read our {{privacyLink}}Privacy Policy{{/privacyLink}} ' ,
'woocommerce'
) ,
components : {
tosLink : (
< Link
2022-05-18 02:21:29 +00:00
href = "https://wordpress.com/tos/"
2022-05-16 22:07:42 +00:00
type = "external"
target = "_blank"
>
< > < / >
< / Link >
) ,
privacyLink : (
< Link
href = "https://automattic.com/privacy/"
type = "external"
target = "_blank"
>
< > < / >
< / Link >
) ,
} ,
} ) }
2022-04-06 16:38:38 +00:00
< / Text >
2022-04-19 08:07:07 +00:00
< Button href = { WC_PAY_SETUP_URL } isPrimary >
2022-04-06 16:38:38 +00:00
{ __ ( 'Get started' , 'woocommerce' ) }
< / Button >
< / div >
< / CardBody >
< CardFooter className = "woocommerce-recommended-payments-banner__footer" >
< div >
< Text variant = "caption" as = "p" size = "12" lineHeight = "16px" >
{ __ (
'Accepted payment methods include:' ,
'woocommerce'
) }
< / Text >
< / div >
< div >
2022-04-20 07:29:29 +00:00
< PaymentMethodsIcons / >
2022-04-06 16:38:38 +00:00
< / div >
< div >
< Text variant = "caption" as = "p" size = "12" lineHeight = "16px" >
{ __ ( '& more.' , 'woocommerce' ) }
< / Text >
< / div >
< / CardFooter >
< / Card >
) ;
} ;
2022-04-19 08:07:07 +00:00
2022-04-21 05:14:28 +00:00
const DefaultPaymentMethodsHeaderText = ( ) = > (
< >
< h2 > Payment Methods < / h2 >
< div id = "payment_gateways_options-description" >
< p >
Installed payment methods are listed below and can be sorted to
control their display order on the frontend .
< / p >
< / div >
< / >
) ;
2022-04-20 07:29:29 +00:00
export const PaymentsBannerWrapper = ( ) = > {
2022-06-22 08:45:31 +00:00
const { isLoadingExperiment , experimentAssignment } =
usePaymentExperiment ( ) ;
2022-04-19 08:07:07 +00:00
2022-06-22 08:45:31 +00:00
if (
! isLoadingExperiment &&
experimentAssignment ? . variationName === 'treatment'
) {
return < WcPayBanner / > ;
2022-04-19 08:07:07 +00:00
}
2022-04-21 05:14:28 +00:00
return < DefaultPaymentMethodsHeaderText / > ;
2022-04-19 08:07:07 +00:00
} ;