mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +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 ) {
|
||||
setResubscribing( false );
|
||||
createErrorNotice(
|
||||
__(
|
||||
'Operation failed. Check WooCommerce logs for more details.',
|
||||
'woocommerce-paypal-payments'
|
||||
)
|
||||
'❌ ' +
|
||||
__(
|
||||
'Operation failed. Check WooCommerce logs for more details.',
|
||||
'woocommerce-paypal-payments'
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
setResubscribing( false );
|
||||
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';
|
||||
|
||||
const SimulationBlock = () => {
|
||||
const { createSuccessNotice, createErrorNotice } =
|
||||
const { createSuccessNotice, createInfoNotice, createErrorNotice } =
|
||||
useDispatch( noticesStore );
|
||||
|
||||
const [ simulating, setSimulating ] = useState( false );
|
||||
|
@ -29,13 +29,10 @@ const SimulationBlock = () => {
|
|||
} );
|
||||
}, [] );
|
||||
|
||||
const startSimulation = async () => {
|
||||
const retriesBeforeErrorMessage = 15;
|
||||
const maxRetries = 30;
|
||||
|
||||
const startSimulation = async ( retriesBeforeErrorMessage, maxRetries ) => {
|
||||
setSimulating( true );
|
||||
|
||||
createSuccessNotice(
|
||||
createInfoNotice(
|
||||
__(
|
||||
'Waiting for the webhook to arrive…',
|
||||
'woocommerce-paypal-payments'
|
||||
|
@ -48,7 +45,8 @@ const SimulationBlock = () => {
|
|||
setSimulating( false );
|
||||
createErrorNotice(
|
||||
__(
|
||||
'Operation failed. Check WooCommerce logs for more details.',
|
||||
'❌ ' +
|
||||
'Operation failed. Check WooCommerce logs for more details.',
|
||||
'woocommerce-paypal-payments'
|
||||
)
|
||||
);
|
||||
|
@ -87,7 +85,8 @@ const SimulationBlock = () => {
|
|||
if ( i === retriesBeforeErrorMessage ) {
|
||||
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'
|
||||
)
|
||||
);
|
||||
|
@ -107,7 +106,7 @@ const SimulationBlock = () => {
|
|||
actionProps={ {
|
||||
buttonType: 'secondary',
|
||||
isBusy: simulating,
|
||||
callback: () => startSimulation(),
|
||||
callback: () => startSimulation( 15, 30 ),
|
||||
value: __(
|
||||
'Simulate webhooks',
|
||||
'woocommerce-paypal-payments'
|
||||
|
|
|
@ -87,9 +87,9 @@ const commonReducer = createReducer( defaultTransient, defaultPersistent, {
|
|||
|
||||
[ ACTION_TYPES.HYDRATE ]: ( state, payload ) => {
|
||||
const newState = setPersistent( state, payload.data );
|
||||
console.log( state, payload );
|
||||
|
||||
// Populate read-only properties.
|
||||
[ 'wooSettings', 'merchant', 'webhooks' ].forEach( ( key ) => {
|
||||
[ 'wooSettings', 'merchant' ].forEach( ( key ) => {
|
||||
if ( ! payload[ key ] ) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue