mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
🔀 Merge branch 'trunk'
# Conflicts: # modules/ppcp-settings/resources/css/components/screens/settings/_tab-paylater-configurator.scss # modules/ppcp-settings/resources/css/style.scss # modules/ppcp-settings/resources/js/Components/Screens/tabs.js
This commit is contained in:
commit
2f03dcb948
23 changed files with 661 additions and 107 deletions
|
@ -1,40 +1,62 @@
|
|||
import data from '../../utils/data';
|
||||
|
||||
const BadgeBox = ( props ) => {
|
||||
const titleSize =
|
||||
props.titleType && props.titleType === BADGE_BOX_TITLE_BIG
|
||||
? BADGE_BOX_TITLE_BIG
|
||||
: BADGE_BOX_TITLE_SMALL;
|
||||
const ImageBadge = ( { images } ) => {
|
||||
if ( ! images || ! images.length ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<BadgeContent>
|
||||
<span className="ppcp-r-badge-box__title-image-badge">
|
||||
{ images.map( ( badge ) => data().getImage( badge ) ) }
|
||||
</span>
|
||||
</BadgeContent>
|
||||
);
|
||||
};
|
||||
|
||||
// If `children` is not empty, it's output and wrapped in spaces.
|
||||
const BadgeContent = ( { children } ) => {
|
||||
if ( ! children ) {
|
||||
return null;
|
||||
}
|
||||
return <> { children } </>;
|
||||
};
|
||||
|
||||
const BadgeBox = ( {
|
||||
title,
|
||||
textBadge,
|
||||
imageBadge = [],
|
||||
titleType = BADGE_BOX_TITLE_BIG,
|
||||
description = '',
|
||||
} ) => {
|
||||
let titleSize = BADGE_BOX_TITLE_SMALL;
|
||||
if ( BADGE_BOX_TITLE_BIG === titleType ) {
|
||||
titleSize = BADGE_BOX_TITLE_BIG;
|
||||
}
|
||||
|
||||
const titleTextClassName =
|
||||
'ppcp-r-badge-box__title-text ' +
|
||||
`ppcp-r-badge-box__title-text--${ titleSize }`;
|
||||
|
||||
const titleBaseClassName = 'ppcp-r-badge-box__title';
|
||||
const titleClassName = props.imageBadge
|
||||
const titleClassName = imageBadge.length
|
||||
? `${ titleBaseClassName } ppcp-r-badge-box__title--has-image-badge`
|
||||
: titleBaseClassName;
|
||||
|
||||
return (
|
||||
<div className="ppcp-r-badge-box">
|
||||
<span className={ titleClassName }>
|
||||
<span className={ titleTextClassName }>{ props.title }</span>
|
||||
<span className={ titleTextClassName }>{ title }</span>
|
||||
|
||||
{ props.imageBadge && (
|
||||
<span className="ppcp-r-badge-box__title-image-badge">
|
||||
{ props.imageBadge.map( ( badge ) =>
|
||||
data().getImage( badge )
|
||||
) }
|
||||
</span>
|
||||
) }
|
||||
|
||||
{ props.textBadge }
|
||||
<ImageBadge images={ imageBadge } />
|
||||
<BadgeContent>{ textBadge }</BadgeContent>
|
||||
</span>
|
||||
<div className="ppcp-r-badge-box__description">
|
||||
{ props?.description && (
|
||||
{ description && (
|
||||
<p
|
||||
className="ppcp-r-badge-box__description"
|
||||
dangerouslySetInnerHTML={ {
|
||||
__html: props.description,
|
||||
__html: description,
|
||||
} }
|
||||
></p>
|
||||
) }
|
||||
|
|
|
@ -1,54 +1,35 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { useState } from '@wordpress/element';
|
||||
import { CommonHooks } from '../../data';
|
||||
|
||||
const ConnectionInfo = ( { connectionStatusDataDefault } ) => {
|
||||
const [ connectionData, setConnectionData ] = useState( {
|
||||
...connectionStatusDataDefault,
|
||||
} );
|
||||
|
||||
const toggleStatusClassName = [ 'ppcp-r-connection-status__status-toggle' ];
|
||||
|
||||
if ( connectionData.showAllData ) {
|
||||
toggleStatusClassName.push(
|
||||
'ppcp-r-connection-status__status-toggle--toggled'
|
||||
);
|
||||
}
|
||||
const ConnectionInfo = () => {
|
||||
const { merchant } = CommonHooks.useMerchantInfo();
|
||||
|
||||
return (
|
||||
<div className="ppcp-r-connection-status__data">
|
||||
<div className="ppcp-r-connection-status__status-row ppcp-r-connection-status__status-row--first">
|
||||
<span className="ppcp-r-connection-status__status-label">
|
||||
{ __( 'Merchant ID', 'woocommerce-paypal-payments' ) }
|
||||
</span>
|
||||
<span className="ppcp-r-connection-status__status-value">
|
||||
{ connectionData.merchantId }
|
||||
</span>
|
||||
</div>
|
||||
<div className="ppcp-r-connection-status__status-row">
|
||||
<span className="ppcp-r-connection-status__status-label">
|
||||
{ __( 'Email address', 'woocommerce-paypal-payments' ) }
|
||||
</span>
|
||||
<span className="ppcp-r-connection-status__status-value">
|
||||
{ connectionData.email }
|
||||
</span>
|
||||
</div>
|
||||
<div className="ppcp-r-connection-status__status-row">
|
||||
<span className="ppcp-r-connection-status__status-label">
|
||||
{ __( 'Client ID', 'woocommerce-paypal-payments' ) }
|
||||
</span>
|
||||
<span className="ppcp-r-connection-status__status-value">
|
||||
{ connectionData.clientId }
|
||||
</span>
|
||||
</div>
|
||||
<StatusRow
|
||||
label={ __( 'Merchant ID', 'woocommerce-paypal-payments' ) }
|
||||
value={ merchant.id }
|
||||
/>
|
||||
<StatusRow
|
||||
label={ __( 'Email address', 'woocommerce-paypal-payments' ) }
|
||||
value={ merchant.email }
|
||||
/>
|
||||
<StatusRow
|
||||
label={ __( 'Client ID', 'woocommerce-paypal-payments' ) }
|
||||
value={ merchant.clientId }
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default ConnectionInfo;
|
||||
|
||||
export const connectionStatusDataDefault = {
|
||||
connectionStatus: true,
|
||||
showAllData: false,
|
||||
email: 'bt_us@woocommerce.com',
|
||||
merchantId: 'AT45V2DGMKLRY',
|
||||
clientId: 'BAARTJLxtUNN4d2GMB6Eut3suMDYad72xQA-FntdIFuJ6FmFJITxAY8',
|
||||
};
|
||||
const StatusRow = ( { label, value } ) => (
|
||||
<div className="ppcp-r-connection-status__status-row">
|
||||
<span className="ppcp-r-connection-status__status-label">
|
||||
{ label }
|
||||
</span>
|
||||
<span className="ppcp-r-connection-status__status-value">
|
||||
{ value }
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue