Axo Block: Always display the Fastlane watermark under the email input in the includeAdditionalInfo mode. Also move the loading spinner to the right.

This commit is contained in:
Daniel Dudzic 2024-10-10 20:40:03 +02:00
parent e67e9be95d
commit 0d228d0d76
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
3 changed files with 4 additions and 10 deletions

View file

@ -259,8 +259,8 @@ a.wc-block-axo-change-link {
.wp-block-woocommerce-checkout-fields-block:not(.wc-block-axo-is-loaded) { .wp-block-woocommerce-checkout-fields-block:not(.wc-block-axo-is-loaded) {
.wc-block-checkout-axo-block-watermark-container { .wc-block-checkout-axo-block-watermark-container {
display: flex; display: flex;
justify-content: left; justify-content: right;
margin-left: 10px; margin-right: 10px;
align-items: center; align-items: center;
position: relative; position: relative;

View file

@ -16,9 +16,6 @@ import {
*/ */
const WatermarkManager = ( { fastlaneSdk } ) => { const WatermarkManager = ( { fastlaneSdk } ) => {
// Select relevant states from the AXO store // Select relevant states from the AXO store
const isGuest = useSelect( ( select ) =>
select( STORE_NAME ).getIsGuest()
);
const isAxoActive = useSelect( ( select ) => const isAxoActive = useSelect( ( select ) =>
select( STORE_NAME ).getIsAxoActive() select( STORE_NAME ).getIsAxoActive()
); );
@ -34,7 +31,6 @@ const WatermarkManager = ( { fastlaneSdk } ) => {
isAxoActive, isAxoActive,
isAxoScriptLoaded, isAxoScriptLoaded,
fastlaneSdk, fastlaneSdk,
isGuest,
} ); } );
} else { } else {
// Remove watermark when AXO is inactive and not loading // Remove watermark when AXO is inactive and not loading
@ -43,7 +39,7 @@ const WatermarkManager = ( { fastlaneSdk } ) => {
// Cleanup function to remove watermark on unmount // Cleanup function to remove watermark on unmount
return removeWatermark; return removeWatermark;
}, [ fastlaneSdk, isGuest, isAxoActive, isAxoScriptLoaded ] ); }, [ fastlaneSdk, isAxoActive, isAxoScriptLoaded ] );
// This component doesn't render anything directly // This component doesn't render anything directly
return null; return null;

View file

@ -112,13 +112,11 @@ export const renderWatermarkContent = ( content ) => {
* @param {boolean} params.isAxoActive - Whether AXO is active. * @param {boolean} params.isAxoActive - Whether AXO is active.
* @param {boolean} params.isAxoScriptLoaded - Whether AXO script is loaded. * @param {boolean} params.isAxoScriptLoaded - Whether AXO script is loaded.
* @param {Object} params.fastlaneSdk - The Fastlane SDK instance. * @param {Object} params.fastlaneSdk - The Fastlane SDK instance.
* @param {boolean} params.isGuest - Whether the user is a guest.
*/ */
export const updateWatermarkContent = ( { export const updateWatermarkContent = ( {
isAxoActive, isAxoActive,
isAxoScriptLoaded, isAxoScriptLoaded,
fastlaneSdk, fastlaneSdk,
isGuest,
} ) => { } ) => {
if ( ! isAxoActive && ! isAxoScriptLoaded ) { if ( ! isAxoActive && ! isAxoScriptLoaded ) {
// Show loading spinner // Show loading spinner
@ -134,7 +132,7 @@ export const updateWatermarkContent = ( {
createElement( Watermark, { createElement( Watermark, {
fastlaneSdk, fastlaneSdk,
name: 'fastlane-watermark-email', name: 'fastlane-watermark-email',
includeAdditionalInfo: isGuest, includeAdditionalInfo: true,
} ) } )
); );
} else { } else {