diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/StepWelcome.js b/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/StepWelcome.js
index b99caca25..1aab910fd 100644
--- a/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/StepWelcome.js
+++ b/modules/ppcp-settings/resources/js/Components/Screens/Onboarding/StepWelcome.js
@@ -4,10 +4,10 @@ import { Button, TextControl } from '@wordpress/components';
import PaymentMethodIcons from '../../ReusableComponents/PaymentMethodIcons';
import SettingsToggleBlock from '../../ReusableComponents/SettingsToggleBlock';
import Separator from '../../ReusableComponents/Separator';
-import { useOnboardingDetails } from '../../../data';
+import { useManualConnect, useOnboardingDetails } from '../../../data';
import DataStoreControl from '../../ReusableComponents/DataStoreControl';
-const StepWelcome = ( { setStep, currentStep } ) => {
+const StepWelcome = ( { setStep, currentStep, setCompleted } ) => {
return (
{
className="ppcp-r-page-welcome-or-separator"
text={ __( 'or', 'woocommerce-paypal-payments' ) }
/>
-
+
);
@@ -74,7 +74,7 @@ const WelcomeFeatures = () => {
);
};
-const WelcomeForm = () => {
+const WelcomeForm = ( { setCompleted } ) => {
const {
isSandboxMode,
setSandboxMode,
@@ -86,6 +86,26 @@ const WelcomeForm = () => {
setClientSecret,
} = useOnboardingDetails();
+ const { connectManual } = useManualConnect();
+
+ const handleConnect = async () => {
+ try {
+ const res = await connectManual(
+ clientId,
+ clientSecret,
+ isSandboxMode
+ );
+ if ( ! res.success ) {
+ throw new Error( 'Request failed.' );
+ }
+
+ setCompleted( true );
+ } catch ( exc ) {
+ console.error( exc );
+ alert( 'Connection failed.' );
+ }
+ };
+
const advancedUsersDescription = sprintf(
// translators: %s: Link to PayPal REST application guide
__(
@@ -156,7 +176,7 @@ const WelcomeForm = () => {
onChange={ setClientSecret }
type="password"
/>
-