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

Streamlined Free Listings + Paid Ads and Ads Billing Pop-up for the onboarding flow #1722

Merged
merged 166 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
4881f34
Move SetupFreeListings component of editing free listings to the shar…
eason9487 Aug 3, 2022
93249e6
Change the shared ChooseAudience to ChooseAudienceSection and merge i…
eason9487 Aug 3, 2022
79911f8
Add validations for merged audience values in the shared SetupFreeLis…
eason9487 Aug 3, 2022
55e2c09
Replace SetupFreeListings with the shared one for the onboarding flow
eason9487 Aug 3, 2022
193ab56
Catch errors when saving data in the SavedSetupStepper of onboarding …
eason9487 Aug 3, 2022
20e758f
Remove unused files
eason9487 Aug 4, 2022
fdf10dc
Remove an unused npm package use-debounce
eason9487 Aug 4, 2022
159bd2d
Add the CountryCode type back to SetupFreeListings
eason9487 Aug 5, 2022
43a2f76
Add auto-saving for MC settings to fall back with the original implem…
eason9487 Aug 8, 2022
a473be5
Adjust layouts and copywriting for the Get Started page
eason9487 Aug 5, 2022
0980e14
Adjust layouts for StepContentHeader
eason9487 Aug 5, 2022
d5510e5
Change the logos of Google MC and Ads account cards
eason9487 Aug 5, 2022
fbf5235
Adjust layouts and copywriting for the accounts setup step
eason9487 Aug 5, 2022
8ea440d
Adjust layouts and copywriting for the product listings config step
eason9487 Aug 5, 2022
6f5cd0b
Adjust layouts and copywriting for the store requirements confirmatio…
eason9487 Aug 5, 2022
aede3e7
Add image mock to jest config to fix JS unit tests
eason9487 Aug 5, 2022
1f2b568
Fix a failed e2e test case due to copywriting change
eason9487 Aug 5, 2022
cf5a18e
Adjust the logic of `step` value reutrned by `mc/setup` API to fit wi…
eason9487 Aug 8, 2022
ab1c7eb
Add a new getProductFeedUrl function to utils/urls.js
eason9487 Aug 8, 2022
893b943
Add a new component SetupPaidAds as the Paid Ads setup step in the on…
eason9487 Aug 8, 2022
026abb4
Adjust the mapping of step keys and add step 4 to the onboarding flow
eason9487 Aug 8, 2022
d8ecc08
Add JSDoc for the `handleFormChange` function in SavedSetupStepper co…
eason9487 Aug 12, 2022
16244ee
Merge pull request #1616 from woocommerce/update/1610-merge-audience-…
eason9487 Aug 15, 2022
25a7d8a
Update copywriting that missed the revision for the onboarding flow.
eason9487 Aug 15, 2022
093b68e
Merge two test cases that both test the same step `product_listings` …
eason9487 Aug 15, 2022
34de75a
Merge pull request #1618 from woocommerce/update/1610-ui-updates-get-…
eason9487 Aug 15, 2022
680e817
Merge pull request #1619 from woocommerce/update/1610-add-onboarding-…
eason9487 Aug 15, 2022
6bcd41c
Merge branch 'develop' into feature/1610-streamlined-onboarding
eason9487 Aug 16, 2022
9333fa5
Extract a code fragment from the sync-status.js as `getNumberOfSyncPr…
eason9487 Aug 17, 2022
603438a
Implement ProductFeedStatusSection component and add it to the paid a…
eason9487 Aug 17, 2022
4566683
Add JSDoc for more functions that also relate to the `ProductStatisti…
eason9487 Aug 18, 2022
eddef3c
Merge pull request #1638 from woocommerce/add/1610-product-feed-statu…
eason9487 Aug 18, 2022
7d0010f
Add a new prop `topContent` to Section component and adjust some styles
eason9487 Aug 24, 2022
d526dce
Implement the section of paid ads features
eason9487 Aug 24, 2022
8735780
Add new images for the mockups of ad previews
eason9487 Aug 24, 2022
4520dc1
Add PaidAdsFeaturesSection to step 4 of the onboarding flow
eason9487 Aug 24, 2022
1bde4a9
Add the container for ad previews
eason9487 Aug 24, 2022
7e1d5a5
Implement shared components for the mockups of ad previews
eason9487 Aug 24, 2022
ca99756
Implement the Google Shopping mockup of ad previews
eason9487 Aug 24, 2022
88cfb40
Implement the YouTube mockup of ad previews
eason9487 Aug 24, 2022
87ce3bc
Implement the Google Search mockup of ad previews
eason9487 Aug 24, 2022
ced245d
Implement the Google Map mockup of ad previews
eason9487 Aug 24, 2022
1aa32c6
Implement the Google Display Network mockup of ad previews
eason9487 Aug 24, 2022
3b73e32
Implement the Gmail mockup of ad previews
eason9487 Aug 24, 2022
f3cc043
Move useCountdown.js to hooks directory and change the `handle` param…
eason9487 Aug 24, 2022
05779b9
Add ad previews to the paid ads features section
eason9487 Aug 24, 2022
3279a21
Rebalance the bundlewatch's max size of index.css to 120% of the new …
eason9487 Aug 24, 2022
6fe6ba7
Update the sample product image file to remove the white border from …
eason9487 Aug 25, 2022
d079dd5
Optional invalidate the related state in wp-data store after Google A…
eason9487 Aug 26, 2022
73ed932
Add a disconnect button to Google Ads account card for switching acco…
eason9487 Aug 26, 2022
320b4a5
Add an external link to Google Ads account card for opening Google's …
eason9487 Aug 26, 2022
ca656c4
Handle the page redirection for the AD_WORDS authorization of Google …
eason9487 Aug 26, 2022
26c736b
Tweak the copywriting and layouts for Google Ads account card
eason9487 Aug 26, 2022
e41a705
Implement the Google Ads account setup section to step 4 of the onboa…
eason9487 Aug 26, 2022
c59bcd3
Fix the incorrect `:active` CSS style for disabled AppButton
eason9487 Aug 26, 2022
05e2cc6
Fix the switch button at the footer is clickable when connecting a Go…
eason9487 Aug 26, 2022
6518b79
Tweak UI for the AudienceSection component
eason9487 Aug 26, 2022
0947ec3
Tweak UI for the BudgetSection-related components
eason9487 Aug 26, 2022
e38a58a
Fix that the validation of campaign `amount` should only allow a numb…
eason9487 Aug 26, 2022
3e0debd
Add the ads audience and budget sections to step 4 of the onboarding …
eason9487 Aug 26, 2022
0e65308
Use constants for the action values in the SetupPaidAds component.
eason9487 Aug 30, 2022
a0d2df8
Merge pull request #1649 from woocommerce/add/1610-paid-ads-features-…
eason9487 Aug 30, 2022
8e72981
Fix a typo in the JSDoc of js/src/components/paid-ads/campaign-previe…
eason9487 Aug 30, 2022
656aeb9
Fix the broken layout of PaidAdsFeaturesSection for the smaller viewp…
eason9487 Aug 30, 2022
c6908de
Merge thinnest, thinner, and thicker props as a single stroke prop fo…
eason9487 Aug 30, 2022
631e8fe
Merge smaller and larger props as a single size prop for ScaledText.
eason9487 Aug 30, 2022
c08364f
Two values were missed to be replaced with constants in the previous …
eason9487 Aug 30, 2022
722ca0a
Merge pull request #1650 from woocommerce/add/1610-paid-ads-previews
eason9487 Aug 30, 2022
cf68d7a
Merge pull request #1654 from woocommerce/add/1610-google-ads-account…
eason9487 Aug 30, 2022
4d7da2b
Use constants for the status of Google Ads account.
eason9487 Sep 5, 2022
f05b205
Merge pull request #1655 from woocommerce/add/1610-audience-budget-se…
eason9487 Sep 5, 2022
c298140
Merge branch 'develop' into feature/1610-streamlined-onboarding
eason9487 Sep 12, 2022
a2070ba
Merge branch 'develop' into feature/1610-streamlined-onboarding
eason9487 Sep 14, 2022
5b6522c
Fix a compatibility problem with WC 6.9 about the breaking change of …
eason9487 Sep 14, 2022
7a78a48
Merge pull request #1672 from woocommerce/fix/1610-compatible-wc-6-9
eason9487 Sep 15, 2022
f4e6a78
Add Google Ads account status to constants.js
eason9487 Sep 15, 2022
1f07354
Invalidate the store state of billing status when receiving Google Ad…
eason9487 Sep 15, 2022
67ee30c
Move files to the shared components directory
eason9487 Sep 15, 2022
289cadd
Add the hasFinishedResolution state to useGoogleAdsAccountBillingStat…
eason9487 Sep 15, 2022
3eca055
Implement the BillingCard component
eason9487 Sep 15, 2022
388b02b
Adjust the billing setup UI to the new design and open the setup URL …
eason9487 Sep 15, 2022
fd030a8
Add the billing card to the last step of onboarding flow
eason9487 Sep 15, 2022
174b70a
Implement the compaign creation and paid ads completion for the onboa…
eason9487 Sep 15, 2022
a3d7e53
Set different titles for the free listings setup of the onboarding an…
eason9487 Sep 16, 2022
809a66f
Change the URLs of the learn more links to the formal ones in the ads…
eason9487 Sep 16, 2022
af32314
Update the FAQs in the ads setup
eason9487 Sep 16, 2022
2a88576
Add the `disabledLeft` prop to Section component for showing the left…
eason9487 Sep 16, 2022
c3440ce
Add the `isPreconditionReady` property to useGoogleMCAccount hook for…
eason9487 Sep 16, 2022
e68dcfa
Add the disclaimer of Comparison Shopping Service to the accounts set…
eason9487 Sep 16, 2022
3314afc
Implement the submission success modal on the product feed page after…
eason9487 Sep 16, 2022
c1d9c82
Fix a SCSS linting error
eason9487 Sep 16, 2022
b4ccd66
Fix a failed JS test
eason9487 Sep 16, 2022
bda1447
Rephrase the code comment for more details of billing status watching…
eason9487 Sep 20, 2022
316a734
Change the onSetupComplete callback to an optional prop for BillingSe…
eason9487 Sep 20, 2022
ae4682c
Fix a typo for a code comment in SetupPaidAds component
eason9487 Sep 20, 2022
79fcd9d
Extract PaidAdsSectionsGroup as a standalone component PaidAdsSetupSe…
eason9487 Sep 20, 2022
9b80a86
Add utils for storing and restoring the states of paid ads setup in o…
eason9487 Sep 20, 2022
8e44e3c
Store the `showPaidAdsSetup` state and restore it when initializing t…
eason9487 Sep 20, 2022
6c8f3fc
Store the `paidAds` state and restore it when initializing the paid a…
eason9487 Sep 20, 2022
db23789
Merge pull request #1677 from woocommerce/update/1610-billing-and-cam…
eason9487 Sep 21, 2022
694d25d
Merge pull request #1679 from woocommerce/update/1610-ui-updates
eason9487 Sep 21, 2022
239b45f
Remove the try catch blocks from the clientSession.
eason9487 Sep 21, 2022
9f583b5
Add/rephrase code comments for the resolved initial paid ads.
eason9487 Sep 21, 2022
15338d1
Add a new condition total_sales in orderby param for product feed API
ianlin Sep 19, 2022
43773d9
Return image url and price of a product in product feed API
ianlin Sep 19, 2022
74c8f03
Add siteLogoUrl to glaData
ianlin Sep 20, 2022
540897f
Add `total_sales` in the allowed list of orderby param
ianlin Sep 21, 2022
7e3caaf
Move `total_sales` out of ProductMetaHandler
ianlin Sep 21, 2022
046f8fe
Merge pull request #1681 from woocommerce/update/1610-order-by-total-…
ianlin Sep 21, 2022
d02aaa1
Add event trackings for the buttons in the last step of onboarding flow
eason9487 Sep 22, 2022
22147b0
Update src/Tracking/README.md
eason9487 Sep 22, 2022
4f42f78
Do not refresh MC status when not onboarded for product feed API
ianlin Sep 23, 2022
2603c70
Fetch the product and site data from API and preload data for composi…
eason9487 Sep 23, 2022
39668f8
Tweak ScaledText style to prevent the font descender from getting cro…
eason9487 Sep 23, 2022
5572a4f
Add note for the state management of PaidAdsSetupSections.
eason9487 Sep 26, 2022
3c30706
Merge pull request #1683 from woocommerce/update/1610-store-restore-p…
eason9487 Sep 26, 2022
12a261b
Merge pull request #1689 from woocommerce/add/1610-event-tracking
eason9487 Sep 26, 2022
6e68765
Merge pull request #1693 from woocommerce/update/1610-do-not-refresh-…
ianlin Sep 26, 2022
84397ce
Merge pull request #1692 from woocommerce/update/1610-integrate-ad-pr…
eason9487 Sep 26, 2022
556677f
Add a new API `mc/syncable-products-count`
ianlin Sep 22, 2022
3b56c15
Add a batch job to update # of syncable products
ianlin Sep 26, 2022
8d4f739
Add a trait for syncable products batched action scheduler job
ianlin Sep 26, 2022
361c08c
Use a shared trait for UpdateAllProducts and UpdateSyncableProductsCount
ianlin Sep 26, 2022
18096d8
Add test for UpdateSyncableProductsCount
ianlin Sep 26, 2022
19e129f
Add a POST API to trigger the job that count the syncable products
ianlin Sep 26, 2022
e9c51a5
Update schema description for GET syncable products count API
ianlin Sep 26, 2022
0094870
Use one register_route for the same endpoint
ianlin Sep 27, 2022
25f3ee3
Switch to use options rather than transients for syncable products count
ianlin Sep 27, 2022
8a48750
Remove option syncable_products_count before the update job is scheduled
ianlin Sep 27, 2022
aaf27ae
Keep the intermediate product IDs for next batch to use for job
ianlin Sep 27, 2022
42f3a27
Update AbstractBatchedActionSchedulerJob to have the same pattern as
ianlin Sep 27, 2022
d01a43c
Use hardcoded value for expecting product count
ianlin Sep 28, 2022
963b327
Store 0 in DB when no syncable products and add tests for it
ianlin Sep 28, 2022
13e1a57
Return 0 when no syncable products, null when job hasn't finished
ianlin Sep 28, 2022
b6e27ea
Merge pull request #1699 from woocommerce/add/1610-syncable-products-api
ianlin Sep 29, 2022
ca6582c
Add a new hook for communicating with the calculation of the syncable…
eason9487 Sep 29, 2022
74ce676
Trigger the syncable products calculation in the Get Started page for…
eason9487 Sep 29, 2022
2afa78f
Fetch the number of syncable products in the ProductFeedStatusSection…
eason9487 Sep 29, 2022
8511198
Add loading state onto the UI of ProductFeedStatusSection component
eason9487 Sep 30, 2022
ff26925
Merge pull request #1706 from woocommerce/update/1610-integrate-synca…
eason9487 Oct 4, 2022
69f14cd
Swap variations for parent IDs for UpdateSyncableProductsCount job
ianlin Oct 2, 2022
4c01002
Group variations with same parent for synced products of statistics API
ianlin Oct 3, 2022
409742b
Group variations with same parent for not synced products of statisti…
ianlin Oct 3, 2022
eb9f841
Refactor find_mc_not_synced_product_ids so it'll process faster
ianlin Oct 4, 2022
0a87d8f
Delete SYNCABLE_PRODUCTS_COUNT_INTERMEDIATE_DATA before scheduling th…
ianlin Oct 4, 2022
ff43ed7
Merge branch 'develop' into feature/1610-streamlined-onboarding
eason9487 Oct 5, 2022
f14afcf
Add a new field `phone_verification_status` to the API `GET mc/contac…
eason9487 Oct 5, 2022
fdfa239
Add a phone verification status check to MerchantCenterService->is_mc…
eason9487 Oct 5, 2022
cdbf344
Add a new property `isVerified` to the returning data of `useGoogleMC…
eason9487 Oct 5, 2022
c4e45c7
Detect the verification status of the phone number in the onboarding …
eason9487 Oct 5, 2022
4cf3f29
Add the verification status of the phone number to PhoneNumberCardPre…
eason9487 Oct 5, 2022
c96b4c3
Call array_unique for a smaller dataset when updating syncable products
ianlin Oct 6, 2022
459cd23
Revert "Refactor find_mc_not_synced_product_ids so it'll process faster"
ianlin Oct 6, 2022
cffa97f
Revert "Group variations with same parent for not synced products of …
ianlin Oct 6, 2022
caa7228
Revert "Group variations with same parent for synced products of stat…
ianlin Oct 6, 2022
789cb42
Change the Stepper in the onboarding flow to only allow going back to…
eason9487 Oct 7, 2022
b9433e1
Add component handler to CampaignPreview and a new prop `autoplay`.
eason9487 Oct 7, 2022
3fa1872
Create a new component CampaignPreviewCard for the paid ads setup flo…
eason9487 Oct 7, 2022
759e78e
Add CampaignPreviewCard to the paid ads setup flow of post-onboarding.
eason9487 Oct 7, 2022
ad96bf5
Ignore invalid product or nonpublish product in maybe_swap_for_parent…
ianlin Oct 11, 2022
856eeee
Add a test of product gets deleted after batch gets created
ianlin Oct 11, 2022
3d64f9d
Fix typo
ianlin Oct 12, 2022
8bf3aa3
Merge pull request #1713 from woocommerce/update/1610-group-variation…
ianlin Oct 12, 2022
d484955
Merge pull request #1720 from woocommerce/fix/1684-onboarding-switch-…
ianlin Oct 12, 2022
b47ad11
Merge pull request #1717 from woocommerce/update/1033-phone-number-ve…
ianlin Oct 12, 2022
24498c8
Merge pull request #1721 from woocommerce/add/1610-post-onboarding-ad…
ianlin Oct 12, 2022
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
7 changes: 1 addition & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ const webpackResolver = {
* Ref: https://webpack.js.org/configuration/resolve/#resolveextensions
*/
extensions: [ '.js' ],
/**
* Make eslint be able to resolve the exports config of `use-debounce`.
* The `exports` config of package.json doesn't work before the current eslint support it.
* Ref: https://github.com/xnimorz/use-debounce/blob/5.2.0/package.json#L8-L14
*/
conditionNames: [ 'import', 'require' ],
},
},
};
Expand All @@ -34,6 +28,7 @@ module.exports = {
'stylelint',
'@wordpress/stylelint-config',
'@pmmmwh/react-refresh-webpack-plugin',
'react-transition-group',
],
'import/resolver': { webpack: webpackResolver },
},
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
testEnvironment: 'jsdom',
setupFiles: [ 'core-js' ],
moduleNameMapper: {
'\\.png$': '<rootDir>/tests/mocks/assets/imageMock.js',
'\\.svg$': '<rootDir>/tests/mocks/assets/svgrMock.js',
'\\.scss$': '<rootDir>/tests/mocks/assets/styleMock.js',
// Transform our `.~/` alias.
Expand Down
5 changes: 5 additions & 0 deletions js/src/components/account-card/google-ads-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions js/src/components/account-card/google-merchant-center-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 24 additions & 4 deletions js/src/components/account-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { Icon, store as storeIcon } from '@wordpress/icons';
import Section from '.~/wcdl/section';
import Subsection from '.~/wcdl/subsection';
import googleLogoURL from './gogole-g-logo.svg';
import googleMCLogoURL from './google-merchant-center-logo.svg';
import googleAdsLogoURL from './google-ads-logo.svg';
import wpLogoURL from './wp-logo.svg';
import './index.scss';

Expand Down Expand Up @@ -40,6 +42,24 @@ const googleLogo = (
/>
);

const googleMCLogo = (
<img
src={ googleMCLogoURL }
alt={ __( 'Google Merchant Center Logo', 'google-listings-and-ads' ) }
width="40"
height="40"
/>
);

const googleAdsLogo = (
<img
src={ googleAdsLogoURL }
alt={ __( 'Google Ads Logo', 'google-listings-and-ads' ) }
width="40"
height="40"
/>
);

const wpLogo = (
<img
src={ wpLogoURL }
Expand All @@ -60,18 +80,18 @@ const appearanceDict = {
title: __( 'Google', 'google-listings-and-ads' ),
},
[ APPEARANCE.GOOGLE_MERCHANT_CENTER ]: {
icon: googleLogo,
icon: googleMCLogo,
title: __( 'Google Merchant Center', 'google-listings-and-ads' ),
description: __(
'Required to sync products and list on Google Shopping',
'Required to sync products and list on Google',
'google-listings-and-ads'
),
},
[ APPEARANCE.GOOGLE_ADS ]: {
icon: googleLogo,
icon: googleAdsLogo,
title: __( 'Google Ads', 'google-listings-and-ads' ),
description: __(
'Required to create paid campaigns with your product listings',
'Connect with millions of shoppers who are searching for products like yours and drive sales with Google.',
'google-listings-and-ads'
),
},
Expand Down
1 change: 1 addition & 0 deletions js/src/components/account-card/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
&__description {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 1em;
color: $gray-900;

Expand Down
4 changes: 3 additions & 1 deletion js/src/components/app-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const AppButton = ( props ) => {
onClick( ...args );
};

const disabledButton = disabled || loading;
const classes = [ 'app-button', className ];
let text;

Expand All @@ -75,7 +76,8 @@ const AppButton = ( props ) => {
return (
<Button
className={ classnames( ...classes ) }
disabled={ disabled || loading }
disabled={ disabledButton }
aria-disabled={ disabledButton }
text={ text }
onClick={ handleClick }
{ ...rest }
Expand Down
37 changes: 19 additions & 18 deletions js/src/components/contact-information/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,24 @@ const learnMoreLinkId = 'contact-information-read-more';
const learnMoreUrl =
'https://docs.woocommerce.com/document/google-listings-and-ads/#contact-information';

const description = __(
'Your contact information is required by Google for verification purposes. It will be shared with the Google Merchant Center and will not be displayed to customers.',
'google-listings-and-ads'
const description = (
<>
<p>
{ __(
'Your contact information is required for verification by Google.',
'google-listings-and-ads'
) }
</p>
<p>
{ __(
'It would be shared with Google Merchant Center for store verification and would not be displayed to customers.',
'google-listings-and-ads'
) }
</p>
</>
);

const mcTitle = __( 'Enter contact information', 'google-listings-and-ads' );
const mcTitle = __( 'Verify contact information', 'google-listings-and-ads' );
const settingsTitle = __( 'Contact information', 'google-listings-and-ads' );

/**
Expand Down Expand Up @@ -70,24 +82,13 @@ export function ContactInformationPreview() {
* Renders a contact information section with specified initial state and texts.
*
* @param {Object} props React props.
* @param {Function} [props.onPhoneNumberVerified] Called when the phone number is verified.
* @param {Function} [props.onPhoneNumberVerified] Called when the phone number is verified or has been verified.
* @fires gla_documentation_link_click with `{ context: 'setup-mc-contact-information', link_id: 'contact-information-read-more', href: 'https://docs.woocommerce.com/document/google-listings-and-ads/#contact-information' }`
* @fires gla_documentation_link_click with `{ context: 'settings-no-phone-number-notice', link_id: 'contact-information-read-more', href: 'https://docs.woocommerce.com/document/google-listings-and-ads/#contact-information' }`
* @fires gla_documentation_link_click with `{ context: 'settings-no-store-address-notice', link_id: 'contact-information-read-more', href: 'https://docs.woocommerce.com/document/google-listings-and-ads/#contact-information' }`
*/
const ContactInformation = ( { onPhoneNumberVerified } ) => {
const phone = useGoogleMCPhoneNumber();

/**
* Since it is still lacking the phone verification state,
* all onboarding accounts are considered unverified phone numbers.
*
* TODO: replace the code at next line back to the original logic with
* `const initEditing = null;`
* after the phone verification state can be detected.
*/
const initEditing = true;

const title = mcTitle;
const trackContext = 'setup-mc-contact-information';

Expand All @@ -98,7 +99,7 @@ const ContactInformation = ( { onPhoneNumberVerified } ) => {
title={ title }
description={
<div>
<p>{ description }</p>
{ description }
<p>
<AppDocumentationLink
context={ trackContext }
Expand All @@ -115,7 +116,7 @@ const ContactInformation = ( { onPhoneNumberVerified } ) => {
<PhoneNumberCard
view="setup-mc"
phoneNumber={ phone }
initEditing={ initEditing }
initEditing={ null }
onPhoneNumberVerified={ onPhoneNumberVerified }
/>
<StoreAddressCard />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { __ } from '@wordpress/i18n';
import { APPEARANCE } from '.~/components/account-card';
import useGoogleMCPhoneNumber from '.~/hooks/useGoogleMCPhoneNumber';
import ContactInformationPreviewCard from '../contact-information-preview-card';
import './phone-number-card-preview.scss';

/**
* Triggered when phone number edit button is clicked.
Expand All @@ -35,7 +36,21 @@ export function PhoneNumberCardPreview( { editHref, learnMore } ) {

if ( loaded ) {
if ( data.isValid ) {
content = data.display;
const verificationStatus = data.isVerified ? (
<div className="gla-phone-number-card-preview__verified-status">
{ __( 'Verified', 'google-listings-and-ads' ) }
</div>
) : (
<div className="gla-phone-number-card-preview__unverified-status">
{ __( 'Unverified', 'google-listings-and-ads' ) }
</div>
);
content = (
<>
{ data.display }
{ verificationStatus }
</>
);
} else {
warning = __(
'Please add your phone number',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.gla-contact-info-preview-card {
.gla-account-card__description {
gap: $grid-unit-05;
}
}

.gla-phone-number-card-preview {
&__verified-status {
color: $alert-green;
}

&__unverified-status {
color: $alert-red;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { useState, useEffect } from '@wordpress/element';
import { useState, useEffect, useRef } from '@wordpress/element';
import { CardDivider } from '@wordpress/components';
import { Spinner } from '@woocommerce/components';

Expand Down Expand Up @@ -101,10 +101,10 @@ function EditPhoneNumberCard( { phoneNumber, onPhoneNumberVerified } ) {
* @param {boolean|null} [props.initEditing=null] Specify the inital UI state.
* `true`: initialize with the editing UI.
* `false`: initialize with the viewing UI.
* `null`: determine the initial UI state according to the `data.isValid` after the `phoneNumber` loaded.
* `null`: determine the initial UI state according to the `data.isVerified` after the `phoneNumber` loaded.
* @param {Function} [props.onEditClick] Called when clicking on "Edit" button.
* If this callback is omitted, it will enter edit mode when clicking on "Edit" button.
* @param {Function} [props.onPhoneNumberVerified] Called when the phone number is verified in edit mode.
* @param {Function} [props.onPhoneNumberVerified] Called when the phone number is verified or has been verified.
*
* @fires gla_mc_phone_number_edit_button_click
*/
Expand All @@ -117,14 +117,27 @@ const PhoneNumberCard = ( {
} ) => {
const { loaded, data } = phoneNumber;
const [ isEditing, setEditing ] = useState( initEditing );
const onPhoneNumberVerifiedRef = useRef();
onPhoneNumberVerifiedRef.current = onPhoneNumberVerified;

const { isVerified } = data;

// Handle the initial UI state of `initEditing = null`.
// The `isEditing` state is on hold. Determine it after the `phoneNumber` loaded.
useEffect( () => {
if ( loaded && isEditing === null ) {
setEditing( ! data.isValid );
setEditing( ! isVerified );
}
}, [ loaded, isVerified, isEditing ] );

// If `initEditing` is true, EditPhoneNumberCard takes care of the call of `onPhoneNumberVerified`
// after the phone number is verified. If `initEditing` is false or null, this useEffect handles
// the call of `onPhoneNumberVerified` when the loaded phone number has already been verified.
useEffect( () => {
if ( loaded && initEditing !== true && isVerified ) {
onPhoneNumberVerifiedRef.current();
}
}, [ loaded, data.isValid, isEditing ] );
}, [ loaded, isVerified, initEditing ] );

// Return a simple loading AccountCard since the initial edit state is unknown before loaded.
if ( isEditing === null ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.gla-phone-number-card {
.gla-account-card__description {
color: $gray-700;
}

// Country code selector
.wcdl-select-control {
.wcdl-select-control__input {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Notice, Flex } from '@wordpress/components';
*/
import { useAppDispatch } from '.~/data';
import useIsMounted from '.~/hooks/useIsMounted';
import useCountdown from './useCountdown';
import useCountdown from '.~/hooks/useCountdown';
import Section from '.~/wcdl/section';
import Subsection from '.~/wcdl/subsection';
import AppButton from '.~/components/app-button';
Expand Down
4 changes: 4 additions & 0 deletions js/src/components/contact-information/store-address-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
margin-left: $grid-unit-05;
}
}

.gla-account-card__description {
color: $gray-700;
}
}
3 changes: 2 additions & 1 deletion js/src/components/different-currency-notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { createInterpolateElement } from '@wordpress/element';
import useGoogleAdsAccount from '.~/hooks/useGoogleAdsAccount';
import useStoreCurrency from '.~/hooks/useStoreCurrency';
import AppDocumentationLink from '.~/components/app-documentation-link';
import { GOOGLE_ADS_ACCOUNT_STATUS } from '.~/constants';

/**
* Shows warning {@link Notice}
Expand All @@ -31,7 +32,7 @@ const DifferentCurrencyNotice = ( { context } ) => {
// Do not render if data is not available, account not connected, or the same currencies are used.
if (
! googleAdsAccount ||
googleAdsAccount.status !== 'connected' ||
googleAdsAccount.status !== GOOGLE_ADS_ACCOUNT_STATUS.CONNECTED ||
googleAdsAccount.currency === storeCurrency
) {
return null;
Expand Down
3 changes: 2 additions & 1 deletion js/src/components/faqs-panel/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.gla-faqs-panel {
.components-panel__row {
display: block;
flex-direction: column;
gap: 1.5em;
}

.components-panel__body-title {
Expand Down
Loading