mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
🚧 Migrate button initialization to new workflow
The ContextHandlerFactory previously was used inside the ApplePayButton constructor.
This commit is contained in:
parent
4604e68b5a
commit
d5e406a563
1 changed files with 11 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import buttonModuleWatcher from '../../../ppcp-button/resources/js/modules/ButtonModuleWatcher';
|
import buttonModuleWatcher from '../../../ppcp-button/resources/js/modules/ButtonModuleWatcher';
|
||||||
import ApplePayButton from './ApplepayButton';
|
import ApplePayButton from './ApplepayButton';
|
||||||
|
import ContextHandlerFactory from './Context/ContextHandlerFactory';
|
||||||
|
|
||||||
class ApplePayManager {
|
class ApplePayManager {
|
||||||
constructor( buttonConfig, ppcpConfig ) {
|
constructor( buttonConfig, ppcpConfig ) {
|
||||||
|
@ -11,11 +12,19 @@ class ApplePayManager {
|
||||||
this.buttons = [];
|
this.buttons = [];
|
||||||
|
|
||||||
buttonModuleWatcher.watchContextBootstrap( ( bootstrap ) => {
|
buttonModuleWatcher.watchContextBootstrap( ( bootstrap ) => {
|
||||||
const button = new ApplePayButton(
|
this.contextHandler = ContextHandlerFactory.create(
|
||||||
|
bootstrap.context,
|
||||||
|
buttonConfig,
|
||||||
|
ppcpConfig,
|
||||||
|
bootstrap.handler
|
||||||
|
);
|
||||||
|
|
||||||
|
const button = ApplePayButton.createButton(
|
||||||
bootstrap.context,
|
bootstrap.context,
|
||||||
bootstrap.handler,
|
bootstrap.handler,
|
||||||
buttonConfig,
|
buttonConfig,
|
||||||
ppcpConfig
|
ppcpConfig,
|
||||||
|
this.contextHandler
|
||||||
);
|
);
|
||||||
|
|
||||||
this.buttons.push( button );
|
this.buttons.push( button );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue