♻️ Make internal attributes private

This commit is contained in:
Philipp Stracker 2024-10-08 14:26:46 +02:00
parent 0d72641ded
commit 35473df661
No known key found for this signature in database
2 changed files with 41 additions and 30 deletions

View file

@ -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 );