diff --git a/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-first-generation-condition b/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-first-generation-condition new file mode 100644 index 0000000000000..2d9dd476dd3cc --- /dev/null +++ b/projects/js-packages/ai-client/changelog/change-jetpack-ai-logo-first-generation-condition @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +AI Client: if site details show empty or default, do not trigger a logo generation, use empty placeholders diff --git a/projects/js-packages/ai-client/src/logo-generator/components/generator-modal.tsx b/projects/js-packages/ai-client/src/logo-generator/components/generator-modal.tsx index 485d8c7b318b6..65d617367b6ac 100644 --- a/projects/js-packages/ai-client/src/logo-generator/components/generator-modal.tsx +++ b/projects/js-packages/ai-client/src/logo-generator/components/generator-modal.tsx @@ -70,6 +70,7 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { generateLogo, setContext, tierPlansEnabled, + site, } = useLogoGenerator(); const { featureFetchError, firstLogoPromptFetchError, clearErrors } = useRequestErrors(); const siteId = siteDetails?.ID; @@ -136,14 +137,25 @@ export const GeneratorModal: React.FC< GeneratorModalProps > = ( { loadLogoHistory( siteId ); // If there is any logo, we do not need to generate a first logo again. - if ( ! isLogoHistoryEmpty( String( siteId ) ) ) { + if ( hasHistory ) { setLoadingState( null ); setIsLoadingHistory( false ); return; } - // If the site does not require an upgrade and has no logos stored, generate the first prompt based on the site's data. - generateFirstLogo(); + // If the site does not require an upgrade and has no logos stored + // and has title and description, generate the first prompt based on the site's data. + if ( + site && + site.name && + site.description && + site.name !== __( 'Site Title', 'jetpack-ai-client' ) + ) { + generateFirstLogo(); + } else { + setLoadingState( null ); + setIsLoadingHistory( false ); + } } catch ( error ) { debug( 'Error fetching feature', error ); setLoadingState( null ); diff --git a/projects/js-packages/ai-client/src/logo-generator/components/history-carousel.tsx b/projects/js-packages/ai-client/src/logo-generator/components/history-carousel.tsx index 81ab193affe19..ad543f1f8b440 100644 --- a/projects/js-packages/ai-client/src/logo-generator/components/history-carousel.tsx +++ b/projects/js-packages/ai-client/src/logo-generator/components/history-carousel.tsx @@ -48,6 +48,7 @@ export const HistoryCarousel: React.FC = () => { { ) } + { ! logos.length && ! isLoadingHistory &&
 
} { logos.map( ( logo, index ) => (