mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Updating messages, cleanup
This commit is contained in:
parent
80853c6fd4
commit
f4b1a6e392
3 changed files with 20 additions and 19 deletions
|
@ -19,20 +19,22 @@ const ResubscribeBlock = () => {
|
||||||
} catch ( error ) {
|
} catch ( error ) {
|
||||||
setResubscribing( false );
|
setResubscribing( false );
|
||||||
createErrorNotice(
|
createErrorNotice(
|
||||||
__(
|
'❌ ' +
|
||||||
'Operation failed. Check WooCommerce logs for more details.',
|
__(
|
||||||
'woocommerce-paypal-payments'
|
'Operation failed. Check WooCommerce logs for more details.',
|
||||||
)
|
'woocommerce-paypal-payments'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setResubscribing( false );
|
setResubscribing( false );
|
||||||
createSuccessNotice(
|
createSuccessNotice(
|
||||||
__(
|
'✔️ ' +
|
||||||
'Webhooks were successfully re-subscribed.',
|
__(
|
||||||
'woocommerce-paypal-payments'
|
'Webhooks were successfully re-subscribed.',
|
||||||
)
|
'woocommerce-paypal-payments'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { useDispatch } from '@wordpress/data';
|
||||||
import { store as noticesStore } from '@wordpress/notices';
|
import { store as noticesStore } from '@wordpress/notices';
|
||||||
|
|
||||||
const SimulationBlock = () => {
|
const SimulationBlock = () => {
|
||||||
const { createSuccessNotice, createErrorNotice } =
|
const { createSuccessNotice, createInfoNotice, createErrorNotice } =
|
||||||
useDispatch( noticesStore );
|
useDispatch( noticesStore );
|
||||||
|
|
||||||
const [ simulating, setSimulating ] = useState( false );
|
const [ simulating, setSimulating ] = useState( false );
|
||||||
|
@ -29,13 +29,10 @@ const SimulationBlock = () => {
|
||||||
} );
|
} );
|
||||||
}, [] );
|
}, [] );
|
||||||
|
|
||||||
const startSimulation = async () => {
|
const startSimulation = async ( retriesBeforeErrorMessage, maxRetries ) => {
|
||||||
const retriesBeforeErrorMessage = 15;
|
|
||||||
const maxRetries = 30;
|
|
||||||
|
|
||||||
setSimulating( true );
|
setSimulating( true );
|
||||||
|
|
||||||
createSuccessNotice(
|
createInfoNotice(
|
||||||
__(
|
__(
|
||||||
'Waiting for the webhook to arrive…',
|
'Waiting for the webhook to arrive…',
|
||||||
'woocommerce-paypal-payments'
|
'woocommerce-paypal-payments'
|
||||||
|
@ -48,7 +45,8 @@ const SimulationBlock = () => {
|
||||||
setSimulating( false );
|
setSimulating( false );
|
||||||
createErrorNotice(
|
createErrorNotice(
|
||||||
__(
|
__(
|
||||||
'Operation failed. Check WooCommerce logs for more details.',
|
'❌ ' +
|
||||||
|
'Operation failed. Check WooCommerce logs for more details.',
|
||||||
'woocommerce-paypal-payments'
|
'woocommerce-paypal-payments'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -87,7 +85,8 @@ const SimulationBlock = () => {
|
||||||
if ( i === retriesBeforeErrorMessage ) {
|
if ( i === retriesBeforeErrorMessage ) {
|
||||||
createErrorNotice(
|
createErrorNotice(
|
||||||
__(
|
__(
|
||||||
'Looks like the webhook cannot be received. Check that your website is accessible from the internet.',
|
'❌ ' +
|
||||||
|
'Looks like the webhook cannot be received. Check that your website is accessible from the internet.',
|
||||||
'woocommerce-paypal-payments'
|
'woocommerce-paypal-payments'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -107,7 +106,7 @@ const SimulationBlock = () => {
|
||||||
actionProps={ {
|
actionProps={ {
|
||||||
buttonType: 'secondary',
|
buttonType: 'secondary',
|
||||||
isBusy: simulating,
|
isBusy: simulating,
|
||||||
callback: () => startSimulation(),
|
callback: () => startSimulation( 15, 30 ),
|
||||||
value: __(
|
value: __(
|
||||||
'Simulate webhooks',
|
'Simulate webhooks',
|
||||||
'woocommerce-paypal-payments'
|
'woocommerce-paypal-payments'
|
||||||
|
|
|
@ -87,9 +87,9 @@ const commonReducer = createReducer( defaultTransient, defaultPersistent, {
|
||||||
|
|
||||||
[ ACTION_TYPES.HYDRATE ]: ( state, payload ) => {
|
[ ACTION_TYPES.HYDRATE ]: ( state, payload ) => {
|
||||||
const newState = setPersistent( state, payload.data );
|
const newState = setPersistent( state, payload.data );
|
||||||
console.log( state, payload );
|
|
||||||
// Populate read-only properties.
|
// Populate read-only properties.
|
||||||
[ 'wooSettings', 'merchant', 'webhooks' ].forEach( ( key ) => {
|
[ 'wooSettings', 'merchant' ].forEach( ( key ) => {
|
||||||
if ( ! payload[ key ] ) {
|
if ( ! payload[ key ] ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue