Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
6cb816d
Update GenAICard to latest designs.
ankitrox Jan 13, 2026
59a2edd
Add Gen AI media and text asset generation functionality
asvinb Jan 13, 2026
a1bdd84
chore: Update package.json maxSize value
asvinb Jan 13, 2026
0ef29b5
Fix: JS tests.
ankitrox Jan 13, 2026
c431c1a
Add svgr/webpack loader for inline SVG files.
asvinb Jan 13, 2026
a6e46f2
Add new GenAIImagesNotice component.
ankitrox Jan 13, 2026
de71d05
Rename AddAssetItemButton to AssetItemActionButton
asvinb Jan 13, 2026
fd244c8
Upgrade ads library to V21
ankitrox Jan 13, 2026
159641e
Update bundle size.
ankitrox Jan 13, 2026
281ca3d
feat(paid-ads): Add AI-generated text assets and improve UI
asvinb Jan 13, 2026
b415f3f
Use existing Tip component and remove GenAIImagesNotice component.
asvinb Jan 14, 2026
8a0cb56
feat(data): Add adaptGenAIAssets function and refactor GenAI media/te…
asvinb Jan 14, 2026
40d6b1a
Update google ads library.
ankitrox Jan 15, 2026
458917f
Add E2E tests
asvinb Jan 15, 2026
cfae55d
Add @svgr/webpack for SVG processing in webpack config
asvinb Jan 15, 2026
6024bd3
chore(package.json): Update package.json max size value
asvinb Jan 15, 2026
75ff316
Update imports for V22.
ankitrox Jan 15, 2026
5a9ac17
feat(jest): Update moduleNameMapper regex for SVG handling
asvinb Jan 15, 2026
bfcbeb5
Merge branch 'add/GOOWOO-427-inline-svgs' into add/GOOWOO-398-text-bu…
asvinb Jan 15, 2026
4130124
Update Jest config and mock SVG handling
asvinb Jan 15, 2026
70d9a5c
refactor(jest): Simplify svg handling in moduleNameMapper
asvinb Jan 15, 2026
7cc5111
Add AdsAssetGenerationService for AI asset generation.
jamesmorrison Jan 15, 2026
0cbc15e
Update svgr mock component in tests
asvinb Jan 15, 2026
5b7bcea
Merge branch 'add/GOOWOO-427-inline-svgs' into add/GOOWOO-398-text-bu…
asvinb Jan 15, 2026
7392d7e
Add AI asset generation service and REST endpoints
jamesmorrison Jan 15, 2026
dfe7fc0
Use AssetAutomationSetting in place of url_expansion_opt_out.
ankitrox Jan 15, 2026
41c8151
Fix: php lint.
ankitrox Jan 15, 2026
335504e
feat(paid-ads): Add AI-generated image picker
asvinb Jan 15, 2026
bbf5aa1
feat(paid-ads): Implement GenAIImagePicker component
asvinb Jan 15, 2026
a58e1a3
Merge branch 'add/GOOWOO-398-text-button' into add/GOOWOO-402-image-p…
asvinb Jan 15, 2026
533e8c9
feat(paid-ads): Implement GenAI image generation for marketing assets
asvinb Jan 15, 2026
5478e04
fix: Remove unused state variable and update image selection logic
asvinb Jan 15, 2026
e2c7a45
Review comments
asvinb Jan 15, 2026
26fc8af
Add mock implementation for useAdaptiveFormContext in ImagesSelector …
asvinb Jan 16, 2026
09991f7
Address CR feedback.
ankitrox Jan 16, 2026
2fb6516
Update snapshot.
ankitrox Jan 16, 2026
4afc3fa
Finalize E2E tests
asvinb Jan 16, 2026
5046353
Revert comments
asvinb Jan 16, 2026
66ec26a
chore(package.json): Update max size limit for index.js
asvinb Jan 16, 2026
f4da882
Merge pull request #3207 from woocommerce/add/GOOWOO-392-get-data
asvinb Jan 16, 2026
078fca7
Refactor GenAICard component layout and styling
asvinb Jan 16, 2026
17b651f
Update snapshot
asvinb Jan 16, 2026
db1c0d0
Merge pull request #3208 from woocommerce/update/GOOWOO-401-notice-co…
asvinb Jan 16, 2026
b1b9c2e
Merge pull request #3206 from woocommerce/update/GOOWOO-394-gen-ai-ca…
asvinb Jan 16, 2026
b536ace
Merge branch 'feature/GOOWOO-383-genai-assets' into add/GOOWOO-427-in…
asvinb Jan 16, 2026
87c080d
Merge branch 'add/GOOWOO-427-inline-svgs' into add/GOOWOO-398-text-bu…
asvinb Jan 16, 2026
1bbd175
Merge branch 'add/GOOWOO-398-text-button' into add/GOOWOO-402-image-p…
asvinb Jan 16, 2026
c4f5fd7
Add GenAI progress bar component.
ankitrox Jan 16, 2026
8ab751a
Add SVG mock support in Jest config
asvinb Jan 16, 2026
fc7ac82
Merge branch 'add/GOOWOO-427-inline-svgs' into add/GOOWOO-398-text-bu…
asvinb Jan 16, 2026
cbf8697
Merge branch 'add/GOOWOO-398-text-button' into add/GOOWOO-402-image-p…
asvinb Jan 16, 2026
a8e4a1d
Suppress ESLint.
ankitrox Jan 16, 2026
e66a39e
Add AIIcon for AI generated texts.
asvinb Jan 16, 2026
1de2c02
Add tests for AI icon.
asvinb Jan 19, 2026
f984bc6
Merge branch 'feature/GOOWOO-383-genai-assets' into update/GOOWOO-394…
ankitrox Jan 19, 2026
efd68f3
Fix: ConversionValueRule class cleanup should not happen.
ankitrox Jan 19, 2026
b1241f0
Fix: php lint.
ankitrox Jan 19, 2026
e6c8f8a
Tweak to styling.
asvinb Jan 19, 2026
e4a9675
Added comment.
asvinb Jan 19, 2026
ebda3bf
Merge pull request #3218 from woocommerce/update/GOOWOO-393-genai-pro…
asvinb Jan 19, 2026
fa91054
Merge branch 'feature/GOOWOO-383-genai-assets' into add/GOOWOO-402-im…
asvinb Jan 19, 2026
cbb3172
Add images to existing images.
asvinb Jan 19, 2026
cba94cd
Update bundle size.
asvinb Jan 19, 2026
bde0be5
Select home url on mount.
ankitrox Jan 19, 2026
41ca59d
Update to async function.
ankitrox Jan 19, 2026
85fb698
PR Feedback.
jamesmorrison Jan 20, 2026
ed1573a
Merge convert functions.
jamesmorrison Jan 20, 2026
a9b26ea
Merge branch 'feature/GOOWOO-406-create-an-AdsAssetGenerationService'…
jamesmorrison Jan 20, 2026
965a935
PR feedback.
jamesmorrison Jan 20, 2026
f0e61f1
PR feedback: API controller handles defaults, generation service vali…
jamesmorrison Jan 20, 2026
3030629
PHPCS fixes.
jamesmorrison Jan 20, 2026
793cd5c
Merge branch 'feature/GOOWOO-406-create-an-AdsAssetGenerationService'…
jamesmorrison Jan 20, 2026
2fb2a74
Add loading logic.
asvinb Jan 20, 2026
c3bb968
Add E2E test coverage.
ankitrox Jan 20, 2026
f11217a
Add docblock.
ankitrox Jan 20, 2026
ab644a7
Merge pull request #3212 from woocommerce/add/GOOWOO-427-inline-svgs
ankitrox Jan 20, 2026
781cac9
refactor(paid-ads): extract GenAI asset fetch and trigger on change
asvinb Jan 21, 2026
ba1b19b
Merge branch 'develop' into feature/GOOWOO-383-genai-assets
asvinb Jan 21, 2026
abe39f7
Merge branch 'feature/GOOWOO-383-genai-assets' of github.com:woocomme…
asvinb Jan 21, 2026
7e0d77c
Merge branch 'feature/GOOWOO-383-genai-assets' into update/GOOWOO-396…
asvinb Jan 21, 2026
c6d1006
Merge branch 'feature/GOOWOO-383-genai-assets' into add/GOOWOO-398-te…
asvinb Jan 21, 2026
de395f7
refactor(asset-group): Extract asset slot filling utility
asvinb Jan 21, 2026
3b05c76
Fix: Select another URL triggers homepage url selection.
ankitrox Jan 21, 2026
619f867
Merge branch 'update/GOOWOO-396-final-url-card' of github.com:woocomm…
ankitrox Jan 21, 2026
c8a7558
Merge pull request #3211 from woocommerce/add/GOOWOO-398-text-button
asvinb Jan 21, 2026
d88236a
Merge pull request #3216 from woocommerce/add/GOOWOO-402-image-picker-v2
asvinb Jan 21, 2026
4378a6e
Merge branch 'feature/GOOWOO-383-genai-assets' into add/GOOWOO-399-de…
asvinb Jan 21, 2026
ae11d3a
Merge pull request #3219 from woocommerce/add/GOOWOO-399-decorative-icon
asvinb Jan 21, 2026
a8f852e
Resolve conflicts with base branch.
ankitrox Jan 21, 2026
974fda3
Merge branch 'feature/GOOWOO-383-genai-assets' into update/GOOWOO-394…
ankitrox Jan 22, 2026
1ecf7c2
Merge branch 'feature/GOOWOO-383-genai-assets' into add/GOOWOO-410-im…
asvinb Jan 22, 2026
1c4060a
Update composer lock.
ankitrox Jan 22, 2026
f04eb6d
PHPCS fixes.
jamesmorrison Jan 22, 2026
13bdf4a
PHPCS fixes.
jamesmorrison Jan 22, 2026
61b8ca1
Composer update.
jamesmorrison Jan 22, 2026
220584a
refactor(paid-ads): Refine asset generation logic and tests
asvinb Jan 22, 2026
8b849fa
build: Update commons.js maxSize
asvinb Jan 22, 2026
224d68c
Merged 409 (update/GOOWOO-394-ads-lib); updated to V22, fixed conflicts.
jamesmorrison Jan 22, 2026
016cb7e
Merge branch 'feature/GOOWOO-406-create-an-AdsAssetGenerationService'…
jamesmorrison Jan 22, 2026
228f378
Merged 406 / feature/GOOWOO-406-create-an-AdsAssetGenerationService; …
jamesmorrison Jan 22, 2026
cc67925
Added 90 second timeout for AI generated content; tests timed out wit…
jamesmorrison Jan 22, 2026
3896a8c
Merge branch 'feature/GOOWOO-383-genai-assets' into update/GOOWOO-396…
asvinb Jan 23, 2026
f118c84
Use the useRef in parent component.
ankitrox Jan 23, 2026
d95803b
Remove redundant code
ankitrox Jan 23, 2026
00594c8
Fix: JS test.
ankitrox Jan 23, 2026
481ae7a
Add comment
ankitrox Jan 23, 2026
72f1868
refactor(asset-group): Refactor AssetsLoader props and selection logic
asvinb Jan 23, 2026
8ec402c
test: Mock FinalUrlCard and remove waitFor from tests
asvinb Jan 23, 2026
46a69f0
test(e2e): Streamline 'Optimize your campaign' final URL tests
asvinb Jan 23, 2026
30947ca
style: Reorder import statements
asvinb Jan 23, 2026
c236632
refactor: Inline API path variables in fetchSuggestedAssets
asvinb Jan 23, 2026
9a03ce5
refactor(asset-group): Inline fetchSuggestedAssets function
asvinb Jan 23, 2026
f2dd36f
docs: Adds JSDoc for FinalUrl type and updates onSelectFinalUrl prop
asvinb Jan 23, 2026
7bf5c46
Merge pull request #3221 from woocommerce/update/GOOWOO-396-final-url…
asvinb Jan 23, 2026
91e1236
Merge branch 'feature/GOOWOO-383-genai-assets' into add/GOOWOO-410-im…
asvinb Jan 23, 2026
e643702
Merge branch 'feature/GOOWOO-383-genai-assets' into feature/GOOWOO-40…
jamesmorrison Jan 27, 2026
5f03715
PR feedback.
jamesmorrison Jan 27, 2026
be0a746
Merge branch 'feature/GOOWOO-406-create-an-AdsAssetGenerationService'…
jamesmorrison Jan 27, 2026
497cea8
Removed TALL_PORTRAIT_MARKETING_IMAGE / fix tests.
jamesmorrison Jan 27, 2026
7639885
PR feedback.
jamesmorrison Jan 27, 2026
8fbda49
refactor(asset-group): Centralize asset fetching and integrate loadin…
asvinb Jan 27, 2026
09bc189
fix(paid-ads): Adjust asset group editor logic for editing state
asvinb Jan 28, 2026
d1806a6
build: Remove unused import and adjust commons.js maxSize
asvinb Jan 28, 2026
6a8b5a7
fix(asset-group-header): Add isEditing to effect dependencies
asvinb Jan 29, 2026
f9b9158
Merge pull request #3209 from woocommerce/update/GOOWOO-394-ads-lib
ankitguptaindia Jan 29, 2026
5b0a227
Merge branch 'develop' into feature/GOOWOO-383-genai-assets
asvinb Jan 29, 2026
38deb0f
Merge branch 'feature/GOOWOO-383-genai-assets' into feature/GOOWOO-40…
asvinb Jan 29, 2026
a5d02f6
Provide response data in exceptions
jjgrainger Jan 29, 2026
af5f0c8
Merge branch 'feature/GOOWOO-383-genai-assets' into feature/GOOWOO-40…
jjgrainger Jan 29, 2026
63b6ce5
Merge pull request #3213 from woocommerce/feature/GOOWOO-406-create-a…
jjgrainger Jan 29, 2026
ce82734
Merge branch 'feature/GOOWOO-383-genai-assets' into feature/GOOWOO-40…
jjgrainger Jan 29, 2026
8a4dbdf
Merge pull request #3222 from woocommerce/add/GOOWOO-410-implement-lo…
asvinb Jan 30, 2026
4185b9f
feat(data): Apply character limits to GenAI text assets
asvinb Jan 30, 2026
67e3823
fix(paid-ads): Reset AI asset flags on import failure
asvinb Jan 30, 2026
a142f64
Merge pull request #3243 from woocommerce/fix/GOOWOO-401-notice-compo…
ankitguptaindia Feb 2, 2026
d8024e7
Merge pull request #3242 from woocommerce/add/GOOWOO-400-text-ai
ankitguptaindia Feb 2, 2026
65481b3
Merge pull request #3214 from woocommerce/feature/GOOWOO-405-create-w…
ankitguptaindia Feb 2, 2026
1e5f7b3
Use __return_empty_array function for filter
mukeshpanchal27 Feb 3, 2026
e514030
Revert unwanted changes
mukeshpanchal27 Feb 3, 2026
c316bac
Update doc
mukeshpanchal27 Feb 3, 2026
5b694f3
Revert unwanted changes
mukeshpanchal27 Feb 3, 2026
4cc5288
Minor fix
mukeshpanchal27 Feb 3, 2026
717c3bd
Increase maxSize for build index.js
mukeshpanchal27 Feb 3, 2026
9e06e78
Merge pull request #3244 from woocommerce/follow-up/3209
jjgrainger Feb 3, 2026
762d56e
Reset selected images after adding them
AlejandroPerezMartin Feb 4, 2026
87d4fd0
Merge pull request #3246 from woocommerce/fix/GOOWOO-449-add-image-bu…
asvinb Feb 4, 2026
79fe981
refactor(gen-ai): Consolidate asset generation into new hook
asvinb Feb 5, 2026
fa90d78
refactor: Use new hook for GenAI asset generation
asvinb Feb 5, 2026
2996bc8
refactor: Remove unused Gen AI asset fetching functions
asvinb Feb 5, 2026
82c200f
refactor(gen-ai-assets): Store assets by type, deduplicate, and handl…
asvinb Feb 5, 2026
87772a1
refactor(data): Streamline Gen AI asset merging and cleanup
asvinb Feb 6, 2026
5829697
refactor(gen-ai): Rename asset generation state and function variables
asvinb Feb 6, 2026
9c24829
docs(hooks): Add JSDoc to useCreateGenAIAssets hook
asvinb Feb 6, 2026
919b355
build: Update bundle max sizes
asvinb Feb 6, 2026
e540522
test(e2e): Update expected ad copy in paid campaign tests
asvinb Feb 6, 2026
b79fe6a
Merge pull request #3247 from woocommerce/fix/GOOWOO-399-ai-icons
ankitguptaindia Feb 6, 2026
318c9a7
Merge branch 'feature/GOOWOO-383-genai-assets' into feature/sbm-genai…
asvinb Feb 13, 2026
8f4b3ad
Update all library version references to v22
jjgrainger Feb 13, 2026
d0dfa6e
WIP / untested; fix conflicts between SBM and GenAI.
jamesmorrison Feb 23, 2026
639001e
Resolved PHP / composer errors.
jamesmorrison Feb 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions bin/GoogleAdsCleanupServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GoogleAdsCleanupServices {
*
* @var string
*/
protected $version = 'V20';
protected $version = 'V22';

/**
* @var Event Composer event.
Expand All @@ -52,12 +52,11 @@ class GoogleAdsCleanupServices {
* @var string[] List of Service to NOT remove even when usage is not found.
*/
protected $avoid_cleanup = [
// Some methods like `ResourceNames::forGeoTargetConstant` are changed to use
// `BatchJobServiceClient` class instead of `GoogleAdsServiceClient` when
// upgrading from v18 to v20, so we need to keep this service. See:
// - https://github.com/googleads/google-ads-php/blob/v28.0.0/src/Google/Ads/GoogleAds/Util/V18/ResourceNames.php#L1704-L1710
// ConversionValueRuleService is now used in `ResourceNames::forGeoTargetConstant` in V22.
// instead of the previous BatchJobServiceClient. See:
// - https://github.com/googleads/google-ads-php/blob/v28.0.0/src/Google/Ads/GoogleAds/Util/V20/ResourceNames.php#L1433-L1439
'BatchJob',
// - https://github.com/googleads/google-ads-php/blob/v31.1.0/src/Google/Ads/GoogleAds/Util/V22/ResourceNames.php#L1457-L1463
'ConversionValueRule',
];

/**
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"ext-json": "*",
"google/apiclient": "^2.16",
"google/apiclient-services": "^0.350.0",
"googleads/google-ads-php": "dev-legacy-v31.0.1",
"googleads/google-ads-php": "dev-legacy-v31.1.0",
"league/container": "^4.2",
"league/iso3166": "^4.1",
"phpseclib/bcmath_compat": "^2.0",
Expand Down Expand Up @@ -60,7 +60,7 @@
"Google\\Task\\Composer::cleanup",
"Automattic\\WooCommerce\\GoogleListingsAndAds\\Util\\SymfonyPolyfillCleanup::remove",
"Automattic\\WooCommerce\\GoogleListingsAndAds\\Util\\GoogleAdsCleanupServices::remove",
"composer run-script remove-google-ads-api-version-support -- 18 19 21",
"composer run-script remove-google-ads-api-version-support -- 18 19 20 21",
"php ./bin/prefix-vendor-namespace.php",
"bash ./bin/cleanup-vendor-files.sh",
"composer dump-autoload"
Expand Down
19 changes: 10 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ module.exports = {
],
moduleNameMapper: {
'\\.(png|jpg)$': '<rootDir>/tests/mocks/assets/imageMock.js',
'\\.svg$': '<rootDir>/tests/mocks/assets/svgrMock.js',
'\\.svg\\?inline$': '<rootDir>/tests/mocks/assets/svgrMock.js',
'\\.svg$': '<rootDir>/tests/mocks/assets/svgFileMock.js',
'\\.scss$': '<rootDir>/tests/mocks/assets/styleMock.js',
// Transform our `~/` alias.
'^~/(.*)$': '<rootDir>/js/src/$1',
Expand Down
129 changes: 129 additions & 0 deletions js/src/components/paid-ads/__snapshots__/gen-ai-card.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`GenAICard Generate assets with GenAI button Match the snapshot 1`] = `
<DocumentFragment>
<div
class="components-surface components-card gla-gen-ai-card css-1tft2nr-View-Surface-getBorders-primary-Card-rounded e19lxcc00"
data-wp-c16t="true"
data-wp-component="Card"
>
<div
class="css-1hgy6nb-View-Content e19lxcc00"
>
<div
class="components-card__body components-card-body css-h6g56v-View-Body-borderRadius-large e19lxcc00"
data-wp-c16t="true"
data-wp-component="CardBody"
>
<div
class="components-flex css-11kn0n8-View-Flex-base-ItemsColumn e19lxcc00"
data-wp-c16t="true"
data-wp-component="Flex"
>
<div
class="components-flex-item components-flex-block css-1xq6y8a-View-Item-sx-Base-block e19lxcc00"
data-wp-c16t="true"
data-wp-component="FlexBlock"
>
<div
class="components-flex css-v3bz0k-View-Flex-base-ItemsColumn e19lxcc00"
data-wp-c16t="true"
data-wp-component="Flex"
>
<div>
<div
class="gla-subsection-title gla-section-card-title"
direction="column-reverse,row"
>
Review Your AI Suggestions
</div>
<div>
Google AI analyzed your campaign’s URL to automatically generate your ad assets. Please review the suggested text and images below to ensure they align with your brand.
</div>
</div>
<div
class="components-notice is-success"
>
<div
class="components-visually-hidden css-6272zb-View e19lxcc00"
data-wp-c16t="true"
data-wp-component="VisuallyHidden"
style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal;"
>
Notice
</div>
<div
class="components-notice__content"
>
<div
class="components-flex css-1u4qd2t-View-Flex-base-ItemsRow e19lxcc00"
data-wp-c16t="true"
data-wp-component="Flex"
>
<div
class="components-flex-item css-1wj1jhv-View-Item-sx-Base e19lxcc00"
data-wp-c16t="true"
data-wp-component="FlexItem"
>
<svg
aria-hidden="true"
focusable="false"
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
/>
</svg>
</div>
<div
class="components-flex-item components-flex-block css-1oh0tc9-View-Item-sx-Base-block e19lxcc00"
data-wp-c16t="true"
data-wp-component="FlexBlock"
>
<p>
Text assets were auto-populated with Google AI
</p>
</div>
</div>
<div
class="components-notice__actions"
/>
</div>
</div>
</div>
</div>
<div
class="components-flex-item css-1xomaer-View-Item-sx-Base e19lxcc00"
data-wp-c16t="true"
data-wp-component="FlexItem"
>
<img
alt="Google's Gen AI illustration"
decoding="async"
height="90"
loading="lazy"
src="SvgrURL"
width="92"
/>
</div>
</div>
</div>
</div>
<div
aria-hidden="true"
class="components-elevation css-14ikshg-View-Elevation-sx-Base-elevationClassName e19lxcc00"
data-wp-c16t="true"
data-wp-component="Elevation"
/>
<div
aria-hidden="true"
class="components-elevation css-14ikshg-View-Elevation-sx-Base-elevationClassName e19lxcc00"
data-wp-c16t="true"
data-wp-component="Elevation"
/>
</div>
</DocumentFragment>
`;

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { Flex, FlexItem, Tip } from '@wordpress/components';

/**
* Internal dependencies
Expand Down Expand Up @@ -33,7 +34,8 @@ const AssetGroupImagesSection = ( {
getNumOfIssues,
renderErrors,
} ) => {
const { values, getInputProps } = useAdaptiveFormContext();
const { values, getInputProps, adapter } = useAdaptiveFormContext();
const showTip = adapter.hasAISuggestedMediaAssets;

return (
<Section
Expand Down Expand Up @@ -75,36 +77,57 @@ const AssetGroupImagesSection = ( {
}
>
<div className="gla-asset-group-section__content">
{ ASSET_IMAGE_SPECS.map( ( spec ) => {
const initialImageUrls = initialValues[ spec.key ];
const imageProps = getInputProps( spec.key );

return (
<AssetField
key={ spec.key }
ref={ refFirstErrorField.bind( spec.key ) }
heading={ spec.heading }
subheading={ spec.subheading }
help={ spec.help }
numOfIssues={ getNumOfIssues( spec.key ) }
markOptional={ spec.min === 0 }
disabled={ ! isSelectedFinalUrl }
initialExpanded={ isSelectedFinalUrl }
>
<ImagesSelector
initialImageUrls={ initialImageUrls }
maxNumberOfImages={ spec.getMax( values ) }
reachedMaxNumberTip={ spec.getMaxNumberTip(
values
<Flex direction="column" gap={ 4 }>
{ showTip && (
<FlexItem>
<Tip>
{ __(
"We've used your final URL to auto-populate images…",
'google-listings-and-ads'
) }
imageConfig={ spec.imageConfig }
onChange={ imageProps.onChange }
>
{ renderErrors( spec.key ) }
</ImagesSelector>
</AssetField>
);
} ) }
</Tip>
</FlexItem>
) }

<FlexItem>
{ ASSET_IMAGE_SPECS.map( ( spec ) => {
const initialImageUrls = initialValues[ spec.key ];
const imageProps = getInputProps( spec.key );

return (
<AssetField
key={ spec.key }
ref={ refFirstErrorField.bind( spec.key ) }
heading={ spec.heading }
subheading={ spec.subheading }
help={ spec.help }
numOfIssues={ getNumOfIssues( spec.key ) }
markOptional={ spec.min === 0 }
disabled={ ! isSelectedFinalUrl }
initialExpanded={ isSelectedFinalUrl }
>
<ImagesSelector
assetKey={ spec.key }
initialImageUrls={ initialImageUrls }
maxNumberOfImages={ spec.getMax(
values
) }
reachedMaxNumberTip={ spec.getMaxNumberTip(
values
) }
imageConfig={ spec.imageConfig }
onChange={ imageProps.onChange }
generateButtonText={
spec.generateButtonText
}
>
{ renderErrors( spec.key ) }
</ImagesSelector>
</AssetField>
);
} ) }
</FlexItem>
</Flex>
</div>
</Section>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ const AssetGroupTextSection = ( {
maxCharacterCounts={ spec.maxCharacterCounts }
placeholder={ spec.capitalizedName }
addButtonText={ spec.addButtonText }
finalUrl={ finalUrl }
assetKey={ spec.key }
generateButtonPluralText={
spec.generateButtonPluralText
}
generateButtonSingularText={
spec.generateButtonSingularText
}
onChange={ ( texts ) => {
if ( spec.requiredSingleValue ) {
textProps.onChange( texts[ 0 ] );
Expand Down
Loading
Loading