mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
♻️ Make internal attributes private
This commit is contained in:
parent
0d72641ded
commit
35473df661
2 changed files with 41 additions and 30 deletions
|
@ -2,10 +2,16 @@ import ApplePayButton from './ApplepayButton';
|
|||
import ContextHandlerFactory from './Context/ContextHandlerFactory';
|
||||
|
||||
class ApplePayManagerBlockEditor {
|
||||
#namespace = '';
|
||||
#buttonConfig = null;
|
||||
#ppcpConfig = null;
|
||||
#applePayConfig = null;
|
||||
#contextHandler = null;
|
||||
|
||||
constructor( namespace, buttonConfig, ppcpConfig ) {
|
||||
this.namespace = namespace;
|
||||
this.buttonConfig = buttonConfig;
|
||||
this.ppcpConfig = ppcpConfig;
|
||||
this.#namespace = namespace;
|
||||
this.#buttonConfig = buttonConfig;
|
||||
this.#ppcpConfig = ppcpConfig;
|
||||
|
||||
/*
|
||||
* On the front-end, the init method is called when a new button context was detected
|
||||
|
@ -17,26 +23,26 @@ class ApplePayManagerBlockEditor {
|
|||
|
||||
async init() {
|
||||
try {
|
||||
this.applePayConfig = await window[ this.namespace ]
|
||||
this.#applePayConfig = await window[ this.#namespace ]
|
||||
.Applepay()
|
||||
.config();
|
||||
|
||||
this.contextHandler = ContextHandlerFactory.create(
|
||||
this.ppcpConfig.context,
|
||||
this.buttonConfig,
|
||||
this.ppcpConfig,
|
||||
this.#contextHandler = ContextHandlerFactory.create(
|
||||
this.#ppcpConfig.context,
|
||||
this.#buttonConfig,
|
||||
this.#ppcpConfig,
|
||||
null
|
||||
);
|
||||
|
||||
const button = ApplePayButton.createButton(
|
||||
this.ppcpConfig.context,
|
||||
this.#ppcpConfig.context,
|
||||
null,
|
||||
this.buttonConfig,
|
||||
this.ppcpConfig,
|
||||
this.contextHandler
|
||||
this.#buttonConfig,
|
||||
this.#ppcpConfig,
|
||||
this.#contextHandler
|
||||
);
|
||||
|
||||
button.configure( this.applePayConfig );
|
||||
button.configure( this.#applePayConfig );
|
||||
button.init();
|
||||
} catch ( error ) {
|
||||
console.error( 'Failed to initialize Apple Pay:', error );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue