Block UI during onApprove callback on block components

This commit is contained in:
Himad M 2025-07-16 16:53:21 -04:00
parent af7d4c7524
commit 8ce9e94bbb
No known key found for this signature in database
GPG key ID: 5FC769E9888A7B98

View file

@ -3,6 +3,7 @@ import {
paypalSubscriptionToWcAddresses, paypalSubscriptionToWcAddresses,
} from './Helper/Address'; } from './Helper/Address';
import ResumeFlowHelper from '../../../ppcp-button/resources/js/modules/Helper/ResumeFlowHelper'; import ResumeFlowHelper from '../../../ppcp-button/resources/js/modules/Helper/ResumeFlowHelper';
import Spinner from '../../../ppcp-button/resources/js/modules/Helper/Spinner';
export const createOrder = async ( data, config, onError, onClose ) => { export const createOrder = async ( data, config, onError, onClose ) => {
try { try {
@ -66,6 +67,10 @@ export const handleApprove = async (
onError, onError,
onClose onClose
) => { ) => {
// Block the entire page during approval process
const spinner = Spinner.fullPage();
spinner.block();
try { try {
let order; let order;
@ -173,6 +178,8 @@ export const handleApprove = async (
onClose(); onClose();
throw err; throw err;
} finally {
spinner.unblock();
} }
}; };