Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline onboarding, post-onboarding and campaign setup #2682

Merged
merged 1,058 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1058 commits
Select commit Hold shift + click to select a range
1f18092
Remove unused components
joemcgill Oct 31, 2024
bfcc39b
Remove phone account card format
joemcgill Oct 31, 2024
d2b2a38
Remvove unused useCountryCallingCodeOptions
joemcgill Oct 31, 2024
cfa279c
Update js/src/dashboard/summary-section/paid-features/free-ad-credit.js
kt-12 Nov 1, 2024
96e4162
Update js/src/dashboard/summary-section/paid-features/free-ad-credit.js
kt-12 Nov 1, 2024
d5d1d2f
remove usage of sections, fix styling
kt-12 Nov 1, 2024
e4fa585
Merge branch 'feature/2538-performance-card-sep' of https://github.co…
kt-12 Nov 1, 2024
d043e81
remove margin
kt-12 Nov 1, 2024
b77f18e
seperate file for paid-features test
kt-12 Nov 1, 2024
cd7ec9f
fix button name
kt-12 Nov 1, 2024
6fe5003
update variable names and cleanup
kt-12 Nov 1, 2024
51d5187
cleanup
kt-12 Nov 1, 2024
ccc7edc
Merge branch 'feature/2460-google-ads-value-prop' into feature/2538-p…
kt-12 Nov 1, 2024
2d77db8
check when ads complete is set
kt-12 Nov 1, 2024
0fcba0f
change variable name
kt-12 Nov 1, 2024
38318b2
avoide flakyness
kt-12 Nov 1, 2024
17e7c84
Address CR feedback.
asvinb Nov 1, 2024
a49f43f
Streamline StoreAddressCard states and display
joemcgill Nov 1, 2024
1e0ed3b
Fix linting errors.
asvinb Nov 1, 2024
f76a955
Resolve store address before showing the card
joemcgill Nov 1, 2024
a9f5530
Improve updateGoogleMCContactInformation resolution
joemcgill Nov 1, 2024
a98a698
Merge pull request #2661 from woocommerce/update/2602-sync-mc-address…
joemcgill Nov 1, 2024
7e87761
Check MC address setup when getting setup status and remove phone ver…
joemcgill Nov 1, 2024
852dfde
Fix MerchantCenterServiceTests tests
joemcgill Nov 1, 2024
0e15813
Add MerchantCenterAccountInfoCard component.
asvinb Nov 4, 2024
4e201c1
Fix linting errors.
asvinb Nov 4, 2024
2297982
change variable name
kt-12 Nov 4, 2024
65e6854
Remove unused component.
asvinb Nov 4, 2024
f8f9c4a
remove additional assignement
kt-12 Nov 4, 2024
4b777bc
Reorder imports.
asvinb Nov 4, 2024
9a368f1
Use correcct prop name.
asvinb Nov 4, 2024
90db787
UX improvements.
asvinb Nov 4, 2024
797ea87
Review comments.
asvinb Nov 4, 2024
74ff220
Use single quotes.
asvinb Nov 4, 2024
3dd73fc
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
asvinb Nov 4, 2024
d34aed4
Port over changes.
asvinb Nov 4, 2024
e6222de
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 4, 2024
2d9c2cf
Use correct class name.
asvinb Nov 4, 2024
5638687
Improve 'Connect Google account' E2E tests
joemcgill Nov 4, 2024
d7d17ad
style changes
kt-12 Nov 4, 2024
311a850
update E2E
kt-12 Nov 4, 2024
6bb4318
Update title and indicator label.
asvinb Nov 5, 2024
d46d6ca
Merge branch 'update/2603-create-ads-account' of github.com:woocommer…
asvinb Nov 5, 2024
866410d
Rename label.
asvinb Nov 5, 2024
e90aaca
Merge branch 'update/2597-connect-mc-account' into update/2605-edit-a…
asvinb Nov 5, 2024
f899c31
jest update
kt-12 Nov 5, 2024
ff4376e
fix review changes.
kt-12 Nov 5, 2024
f46e880
fix jest
kt-12 Nov 5, 2024
f0ab0f6
fix unused variable
kt-12 Nov 5, 2024
9caf01d
remove only
kt-12 Nov 5, 2024
66de193
Address CR feedback.
asvinb Nov 5, 2024
b9f41b1
Merge branch 'update/2597-connect-mc-account' into update/2605-edit-a…
asvinb Nov 5, 2024
05580c3
Fix linting errors.
asvinb Nov 5, 2024
0a6c386
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 5, 2024
dacbd04
Add condition to not render the claim components if there's no connec…
asvinb Nov 5, 2024
10cdd81
Merge branch 'update/2597-connect-mc-account' into update/2605-edit-a…
asvinb Nov 5, 2024
19b076a
Show conversion notice when account is being updated.
asvinb Nov 5, 2024
50e36fd
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 5, 2024
218149d
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 5, 2024
4656f74
Add callback.
asvinb Nov 5, 2024
59d586f
Simplify loading for ClaimAccountsButton
joemcgill Nov 5, 2024
960008b
Use useEffect to toggleconversion notice state
joemcgill Nov 5, 2024
8fa757e
Fix jest tests
joemcgill Nov 5, 2024
ec43e8f
Always show the address card when MC is connected
joemcgill Nov 6, 2024
4905228
Revert refresh button to previous behavior
joemcgill Nov 6, 2024
c024b95
Sync MC at the completion of step 1
joemcgill Nov 6, 2024
5098fe8
Reinstate EditStoreAddress flow in settings
joemcgill Nov 6, 2024
c1d0c25
Remove showValidation prop
joemcgill Nov 6, 2024
49c26f0
Update button text in docs/tests
joemcgill Nov 6, 2024
5a27b75
fix jest
kt-12 Nov 6, 2024
f8c3339
remove unnecessary typecasting.
kt-12 Nov 6, 2024
b42286d
Update E2E tests.
asvinb Nov 6, 2024
75c7827
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 6, 2024
fea64c6
Address CR feedback.
asvinb Nov 6, 2024
ad78ecb
Merge branch 'update/2582-claim-ads-account' into update/2605-edit-ac…
asvinb Nov 6, 2024
801c6c9
Revert changes.
asvinb Nov 6, 2024
92fb813
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 6, 2024
3b1dc9d
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 6, 2024
0e80569
css changes
kt-12 Nov 6, 2024
64eaab6
div -> component
kt-12 Nov 6, 2024
65e6571
Add E2E tests.
asvinb Nov 6, 2024
afdb054
Move condition.
asvinb Nov 6, 2024
900d45d
Merge pull request #2639 from woocommerce/update/2597-connect-mc-account
joemcgill Nov 6, 2024
d922470
Better E2E tests.
asvinb Nov 6, 2024
3a468d0
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
asvinb Nov 6, 2024
442b478
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
asvinb Nov 6, 2024
d772944
Update address card copy
joemcgill Nov 6, 2024
921cd2c
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
joemcgill Nov 6, 2024
3e2d8ee
E2E: Remove conversion action case from Ads claim test
joemcgill Nov 6, 2024
80764f0
Improve 'Connect Google account' E2E tests
joemcgill Nov 4, 2024
01f1097
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
joemcgill Nov 6, 2024
0f38c5e
E2E: Remove unused fixture method
joemcgill Nov 6, 2024
7ded84d
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
joemcgill Nov 6, 2024
b0c712e
Style fixes
joemcgill Nov 7, 2024
64eb3b4
More style adjustments
joemcgill Nov 7, 2024
30ac53a
Add loading state to the Continue button
joemcgill Nov 7, 2024
d1fe9eb
add new Fulfill for ad report.
kt-12 Nov 7, 2024
c7bbc72
check for text content in Summary+ mock add empty campaign.
kt-12 Nov 7, 2024
0f809f3
update variable name.
kt-12 Nov 7, 2024
c724767
remove margin
kt-12 Nov 7, 2024
1a516c7
remove size attribute.
kt-12 Nov 7, 2024
36a13e4
Use actions prop.
asvinb Nov 7, 2024
2c3f089
Merge pull request #2650 from woocommerce/feature/2538-performance-ca…
joemcgill Nov 7, 2024
efa273b
Address CR feedback.
asvinb Nov 7, 2024
5e81fba
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 7, 2024
1db35fa
Use detail prop.
asvinb Nov 7, 2024
fc6214d
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 7, 2024
1eadc09
Match spacing with designs.
asvinb Nov 7, 2024
b89142d
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 7, 2024
80fd522
Refine E2E tests.
asvinb Nov 7, 2024
6de9cc0
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 7, 2024
53bab84
Update E2E tests
joemcgill Nov 7, 2024
83374a1
Revert logic to display conversion notice.
asvinb Nov 8, 2024
4fd8997
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 8, 2024
1e8a618
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 8, 2024
846f975
Always hide conversion notice when clicking cancel.
asvinb Nov 8, 2024
fcf69f2
Remove autoadded code.
asvinb Nov 8, 2024
41e518e
Address CR feedback.
asvinb Nov 8, 2024
24a9c4f
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 8, 2024
d0b30d2
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 8, 2024
8ff97a7
Update tests.
asvinb Nov 8, 2024
bccac35
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 8, 2024
972f452
Fix rendering issue.
asvinb Nov 8, 2024
35580cb
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 8, 2024
328a264
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 8, 2024
c1b6828
Add loading indicator while invite link is being resolved.
asvinb Nov 8, 2024
3044904
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
asvinb Nov 8, 2024
d82c8d8
Address CR feedback.
asvinb Nov 8, 2024
4be14db
Fix ConnectAds props
joemcgill Nov 11, 2024
ab319c7
Fix E2E tests
joemcgill Nov 11, 2024
43c5ab9
Don't show Claim Ads while upsert in progress
joemcgill Nov 11, 2024
6e2b00d
Don't render the claim button without a URL
joemcgill Nov 11, 2024
ac3eef9
Consolodate logic for showing Ads Conversion notice
joemcgill Nov 11, 2024
a05eb38
Merge branch 'update/2582-claim-ads-account' into update/2603-create-…
joemcgill Nov 11, 2024
d074504
Limit Ads claim updates to 3 retries
joemcgill Nov 11, 2024
be3e8ec
Limit Ads claim updates to 3 retries
joemcgill Nov 11, 2024
d38b1ec
Remove 'Paid' from ads creation
joemcgill Nov 11, 2024
0f0aa16
Update Connect to different Google account button text
joemcgill Nov 12, 2024
ba22a30
Eliminate border radius between combo account cards
joemcgill Nov 12, 2024
4ac7c89
Update E2E test description
joemcgill Nov 12, 2024
3a36464
Update src/Tracking/README.md
joemcgill Nov 12, 2024
51718c2
Inline docs updates
joemcgill Nov 12, 2024
3492fa5
Docblock fix
joemcgill Nov 12, 2024
27fa0b1
Remove redundant loading prop from ClaimAccountButton
joemcgill Nov 12, 2024
6c93d64
Remove waiting state from ClaimAdsAccount component
joemcgill Nov 12, 2024
df93210
Revert title change in GoogleAdsAccountCard
joemcgill Nov 12, 2024
660ea2a
Rename onClick callback handlers
joemcgill Nov 12, 2024
3b9dbbb
Disconnect Ads when switching Google accounts
joemcgill Nov 12, 2024
54448e3
Update JSDoc.
asvinb Nov 13, 2024
9dbd087
Merge branch 'update/2603-create-ads-account' into update/2605-edit-a…
asvinb Nov 13, 2024
8260f12
Fix linting errors.
asvinb Nov 13, 2024
de1c98c
Remove unused imports.
asvinb Nov 13, 2024
768ce3c
Merge pull request #2644 from woocommerce/update/2582-claim-ads-account
joemcgill Nov 13, 2024
55cbeb9
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
joemcgill Nov 13, 2024
f2aa1c9
E2E: Remove flaky mocks from auto account creation test
joemcgill Nov 13, 2024
14c080e
Merge pull request #2651 from woocommerce/update/2603-create-ads-account
joemcgill Nov 13, 2024
1ace9be
Don't change import order
joemcgill Nov 13, 2024
c8f8be0
Improve card actions related to edit mode
joemcgill Nov 13, 2024
efb1bd3
Fix lint
joemcgill Nov 13, 2024
9795661
Fix inline docs
joemcgill Nov 13, 2024
f9ea219
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
joemcgill Nov 13, 2024
8b141d1
Update E2E tests
joemcgill Nov 13, 2024
428738c
Remove phone verification actions
joemcgill Nov 13, 2024
5c129a4
Remove useGoogleMCPhoneNumber and related selector and deps
joemcgill Nov 13, 2024
d4c0daa
Tweak address card description color
joemcgill Nov 13, 2024
059fd99
Correct inline docs
joemcgill Nov 13, 2024
49f8f82
Update ContactInformationPreview and export as default
joemcgill Nov 13, 2024
1372d3e
Remove redundant div wrapper for addressContent
joemcgill Nov 13, 2024
e49ca66
Simplify StoreAddressCard description
joemcgill Nov 13, 2024
299fad7
Use isAddressFilled from useStoreAddress hook
joemcgill Nov 13, 2024
6ad177b
Add blank line
joemcgill Nov 13, 2024
c0d25ec
Update fires tags
joemcgill Nov 14, 2024
eeb596b
Rename and simplify useStoreAddressSynced hook
joemcgill Nov 14, 2024
a1360bf
Fix handleSubmitCallback error handling
joemcgill Nov 14, 2024
e55f65e
Update E2E test docs
joemcgill Nov 14, 2024
ddbb900
Improve E2E tests
joemcgill Nov 14, 2024
866e7b6
Remove phone number validation from MerchantTrait and ContactInformat…
joemcgill Nov 14, 2024
7d49d69
Update the package-lock.json file to reflect the revmoval of the `lib…
eason9487 Nov 14, 2024
6fff925
Fix typo in JSdoc
joemcgill Nov 14, 2024
0d63a35
Pass createMCAccount to useAutoCreateAdsMCAccounts
joemcgill Nov 14, 2024
c77748c
Remove unused property
joemcgill Nov 14, 2024
64085a0
Merge pull request #2653 from woocommerce/update/2602-sync-mc-address
joemcgill Nov 14, 2024
3e46d07
Merge branch 'feature/2509-consolidate-google-account-cards' into upd…
joemcgill Nov 14, 2024
fa1f5ed
Remove additional instances of the word 'paid' with Ads
joemcgill Nov 14, 2024
cef1b83
Copy tweak
joemcgill Nov 14, 2024
2ea19b8
Better card handling during auto-creation
joemcgill Nov 15, 2024
8d93a0e
E2E Add post auto-creation test
joemcgill Nov 15, 2024
08f96a7
Dont' show the edit button when showConnectMC is true and the Ads cla…
joemcgill Nov 15, 2024
1b0ad3e
Improve JSDoc
joemcgill Nov 15, 2024
392bdd7
Check existing accounts in the mc reclaim url card
joemcgill Nov 15, 2024
27a9627
Show MC Reclaim card after refresh
joemcgill Nov 15, 2024
767a129
Fix the issue that E2E test can't log in to wp-admin.
eason9487 Nov 11, 2024
9b71ea6
Results typically improve with time
joemcgill Nov 17, 2024
933e5b4
Skip ads creation
joemcgill Nov 17, 2024
a70da30
Fix the issue that E2E test can't log in to wp-admin.
eason9487 Nov 11, 2024
10dc1c9
Reach more shoppers with Google Ads
joemcgill Nov 17, 2024
98c62a5
Merge pull request #2672 from woocommerce/update/2664-remove-paid-word
joemcgill Nov 17, 2024
109b724
Add external icon to Claim button
joemcgill Nov 17, 2024
17dab80
This may take a few moments, please wait…
joemcgill Nov 17, 2024
0348394
Only show Address Card once MC is ready
joemcgill Nov 17, 2024
ff47280
Reset connection flow if refreshed
joemcgill Nov 18, 2024
6a7d33e
Remove unnecessary ID from ReclaimUrlCard
joemcgill Nov 18, 2024
fa5a2d3
Omit createInterpolateElement
joemcgill Nov 18, 2024
4343210
Improve ConnectAds UI when connected account is not in existing accounts
joemcgill Nov 18, 2024
93d588e
Allow connected Ads account to be edited when claiming
joemcgill Nov 18, 2024
fd0ad0e
Improve edit mode when there are no existing accounts
joemcgill Nov 18, 2024
0e413b9
Remove unused import
joemcgill Nov 18, 2024
aef0d4a
Add edit button tests
joemcgill Nov 18, 2024
97465bc
Improve combo card border radius CSS
joemcgill Nov 18, 2024
d3d4c34
Lint fixes
joemcgill Nov 18, 2024
58820c1
Require an ID for hasGoogleMCConnection
joemcgill Nov 18, 2024
87049d8
Show disconnect button if there is 1 other existing account
joemcgill Nov 19, 2024
2b213f4
Consider the ConnectMCCard connected even when incomplete
joemcgill Nov 19, 2024
ffd0de5
Merge branch 'develop' into feature/2458-streamline-onboarding
eason9487 Nov 20, 2024
08cec68
Temporarily extend the build zip retention days on GitHub Actions.
eason9487 Nov 20, 2024
4c934e4
Merge pull request #2631 from woocommerce/feature/2458-streamline-onb…
eason9487 Nov 20, 2024
883d1db
Disable button if there are no Ads accounts except that the one that …
asvinb Nov 20, 2024
2c370e4
Text tweak
joemcgill Nov 18, 2024
a98898a
Adjust the JSDoc and test case description for the create Google Ads …
eason9487 Nov 21, 2024
68fa52b
Add code comment to the `ConnectedGoogleComboAccountCard` for a speci…
eason9487 Nov 21, 2024
4998d88
Merge pull request #2660 from woocommerce/update/2605-edit-accounts
eason9487 Nov 21, 2024
1d3cdb0
Merge pull request #2683 from woocommerce/udpate/2460-additional-text…
eason9487 Nov 21, 2024
e80472a
Temporarily run E2E testing on GitHub Actions for the `feature/2458-2…
eason9487 Nov 21, 2024
2044003
Merge pull request #2632 from woocommerce/feature/2459-campaign-creat…
eason9487 Nov 21, 2024
fab41e3
Merge branch 'feature/2458-2459-2460-2509' into feature/2509-consolid…
eason9487 Nov 21, 2024
69fc117
Fix E2E testing for step 2 of the onboarding.
eason9487 Nov 21, 2024
6f93f78
Remove unnecessary mocks for the E2E testing from step 2 of the onboa…
eason9487 Nov 21, 2024
cc2440a
Rename the CSS class name and remove unused style for the section of …
eason9487 Nov 21, 2024
3e49942
Rename `ConnectAdsFooter` to `ConnectExistingAccountActions` for bett…
eason9487 Nov 21, 2024
b763438
Adjust exports and imports for better consistency and control of comp…
eason9487 Nov 21, 2024
e2fafdd
Avoid flaky E2E testing for the "Validate budget percent" test cases …
eason9487 Nov 21, 2024
0e50835
Avoid API errors during E2E testing for the onboarding.
eason9487 Nov 21, 2024
1774b2f
Remove unused mocking methods from E2E testing.
eason9487 Nov 21, 2024
42335a1
Merge pull request #2634 from woocommerce/feature/2509-consolidate-go…
eason9487 Nov 21, 2024
37dacee
Merge branch 'feature/2458-2459-2460-2509' into feature/2460-google-a…
eason9487 Nov 21, 2024
32adc37
Merge pull request #2635 from woocommerce/feature/2460-google-ads-val…
eason9487 Nov 21, 2024
087e654
Rename files and adjust JSDoc for better consistency.
eason9487 Nov 22, 2024
214377a
Remove an unnecessary mocked value from the claim-account-button.test…
eason9487 Nov 22, 2024
b1998c9
Revert unnecessary code changes.
eason9487 Nov 22, 2024
f252968
Merge branch 'develop' into feature/2458-2459-2460-2509
eason9487 Nov 22, 2024
eff6271
Add the `onDisconnected` callback to the `DisconnectAccount` and `Con…
eason9487 Nov 22, 2024
a686290
Reset the account ID state in `ConnectExistingAccount` after account …
eason9487 Nov 22, 2024
ed1bc62
Explicitly go to login page
mikkamp Nov 22, 2024
8c1a9a5
Revert explicitly go to login page
mikkamp Nov 22, 2024
8d0e378
Merge branch 'develop' into feature/2458-2459-2460-2509
eason9487 Nov 25, 2024
b8587e6
Merge branch 'feature/2458-2459-2460-2509' into fix/connect-to-invali…
eason9487 Nov 25, 2024
f2c732b
Merge pull request #2688 from woocommerce/fix/connect-to-invalid-ads-id
eason9487 Nov 25, 2024
3a396e8
Revert "Temporarily run E2E testing on GitHub Actions for the `featur…
eason9487 Nov 25, 2024
70a088a
Revert "Temporarily extend the build zip retention days on GitHub Act…
eason9487 Nov 25, 2024
6c15833
Update `src/Tracking/README.md`.
eason9487 Nov 25, 2024
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
51 changes: 31 additions & 20 deletions js/src/components/account-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
import { __ } from '@wordpress/i18n';
import classnames from 'classnames';
import { Flex, FlexItem, FlexBlock } from '@wordpress/components';
import GridiconPhone from 'gridicons/dist/phone';
import { Icon, store as storeIcon } from '@wordpress/icons';

