mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🚚 Move ConsoleLogger to wc-gateway module
This commit is contained in:
parent
f69209b91c
commit
3c200e408a
3 changed files with 9 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
import ConsoleLogger from '../Helper/ConsoleLogger';
|
import ConsoleLogger from '../../../../../ppcp-wc-gateway/resources/js/helper/ConsoleLogger';
|
||||||
import { apmButtonsInit } from '../Helper/ApmButtons';
|
import { apmButtonsInit } from '../Helper/ApmButtons';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Logs debug details to the console.
|
* Helper component to log debug details to the browser console.
|
||||||
*
|
*
|
||||||
* A utility class that is used by payment buttons on the front-end, like the GooglePayButton.
|
* A utility class that is used by payment buttons on the front-end, like the GooglePayButton.
|
||||||
*/
|
*/
|
||||||
|
@ -30,6 +30,7 @@ export default class ConsoleLogger {
|
||||||
|
|
||||||
log( ...args ) {
|
log( ...args ) {
|
||||||
if ( this.#enabled ) {
|
if ( this.#enabled ) {
|
||||||
|
// eslint-disable-next-line
|
||||||
console.log( this.#prefix, ...args );
|
console.log( this.#prefix, ...args );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
|
/* global jQuery */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Map with all input fields that are relevant to render the preview of the
|
* Returns a Map with all input fields that are relevant to render the preview of the
|
||||||
* given payment button.
|
* given payment button.
|
||||||
*
|
*
|
||||||
* @param {string} apmName - Value of the custom attribute `data-ppcp-apm-name`.
|
* @param {string} apmName - Value of the custom attribute `data-ppcp-apm-name`.
|
||||||
* @return {Map<string, {val:Function, el:HTMLInputElement}>}
|
* @return {Map<string, {val:Function, el:HTMLInputElement}>} List of input elements found on the current admin page.
|
||||||
*/
|
*/
|
||||||
export function getButtonFormFields( apmName ) {
|
export function getButtonFormFields( apmName ) {
|
||||||
const inputFields = document.querySelectorAll(
|
const inputFields = document.querySelectorAll(
|
||||||
|
@ -28,9 +30,9 @@ export function getButtonFormFields( apmName ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a function that triggers an update of the specified preview button, when invoked.
|
* Returns a function that triggers an update of the specified preview button, when invoked.
|
||||||
|
*
|
||||||
* @param {string} apmName
|
* @param {string} apmName
|
||||||
* @return {((object) => void)}
|
* @return {((object) => void)} Trigger-function; updates preview buttons when invoked.
|
||||||
*/
|
*/
|
||||||
export function buttonRefreshTriggerFactory( apmName ) {
|
export function buttonRefreshTriggerFactory( apmName ) {
|
||||||
const eventName = `ppcp_paypal_render_preview_${ apmName }`;
|
const eventName = `ppcp_paypal_render_preview_${ apmName }`;
|
||||||
|
@ -44,7 +46,7 @@ export function buttonRefreshTriggerFactory( apmName ) {
|
||||||
* Returns a function that gets the current form values of the specified preview button.
|
* Returns a function that gets the current form values of the specified preview button.
|
||||||
*
|
*
|
||||||
* @param {string} apmName
|
* @param {string} apmName
|
||||||
* @return {() => {button: {wrapper:string, is_enabled:boolean, style:{}}}}
|
* @return {() => {button: {wrapper:string, is_enabled:boolean, style:{}}}} Getter-function; returns preview config details when invoked.
|
||||||
*/
|
*/
|
||||||
export function buttonSettingsGetterFactory( apmName ) {
|
export function buttonSettingsGetterFactory( apmName ) {
|
||||||
const fields = getButtonFormFields( apmName );
|
const fields = getButtonFormFields( apmName );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue