mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Merge pull request #2976 from woocommerce/fix/PCP-4093-real-data
Fix/pcp 4093 real data (4093)
This commit is contained in:
commit
9aef5825a7
2 changed files with 31 additions and 54 deletions
|
@ -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>
|
||||
);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import SettingsCard from '../../../ReusableComponents/SettingsCard';
|
||||
import ConnectionInfo, {
|
||||
connectionStatusDataDefault,
|
||||
} from '../../../ReusableComponents/ConnectionInfo';
|
||||
import { CommonHooks } from '../../../../data';
|
||||
import TitleBadge, {
|
||||
TITLE_BADGE_NEGATIVE,
|
||||
TITLE_BADGE_POSITIVE,
|
||||
} from '../../../ReusableComponents/TitleBadge';
|
||||
import ConnectionInfo from '../../../ReusableComponents/ConnectionInfo';
|
||||
const ConnectionStatus = () => {
|
||||
const { merchant } = CommonHooks.useMerchantInfo();
|
||||
return (
|
||||
<SettingsCard
|
||||
className="ppcp-r-tab-overview-support"
|
||||
|
@ -20,7 +20,7 @@ const ConnectionStatus = () => {
|
|||
<div className="ppcp-r-connection-status">
|
||||
<div className="ppcp-r-connection-status__status">
|
||||
<div className="ppcp-r-connection-status__status-status">
|
||||
{ connectionStatusDataDefault.connectionStatus ? (
|
||||
{ merchant.isConnected ? (
|
||||
<TitleBadge
|
||||
type={ TITLE_BADGE_POSITIVE }
|
||||
text={ __(
|
||||
|
@ -39,12 +39,8 @@ const ConnectionStatus = () => {
|
|||
) }
|
||||
</div>
|
||||
</div>
|
||||
{ connectionStatusDataDefault.connectionStatus && (
|
||||
<ConnectionInfo
|
||||
connectionStatusDataDefault={
|
||||
connectionStatusDataDefault
|
||||
}
|
||||
/>
|
||||
{ merchant.isConnected && (
|
||||
<ConnectionInfo connectionStatusDataDefault={ merchant } />
|
||||
) }
|
||||
</div>
|
||||
</SettingsCard>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue