mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
♻️ Optional init value for trigger selector
This commit is contained in:
parent
4c10c37782
commit
dcd8307118
1 changed files with 7 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
|||
import { refreshButtons } from './ButtonRefreshHelper';
|
||||
|
||||
const DEFAULT_TRIGGER_ELEMENT_SELECTOR = '.woocommerce-checkout-payment';
|
||||
|
||||
/**
|
||||
* The MultistepCheckoutHelper class ensures the initialization of payment buttons
|
||||
* on websites using a multistep checkout plugin. These plugins usually hide the
|
||||
|
@ -14,10 +16,10 @@ import { refreshButtons } from './ButtonRefreshHelper';
|
|||
class MultistepCheckoutHelper {
|
||||
|
||||
/**
|
||||
* Configuration that defines the HTML selector for the component we are waiting to be visible.
|
||||
* Selector that defines the HTML element we are waiting to become visible.
|
||||
* @type {string}
|
||||
*/
|
||||
#triggerElementSelector = '.woocommerce-checkout-payment';
|
||||
#triggerElementSelector;
|
||||
|
||||
/**
|
||||
* Interval (in milliseconds) in which the visibility of the trigger element is checked.
|
||||
|
@ -39,9 +41,11 @@ class MultistepCheckoutHelper {
|
|||
|
||||
/**
|
||||
* @param {string} formSelector - Selector of the checkout form
|
||||
* @param {string} triggerElementSelector - Optional. Selector of the dependant element.
|
||||
*/
|
||||
constructor(formSelector) {
|
||||
constructor(formSelector, triggerElementSelector = '') {
|
||||
this.#formSelector = formSelector;
|
||||
this.#triggerElementSelector = triggerElementSelector || DEFAULT_TRIGGER_ELEMENT_SELECTOR;
|
||||
this.#intervalId = false;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue