mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
✨ Add production login hook to last wizard step
This commit is contained in:
parent
05c1978f0d
commit
0e30ecde82
2 changed files with 14 additions and 2 deletions
|
@ -3,7 +3,10 @@ import { Button } from '@wordpress/components';
|
|||
import classNames from 'classnames';
|
||||
|
||||
import { openSignup } from '../../../ReusableComponents/Icons';
|
||||
import { useSandboxConnection } from '../../../../hooks/useHandleConnections';
|
||||
import {
|
||||
useProductionConnection,
|
||||
useSandboxConnection,
|
||||
} from '../../../../hooks/useHandleConnections';
|
||||
|
||||
const ConnectionButton = ( {
|
||||
title,
|
||||
|
@ -12,6 +15,7 @@ const ConnectionButton = ( {
|
|||
showIcon = true,
|
||||
} ) => {
|
||||
const { handleSandboxConnect } = useSandboxConnection();
|
||||
const { handleProductionConnect } = useProductionConnection();
|
||||
const className = classNames( 'ppcp-r-connection-button', {
|
||||
'sandbox-mode': isSandbox,
|
||||
'live-mode': ! isSandbox,
|
||||
|
@ -21,7 +25,7 @@ const ConnectionButton = ( {
|
|||
if ( isSandbox ) {
|
||||
await handleSandboxConnect();
|
||||
} else {
|
||||
console.warn( 'Live connection not implemented yet' );
|
||||
await handleProductionConnect();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ const useHooks = () => {
|
|||
setClientId,
|
||||
setClientSecret,
|
||||
connectToSandbox,
|
||||
connectToProduction,
|
||||
connectViaIdAndSecret,
|
||||
} = useDispatch( STORE_NAME );
|
||||
|
||||
|
@ -73,6 +74,7 @@ const useHooks = () => {
|
|||
return savePersistent( setClientSecret, value );
|
||||
},
|
||||
connectToSandbox,
|
||||
connectToProduction,
|
||||
connectViaIdAndSecret,
|
||||
wooSettings,
|
||||
};
|
||||
|
@ -94,6 +96,12 @@ export const useSandbox = () => {
|
|||
return { isSandboxMode, setSandboxMode, connectToSandbox };
|
||||
};
|
||||
|
||||
export const useProduction = () => {
|
||||
const { connectToProduction } = useHooks();
|
||||
|
||||
return { connectToProduction };
|
||||
};
|
||||
|
||||
export const useManualConnection = () => {
|
||||
const {
|
||||
isManualConnectionMode,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue