mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
♻️ Make code more readable, resolve one warning
This commit is contained in:
parent
122be6dcd7
commit
b5c08e842e
2 changed files with 8 additions and 5 deletions
|
@ -214,7 +214,9 @@ class Renderer {
|
|||
}
|
||||
);
|
||||
|
||||
this.renderedSources.add( wrapper + ( fundingSource ?? '' ) );
|
||||
this.renderedSources.add(
|
||||
wrapper + ( fundingSource ? fundingSource : '' )
|
||||
);
|
||||
|
||||
if ( window.paypal?.Buttons ) {
|
||||
widgetBuilder.registerButtons(
|
||||
|
|
|
@ -40,8 +40,9 @@ class WidgetBuilder {
|
|||
|
||||
renderButtons( wrapper ) {
|
||||
wrapper = this.sanitizeWrapper( wrapper );
|
||||
const entryKey = this.toKey( wrapper );
|
||||
|
||||
if ( ! this.buttons.has( this.toKey( wrapper ) ) ) {
|
||||
if ( ! this.buttons.has( entryKey ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -49,11 +50,11 @@ class WidgetBuilder {
|
|||
return;
|
||||
}
|
||||
|
||||
const entry = this.buttons.get( this.toKey( wrapper ) );
|
||||
const entry = this.buttons.get( entryKey );
|
||||
const btn = this.paypal.Buttons( entry.options );
|
||||
|
||||
if ( ! btn.isEligible() ) {
|
||||
this.buttons.delete( this.toKey( wrapper ) );
|
||||
this.buttons.delete( entryKey );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,7 +68,7 @@ class WidgetBuilder {
|
|||
}
|
||||
|
||||
renderAllButtons() {
|
||||
for ( const [ wrapper, entry ] of this.buttons ) {
|
||||
for ( const [ wrapper ] of this.buttons ) {
|
||||
this.renderButtons( wrapper );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue