mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
20 lines
607 B
JavaScript
20 lines
607 B
JavaScript
|
import { createElement, createRoot } from '@wordpress/element';
|
||
|
import CardChangeButtonManager from './CardChangeButtonManager';
|
||
|
|
||
|
export const injectCardChangeButton = ( onChangeButtonClick ) => {
|
||
|
const container = document.createElement( 'div' );
|
||
|
document.body.appendChild( container );
|
||
|
createRoot( container ).render(
|
||
|
createElement( CardChangeButtonManager, { onChangeButtonClick } )
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export const removeCardChangeButton = () => {
|
||
|
const button = document.querySelector(
|
||
|
'.wc-block-checkout-axo-block-card__edit'
|
||
|
);
|
||
|
if ( button && button.parentNode ) {
|
||
|
button.parentNode.remove();
|
||
|
}
|
||
|
};
|