/**
Expand All @@ -30,7 +28,6 @@
GOOGLE: 'google',
GOOGLE_MERCHANT_CENTER: 'google_merchant_center',
GOOGLE_ADS: 'google_ads',
PHONE: 'phone',
ADDRESS: 'address',
FINAL_URL: 'final_url',
};
Expand Down Expand Up @@ -105,10 +102,6 @@
'google-listings-and-ads'
),
},
[ APPEARANCE.PHONE ]: {
icon: <GridiconPhone size={ 32 } />,
title: __( 'Phone number', 'google-listings-and-ads' ),
},
[ APPEARANCE.ADDRESS ]: {
icon: <Icon icon={ storeIcon } size={ 32 } />,
title: __( 'Store address', 'google-listings-and-ads' ),
Expand All @@ -122,7 +115,12 @@
// The `center` is the default alignment, and no need to append any additional class name.
const alignStyleName = {
center: false,
top: `gla-account-card__styled--align-top`,
top: 'gla-account-card__styled--align-top',
};

const indicatorAlignStyleName = {
...alignStyleName,
toDetail: 'gla-account-card__indicator--align-to-detail',
};

/**
Expand All @@ -142,6 +140,9 @@
* @param {JSX.Element} [props.indicator] Indicator of actions or status on the right side of the card.
* @param {'center'|'top'} [props.alignIcon='center'] Specify the vertical alignment of leading icon.
* @param {'center'|'top'} [props.alignIndicator='center'] Specify the vertical alignment of `indicator`.
* @param {JSX.Element} [props.detail] Detail content below the card description.
* @param {boolean} [props.expandedDetail=false] Whether to expand the detail content.
* @param {JSX.Element} [props.actions] Actions content below the card detail.
* @param {Array<JSX.Element>} [props.children] Children to be rendered if needs more content within the card.
* @param {Object} [props.restProps] Props to be forwarded to Section.Card.
*/
Expand All @@ -156,12 +157,16 @@
alignIcon = 'center',
indicator,
alignIndicator = 'center',
detail,
expandedDetail = false,
actions,
children,
...restProps
} ) {
const cardClassName = classnames(
'gla-account-card',
disabled ? 'gla-account-card--is-disabled' : false,
expandedDetail ? 'gla-account-card--is-expanded-detail' : false,
className
);

Expand All @@ -172,19 +177,15 @@

const indicatorClassName = classnames(
'gla-account-card__indicator',
alignStyleName[ alignIndicator ]
indicatorAlignStyleName[ alignIndicator ]
);

return (
<Section.Card className={ cardClassName } { ...restProps }>
<Section.Card.Body>
<Flex gap={ 4 }>
{ icon && (
<FlexItem className={ iconClassName }>
{ icon }
</FlexItem>
) }
<FlexBlock>
<div className="gla-account-card__body-layout">
{ icon && <div className={ iconClassName }>{ icon }</div> }
<div className="gla-account-card__subject">
{ title && (
<Subsection.Title className="gla-account-card__title">
{ title }
Expand All @@ -200,13 +201,23 @@
{ helper }
</div>
) }
</FlexBlock>
</div>
{ detail && (
<div className="gla-account-card__detail">

Check warning on line 206 in js/src/components/account-card/index.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/account-card/index.js#L206

Added line #L206 was not covered by tests
{ detail }
</div>
) }
{ indicator && (
<FlexItem className={ indicatorClassName }>
<div className={ indicatorClassName }>
{ indicator }
</FlexItem>
</div>
) }
{ actions && (
<div className="gla-account-card__actions">

Check warning on line 216 in js/src/components/account-card/index.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/account-card/index.js#L216

Added line #L216 was not covered by tests
{ actions }
</div>
) }
</Flex>
</div>
</Section.Card.Body>
{ children }
</Section.Card>
Expand Down
52 changes: 48 additions & 4 deletions js/src/components/account-card/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,60 @@
opacity: 0.5;
}

&--is-expanded-detail {
.gla-account-card__indicator {
grid-area: 1/3;
}

.gla-account-card__detail {
grid-area: 2/2/auto/span 2;
}
}

&__styled {
&--align-top {
align-self: flex-start;
}
}

&__body-layout {
display: grid;
grid-template-columns: auto 1fr auto;
align-items: center;
}

&__icon {
grid-area: 1/1/span 2;
margin-right: $grid-unit-20;
line-height: 0;
}

&__subject {
grid-area: 1/2;
}

&__indicator {
grid-area: 1/3/span 2;
margin-left: $grid-unit-20;

&--align-to-detail {
grid-area: 2/3;
margin-top: $grid-unit-15;
}
}

&__detail {
grid-area: 2/2;
margin-top: $grid-unit-15;
}

&__actions {
grid-area: 3/2/auto/span 2;
margin-top: $grid-unit-15;
}

&__title {
margin-bottom: $grid-unit-05;
margin: 0;
color: $black;
}

Expand All @@ -25,6 +67,7 @@
flex-direction: column;
align-items: flex-start;
gap: 1em;
margin-top: $grid-unit-05;
color: $gray-900;

> p {
Expand Down Expand Up @@ -65,11 +108,12 @@
}

@media (max-width: $break-small) {
.components-card__body > .components-flex {
&__body-layout {
display: flex;
flex-direction: column;
align-items: flex-start;
> .components-flex-block,
> .components-flex-item {

> div {
margin: $grid-unit-10;
}
}
Expand Down
64 changes: 64 additions & 0 deletions js/src/components/ads-account-select-control/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* External dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { getSetting } from '@woocommerce/settings'; // eslint-disable-line import/no-unresolved

/**
* Internal dependencies
*/
import AppSelectControl from '.~/components/app-select-control';
import useExistingGoogleAdsAccounts from '.~/hooks/useExistingGoogleAdsAccounts';
import useGoogleAdsAccount from '.~/hooks/useGoogleAdsAccount';

/**
* @param {Object} props The component props
* @return {JSX.Element} An enhanced AppSelectControl component.
*/
const AdsAccountSelectControl = ( props ) => {
const { existingAccounts } = useExistingGoogleAdsAccounts();
const { googleAdsAccount, hasGoogleAdsConnection } = useGoogleAdsAccount();

const accountIdExists = existingAccounts?.some(
( existingAccount ) => existingAccount.id === googleAdsAccount?.id
);

// If the account ID is not in the list of existing accounts, fake the select options by displaying the connected account ID only.
if ( ! accountIdExists && hasGoogleAdsConnection ) {
const domain = new URL( getSetting( 'homeUrl' ) ).host;

Check warning on line 28 in js/src/components/ads-account-select-control/index.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/ads-account-select-control/index.js#L28

Added line #L28 was not covered by tests

return (

Check warning on line 30 in js/src/components/ads-account-select-control/index.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/ads-account-select-control/index.js#L30

Added line #L30 was not covered by tests
<AppSelectControl
autoSelectFirstOption
nonInteractive
value={ googleAdsAccount.id }
options={ [
{
value: googleAdsAccount.id,
label: sprintf(
// translators: 1: account domain, 2: account ID.
__( '%1$s (%2$s)', 'google-listings-and-ads' ),
domain,
googleAdsAccount.id
),
},
] }
/>
);
}

const options = existingAccounts?.map( ( acc ) => ( {
value: acc.id,
label: `${ acc.name } (${ acc.id })`,
} ) );

return (
<AppSelectControl
options={ options }
autoSelectFirstOption
{ ...props }
/>
);
};

export default AdsAccountSelectControl;
2 changes: 2 additions & 0 deletions js/src/components/app-input-control/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
color: $gray-700;
}

&.has-error .components-input-control__backdrop,
&--error-character-count .components-input-control .components-input-control__container .components-input-control__backdrop {
border-color: $alert-red;
box-shadow: none;
}

&.has-error .components-base-control__help,
&--error-character-count &__character-count {
color: $alert-red;
}
Expand Down
63 changes: 55 additions & 8 deletions js/src/components/app-select-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* External dependencies
*/
import { SelectControl } from '@wordpress/components';
import { useEffect, useRef } from '@wordpress/element';
import classNames from 'classnames';
import { noop } from 'lodash';

/**
* Internal dependencies
Expand All @@ -12,18 +14,63 @@
/**
* Renders a `@wordpress/components`'s `SelectControl` with margin-bottom removed.
*
* If you provide `className` via props,
* it will be added to the container div's `className`,
* so that you can further control its style.
*
* @param {*} props
* @param {*} props The component props.
* @param {Array} [props.options=[]] Array of options for the select dropdown. Each option should be an object containing `label` and `value` properties.
* @param {string} [props.className] Additional classname to further control the style of the component.
* @param {Function} [props.onChange=noop] Callback function triggered when the selected value changes. Receives the new value as an argument.
* @param {string} [props.value] The currently selected value. This component should be used as a controlled component. A special case is that after mounting, when `autoSelectFirstOption` is true and `value` is undefined, it tries to call back `onChange` once to select the first option so that the `value` can be consistent with the `<select>` element's own value.
* @param {boolean} [props.autoSelectFirstOption=false] If true, automatically triggers the onChange callback with the first option as value when no value is provided. If only one option is available, the select control is also changed to non-interactive.
* @param {boolean} [props.nonInteractive=false] If true, the select control is changed to non-interactive.
* @param {*} [props.rest] Additional props passed to the `SelectControl` component.
*/
const AppSelectControl = ( props ) => {
const { className, ...rest } = props;
const {
options = [],

Check warning on line 28 in js/src/components/app-select-control/index.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/app-select-control/index.js#L28

Added line #L28 was not covered by tests
className,
onChange = noop,
value,
autoSelectFirstOption = false,
nonInteractive = false,
...rest
} = props;
const shouldAutoSelectOnceRef = useRef( autoSelectFirstOption === true );

useEffect( () => {
if ( ! shouldAutoSelectOnceRef.current ) {
return;
}

if ( value === undefined && options.length ) {
shouldAutoSelectOnceRef.current = false;
onChange( options[ 0 ].value );
}
}, [ value, options, onChange ] );

let selectProps = {
options,
value,
onChange,
...rest,
};

const isNonInteractive =
( autoSelectFirstOption && options?.length === 1 ) || nonInteractive;
if ( isNonInteractive ) {
selectProps = {

Check warning on line 59 in js/src/components/app-select-control/index.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/app-select-control/index.js#L59

Added line #L59 was not covered by tests
...selectProps,
readOnly: true,
suffix: ' ',
tabIndex: '-1',
};
}

return (
<div className={ classNames( 'app-select-control', className ) }>
<SelectControl { ...rest } />
<div
className={ classNames( 'app-select-control', className, {
'app-select-control--is-non-interactive': isNonInteractive,
} ) }
>
<SelectControl { ...selectProps } />
</div>
);
};
Expand Down
4 changes: 4 additions & 0 deletions js/src/components/app-select-control/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
.components-base-control__field {
margin-bottom: 0;
}

&.app-select-control--is-non-interactive {
pointer-events: none;
}
}
Loading