From 39b9c784d48aa8d567a951732263c910d41bcba4 Mon Sep 17 00:00:00 2001 From: Philipp Stracker Date: Mon, 7 Oct 2024 11:46:46 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Implement=20getters=20for=20wrap?= =?UTF-8?q?per=20&=20styles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/js/ApplepayButton.js | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/modules/ppcp-applepay/resources/js/ApplepayButton.js b/modules/ppcp-applepay/resources/js/ApplepayButton.js index 6038ac7e9..ccabd793b 100644 --- a/modules/ppcp-applepay/resources/js/ApplepayButton.js +++ b/modules/ppcp-applepay/resources/js/ApplepayButton.js @@ -11,6 +11,10 @@ import widgetBuilder from '../../../ppcp-button/resources/js/modules/Renderer/Wi import { apmButtonsInit } from '../../../ppcp-button/resources/js/modules/Helper/ApmButtons'; import PaymentButton from '../../../ppcp-button/resources/js/modules/Renderer/PaymentButton'; import { PaymentMethods } from '../../../ppcp-button/resources/js/modules/Helper/CheckoutMethodState'; +import { + combineStyles, + combineWrapperIds, +} from '../../../ppcp-button/resources/js/modules/Helper/PaymentButtonHelpers'; /** * Plugin-specific styling. @@ -67,9 +71,6 @@ class ApplePayButton extends PaymentButton { static methodId = PaymentMethods.APPLEPAY; - #wrapperId = ''; - #ppcpButtonWrapperId = ''; - /** * Context describes the button's location on the website and what details it submits. * @@ -91,6 +92,29 @@ class ApplePayButton extends PaymentButton { */ initialPaymentRequest = null; + /** + * @inheritDoc + */ + static getWrappers( buttonConfig, ppcpConfig ) { + return combineWrapperIds( + buttonConfig?.button?.wrapper || '', + buttonConfig?.button?.mini_cart_wrapper || '', + ppcpConfig?.button?.wrapper || '', + 'ppc-button-applepay-container', + 'ppc-button-ppcp-applepay' + ); + } + + /** + * @inheritDoc + */ + static getStyles( buttonConfig, ppcpConfig ) { + return combineStyles( + ppcpConfig?.button || {}, + buttonConfig?.button || {} + ); + } + constructor( context, externalHandler,