mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
♻️ Chore: Slightly improve the debug-log output
This commit is contained in:
parent
f4abf7028e
commit
f75c3610d8
1 changed files with 16 additions and 12 deletions
|
@ -77,20 +77,24 @@ class ApplePayButton {
|
||||||
this.ppcpConfig
|
this.ppcpConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
this.log = function () {
|
|
||||||
if ( this.buttonConfig.is_debug ) {
|
|
||||||
//console.log('[ApplePayButton]', ...arguments);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.refreshContextData();
|
this.refreshContextData();
|
||||||
|
|
||||||
// Debug helpers
|
// Debug helpers
|
||||||
jQuery( document ).on( 'ppcp-applepay-debug', () => {
|
|
||||||
console.log( 'ApplePayButton', this.context, this );
|
|
||||||
} );
|
|
||||||
document.ppcpApplepayButtons = document.ppcpApplepayButtons || {};
|
document.ppcpApplepayButtons = document.ppcpApplepayButtons || {};
|
||||||
document.ppcpApplepayButtons[ this.context ] = this;
|
document.ppcpApplepayButtons[ this.context ] = this;
|
||||||
|
|
||||||
|
this.log = function () {
|
||||||
|
if ( ! this.buttonConfig.is_debug ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log( `[ApplePayButton | ${ this.context }]`, ...arguments );
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( this.buttonConfig.is_debug ) {
|
||||||
|
jQuery( document ).on( 'ppcp-applepay-debug', () => {
|
||||||
|
this.log( this );
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,7 +139,7 @@ class ApplePayButton {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.log( 'Init', this.context );
|
this.log( 'Init' );
|
||||||
this.initEventHandlers();
|
this.initEventHandlers();
|
||||||
|
|
||||||
this.#isInitialized = true;
|
this.#isInitialized = true;
|
||||||
|
@ -274,7 +278,7 @@ class ApplePayButton {
|
||||||
* Adds an Apple Pay purchase button.
|
* Adds an Apple Pay purchase button.
|
||||||
*/
|
*/
|
||||||
addButton() {
|
addButton() {
|
||||||
this.log( 'addButton', this.context );
|
this.log( 'addButton' );
|
||||||
|
|
||||||
const { wrapper, ppcpStyle } = this.contextConfig();
|
const { wrapper, ppcpStyle } = this.contextConfig();
|
||||||
|
|
||||||
|
@ -308,7 +312,7 @@ class ApplePayButton {
|
||||||
* Show Apple Pay payment sheet when Apple Pay payment button is clicked
|
* Show Apple Pay payment sheet when Apple Pay payment button is clicked
|
||||||
*/
|
*/
|
||||||
async onButtonClick() {
|
async onButtonClick() {
|
||||||
this.log( 'onButtonClick', this.context );
|
this.log( 'onButtonClick' );
|
||||||
|
|
||||||
const paymentRequest = this.paymentRequest();
|
const paymentRequest = this.paymentRequest();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue