mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
22 lines
598 B
JavaScript
22 lines
598 B
JavaScript
|
import { useEffect } from '@wordpress/element';
|
||
|
|
||
|
export const FastlaneWatermark = ( {
|
||
|
fastlaneSdk,
|
||
|
name = 'fastlane-watermark-container',
|
||
|
includeAdditionalInfo = true,
|
||
|
} ) => {
|
||
|
// This web component can be instantiated inside of a useEffect.
|
||
|
useEffect( () => {
|
||
|
( async () => {
|
||
|
const watermark = await fastlaneSdk.FastlaneWatermarkComponent( {
|
||
|
includeAdditionalInfo,
|
||
|
} );
|
||
|
// The ID can be a react element
|
||
|
watermark.render( `#${ name }` );
|
||
|
} )();
|
||
|
}, [] );
|
||
|
|
||
|
// Give the react element the ID that you will render the watermark component into.
|
||
|
return <div id={ name } />;
|
||
|
};
|