Add React logic for final ISU authentication

This commit is contained in:
Philipp Stracker 2025-01-02 18:22:09 +01:00
parent 1246a02f07
commit 0d5832aa8b
No known key found for this signature in database
5 changed files with 63 additions and 9 deletions

View file

@ -44,6 +44,7 @@ export const useHandleOnboardingButton = ( isSandbox ) => {
const { productionOnboardingUrl } = CommonHooks.useProduction();
const products = OnboardingHooks.useDetermineProducts();
const { withActivity } = CommonHooks.useBusyState();
const { connectViaAuthCode } = CommonHooks.useAuthentication();
const [ onboardingUrl, setOnboardingUrl ] = useState( '' );
const [ scriptLoaded, setScriptLoaded ] = useState( false );
const timerRef = useRef( null );
@ -112,7 +113,7 @@ export const useHandleOnboardingButton = ( isSandbox ) => {
const setCompleteHandler = useCallback(
( environment ) => {
const onComplete = async ( authCode, shareId ) => {
const onComplete = async ( authCode, sharedId ) => {
/**
* Until now, the full page is blocked by PayPal's semi-transparent, black overlay.
* But at this point, the overlay is removed, while we process the sharedId and
@ -126,14 +127,10 @@ export const useHandleOnboardingButton = ( isSandbox ) => {
ACTIVITIES.CONNECT_ISU,
'Validating the connection details',
async () => {
// TODO -- finish this!
console.log(
`${ environment }-boarding complete - AUTH: `,
authCode
);
console.log(
`${ environment }-boarding complete - SHARE:`,
shareId
await connectViaAuthCode(
authCode,
sharedId,
environment
);
}
);