🐛 FIx the button preview in admin settings

This commit is contained in:
Philipp Stracker 2024-10-30 12:17:41 +01:00
parent 367f2b86c4
commit 40688b706f
No known key found for this signature in database

View file

@ -5,6 +5,11 @@ import PreviewButton from '../../../../ppcp-button/resources/js/modules/Preview/
* A single Apple Pay preview button instance.
*/
export default class ApplePayPreviewButton extends PreviewButton {
/**
* @type {?PaymentButton}
*/
#button = null;
constructor( args ) {
super( args );
@ -19,14 +24,18 @@ export default class ApplePayPreviewButton extends PreviewButton {
}
createButton( buttonConfig ) {
const button = new ApplepayButton(
'preview',
null,
buttonConfig,
this.ppcpConfig
);
if ( ! this.#button ) {
this.#button = new ApplepayButton(
'preview',
null,
buttonConfig,
this.ppcpConfig
);
}
button.init( this.apiConfig );
this.#button.configure( this.apiConfig, null );
this.#button.applyButtonStyles( buttonConfig, this.ppcpConfig );
this.#button.reinit();
}
/**