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

Feature: Streamline the onboarding flow #2631

Open
wants to merge 84 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
64f51bf
Hides jetpack during onboarding if already connected
dsawardekar Aug 9, 2024
88e0799
Limits jetpack check to only the WPComAccount card
dsawardekar Aug 12, 2024
ad40c2c
Adds e2e tests for jetpack connected & disconnected states
dsawardekar Aug 12, 2024
e2f2420
Refactors variable names in setup flow
dsawardekar Aug 13, 2024
6172e58
Removes language section from onboarding flow
dsawardekar Aug 13, 2024
088fc95
Updates e2e tests for language secton
dsawardekar Aug 13, 2024
f1d84f6
Update e2e tests
joemcgill Aug 13, 2024
7523a05
Fixes linter warnings
dsawardekar Aug 14, 2024
9e606c1
Merge pull request #2521 from woocommerce/update/2487-hide-jetpack-e2…
dsawardekar Aug 14, 2024
5bfa90b
Fixes linter warnings
dsawardekar Aug 14, 2024
2912ea4
Move FAQ after the CTA on the setup page.
asvinb Aug 15, 2024
65ba775
Move FAQ after CTA in Ads Campaign component.
asvinb Aug 15, 2024
c00448f
Move FAQs after CTA un SetupPaidAds component.
asvinb Aug 15, 2024
2e0a2db
Add StepContentActions component.
asvinb Aug 15, 2024
bad8197
Use StepContentFooterActions component.
asvinb Aug 15, 2024
f4b9a79
Temporarily rename StepContentActions to TmpStepContentActions.
asvinb Aug 15, 2024
e76eb34
Rename StepContentFooter to StepContentActions.
asvinb Aug 15, 2024
e0fcb70
Bring back StepContentFooter.
asvinb Aug 15, 2024
cd992e6
Fix linting issue.
asvinb Aug 15, 2024
0bbb53a
Remove tmp from class name.
asvinb Aug 16, 2024
3d82e7b
Fix typo.
asvinb Aug 16, 2024
0c80d4d
Remove prelaunch checklist component.
asvinb Aug 16, 2024
035bb2a
Fix typo in test.
asvinb Aug 16, 2024
750f600
Add tests for Continue button.
asvinb Aug 16, 2024
223935e
Updates e2e tests per PR feedack & removes unused code
dsawardekar Aug 19, 2024
49c685e
setting default
kt-12 Aug 19, 2024
7ccf37f
Hide Tax UI during onboarding & keep in edit campaign
dsawardekar Aug 19, 2024
7550060
Merge branch 'develop' into tweak/default-tax-2491
kt-12 Aug 19, 2024
bc232cb
unit test for tax_rate
kt-12 Aug 19, 2024
aa88b50
fix function name
kt-12 Aug 19, 2024
3e72d8e
Fix unit test
kt-12 Aug 19, 2024
ecd25fc
Updates e2e tests per CR feedback
dsawardekar Aug 19, 2024
4a3d08e
define options variable
kt-12 Aug 19, 2024
e0cc337
add unit test for post method
kt-12 Aug 19, 2024
0620121
remove unwanted imports
kt-12 Aug 19, 2024
d6f5658
update package name
kt-12 Aug 19, 2024
0a1f579
Wrap all in components
joemcgill Aug 19, 2024
562e301
Fix file name for AssetGroupFaqsPanel
joemcgill Aug 19, 2024
1f41efc
Fix file paths
joemcgill Aug 19, 2024
f3d0847
Removes tax rate related e2e tests since no onboarding UI
dsawardekar Aug 20, 2024
87d46c2
Fixes linter warnings
dsawardekar Aug 20, 2024
98aa6f0
Fixes linter warnings
dsawardekar Aug 20, 2024
d8d0ba9
Removes unused code in e2e tests
dsawardekar Aug 20, 2024
7acafdf
Removes extra line break
dsawardekar Aug 20, 2024
57ecc5d
Merge branch 'tweak/default-tax-2491' into update/2490-hide-tax-rate-…
dsawardekar Aug 20, 2024
2a24962
Merge branch 'develop' into feature/2492-remove-pre-launch-checklist
asvinb Aug 20, 2024
28a87a9
Remove disabled button.
asvinb Aug 20, 2024
e4dbeb9
Remove policy check request.
asvinb Aug 20, 2024
32bbb30
Remove policy requests.
asvinb Aug 20, 2024
8ccaf0e
Removes unused styles per CR feedback
dsawardekar Aug 21, 2024
33146ac
Removes documentation link per CR feedback
dsawardekar Aug 21, 2024
5964f66
Removes unused code per CR feedback
dsawardekar Aug 21, 2024
766e351
Update tracking README.
eason9487 Aug 22, 2024
d09c5eb
remove pre-launch attributes from api
kt-12 Aug 22, 2024
7c4c65e
remove `checked_pre_launch_checklist()` and it's reference
kt-12 Aug 22, 2024
c89bff3
remove the function
kt-12 Aug 22, 2024
dac0fce
unit testing changes
kt-12 Aug 22, 2024
7b29364
fix linting issue
kt-12 Aug 22, 2024
0bb6163
Merge pull request #2516 from woocommerce/update/2487-hide-jetpack-if…
joemcgill Aug 22, 2024
c4bbdf0
Merge pull request #2543 from woocommerce/tweak/default-tax-2491
joemcgill Aug 22, 2024
bfe429d
Merge pull request #2522 from woocommerce/update/2489-hide-language-s…
joemcgill Aug 22, 2024
9cd398f
Hide default prop per CR feedback
dsawardekar Aug 23, 2024
a4abb29
Update error checking to ignore if hideTaxRates is true
dsawardekar Aug 23, 2024
c2c3242
Mock default MC settings with tax_rate set
joemcgill Aug 26, 2024
4870093
Remove unused e2e test helpers
joemcgill Aug 26, 2024
9be454c
Use a fixed SKU number when creating an adapted product
mikkamp Aug 22, 2024
dd73ec6
Test for fixed SKU number
mikkamp Aug 22, 2024
513c6b9
Move FAQ panel within the footer.
asvinb Aug 29, 2024
be5fbdb
Remove unused code.
asvinb Aug 29, 2024
8096fe1
Add assertions for contact info.
asvinb Aug 29, 2024
1030b8d
Merge pull request #2531 from woocommerce/feature/2488-move-faq
joemcgill Sep 1, 2024
c21b1b5
Merge branch 'feature/2458-streamline-onboarding' into feature/2492-r…
asvinb Sep 2, 2024
d78738a
Remove unused code from pre launch checklist.
asvinb Sep 4, 2024
c5c547a
check method for exactly 3 get calls and remove redundant 4th step.
kt-12 Sep 4, 2024
debc575
Merge branch 'update/2490-hide-tax-rate-selection-ui-onboarding' of g…
dsawardekar Sep 5, 2024
630c73d
Removes unused function
dsawardekar Sep 5, 2024
3e4910f
Updates props per CR feedback
dsawardekar Sep 5, 2024
40bbf82
Merge pull request #2555 from woocommerce/feature/2494-remove-pre-lau…
joemcgill Sep 5, 2024
f39cf03
Merge pull request #2532 from woocommerce/feature/2492-remove-pre-lau…
joemcgill Sep 6, 2024
ed9c887
Merge branch 'develop' into feature/2458-streamline-onboarding
eason9487 Sep 6, 2024
5db0bad
Updates jsdoc
dsawardekar Sep 11, 2024
bd39f03
Merge branch 'feature/2458-streamline-onboarding' into update/2490-hi…
dsawardekar Sep 11, 2024
8eb1fff
Merge pull request #2542 from woocommerce/update/2490-hide-tax-rate-s…
joemcgill Sep 16, 2024
a2a1e84
Merge branch 'develop' into feature/2458-streamline-onboarding
joemcgill Sep 30, 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
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
/**
* External dependencies
*/
import { RadioControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { createInterpolateElement } from '@wordpress/element';

/**
* Internal dependencies
*/
import { useAdaptiveFormContext } from '.~/components/adaptive-form';
import AppRadioContentControl from '.~/components/app-radio-content-control';
import AppDocumentationLink from '.~/components/app-documentation-link';
import Section from '.~/wcdl/section';
import Subsection from '.~/wcdl/subsection';
import RadioHelperText from '.~/wcdl/radio-helper-text';
Expand All @@ -23,16 +20,12 @@ import './choose-audience-section.scss';
*
* To be used in onboarding and further editing.
* Does not provide any save strategy, this is to be bound externaly.
*
* @fires gla_documentation_link_click with `{ context: 'setup-mc-audience', link_id: 'site-language', href: 'https://support.google.com/merchants/answer/160637' }`
*/
const ChooseAudienceSection = () => {
const {
values,
getInputProps,
adapter: { renderRequestedValidation },
} = useAdaptiveFormContext();
const { locale, language } = values;

return (
<>
Expand All @@ -50,37 +43,6 @@ const ChooseAudienceSection = () => {
>
<Section.Card>
<Section.Card.Body>
<Subsection>
<Subsection.Title>
{ __( 'Language', 'google-listings-and-ads' ) }
</Subsection.Title>
<Subsection.HelperText className="gla-choose-audience-section__language-helper">
{ createInterpolateElement(
__(
'Listings can only be displayed in your site language. <link>Read more</link>',
'google-listings-and-ads'
),
{
link: (
<AppDocumentationLink
context="setup-mc-audience"
linkId="site-language"
href="https://support.google.com/merchants/answer/160637"
/>
),
}
) }
</Subsection.HelperText>
<RadioControl
selected={ locale }
options={ [
{
label: language,
value: locale,
},
] }
/>
</Subsection>
<Subsection>
<Subsection.Title>
{ __( 'Location', 'google-listings-and-ads' ) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.gla-choose-audience-section {
&__language-helper,
.wcdl-radio-helper-text {
font-style: normal;
color: $gray-700;
}

.wcdl-subsection-helper-text {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const checkErrors = (
values,
shippingTimes,
finalCountryCodes,
storeCountryCode
storeCountryCode,
hideTaxRates = false
) => {
const errors = {};

Expand Down Expand Up @@ -110,6 +111,7 @@ const checkErrors = (
* Check tax rate (required for U.S. only).
*/
if (
! hideTaxRates &&
( storeCountryCode === 'US' || finalCountryCodes.includes( 'US' ) ) &&
! validTaxRateSet.has( values.tax_rate )
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
import { useAdaptiveFormContext } from '.~/components/adaptive-form';
import StepContent from '.~/components/stepper/step-content';
import StepContentActions from '.~/components/stepper/step-content-actions';
import StepContentFooter from '.~/components/stepper/step-content-footer';
import TaxRate from '.~/components/free-listings/configure-product-listings/tax-rate';
import useDisplayTaxRate from '.~/components/free-listings/configure-product-listings/useDisplayTaxRate';
Expand All @@ -22,13 +23,16 @@
*
* @param {Object} props React props.
* @param {string} [props.submitLabel="Complete setup"] Submit button label.
* @param {boolean} [props.hideTaxRates] Whether to hide tax rate section.
*/
const FormContent = ( {
submitLabel = __( 'Complete setup', 'google-listings-and-ads' ),
hideTaxRates,
} ) => {
const { values, isValidForm, handleSubmit, adapter } =
useAdaptiveFormContext();
const shouldDisplayTaxRate = useDisplayTaxRate( adapter.audienceCountries );
const displayTaxRate = useDisplayTaxRate( adapter.audienceCountries );

Check warning on line 34 in js/src/components/free-listings/setup-free-listings/form-content.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/free-listings/setup-free-listings/form-content.js#L34

Added line #L34 was not covered by tests
const shouldDisplayTaxRate = ! hideTaxRates && displayTaxRate;
const shouldDisplayShippingTime = values.shipping_time === 'flat';

const handleSubmitClick = ( event ) => {
Expand All @@ -48,13 +52,15 @@
<TaxRate />
</ConditionalSection>
<StepContentFooter>
<AppButton
isPrimary
loading={ adapter.isSubmitting }
onClick={ handleSubmitClick }
>
{ submitLabel }
</AppButton>
<StepContentActions>
<AppButton
isPrimary
loading={ adapter.isSubmitting }
onClick={ handleSubmitClick }
>
{ submitLabel }
</AppButton>
</StepContentActions>
</StepContentFooter>
</StepContent>
);
Expand Down
26 changes: 9 additions & 17 deletions js/src/components/free-listings/setup-free-listings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,7 @@
*
* If we are adding a new settings field, it should be added into this array.
*/
const settingsFieldNames = [
'shipping_rate',
'shipping_time',
'tax_rate',
'website_live',
'checkout_process_secure',
'payment_methods_visible',
'refund_tos_visible',
'contact_info_visible',
];
const settingsFieldNames = [ 'shipping_rate', 'shipping_time', 'tax_rate' ];

/**
* Get settings object from Form values.
Expand Down Expand Up @@ -78,6 +69,7 @@
* @param {() => void} [props.onContinue] Callback called once continue button is clicked. Could be async. While it's being resolved the form would turn into a saving state.
* @param {string} [props.submitLabel] Submit button label, to be forwarded to `FormContent`.
* @param {JSX.Element} props.headerTitle Title in the header block of this setup.
* @param {boolean} [props.hideTaxRates=false] Whether to hide tax rate section, to be forwarded to `FormContent`.
*/
const SetupFreeListings = ( {
targetAudience,
Expand All @@ -92,6 +84,7 @@
onContinue = noop,
submitLabel,
headerTitle,
hideTaxRates = false,

Check warning on line 87 in js/src/components/free-listings/setup-free-listings/index.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/free-listings/setup-free-listings/index.js#L87

Added line #L87 was not covered by tests
} ) => {
const formRef = useRef();
const { code: storeCountryCode } = useStoreCountry();
Expand All @@ -108,7 +101,8 @@
values,
shippingTimesData,
countries,
storeCountryCode
storeCountryCode,
hideTaxRates
);
};

Expand Down Expand Up @@ -215,11 +209,6 @@
shipping_rate: settings.shipping_rate,
shipping_time: settings.shipping_time,
tax_rate: settings.tax_rate,
website_live: settings.website_live,
checkout_process_secure: settings.checkout_process_secure,
payment_methods_visible: settings.payment_methods_visible,
refund_tos_visible: settings.refund_tos_visible,
contact_info_visible: settings.contact_info_visible,
// This is used in UI only, not used in API.
offer_free_shipping:
getOfferFreeShippingInitialValue( shippingRates ),
Expand All @@ -232,7 +221,10 @@
validate={ handleValidate }
onSubmit={ onContinue }
>
<FormContent submitLabel={ submitLabel } />
<FormContent
submitLabel={ submitLabel }
hideTaxRates={ hideTaxRates }
/>
</AdaptiveForm>
</div>
);
Expand Down
22 changes: 13 additions & 9 deletions js/src/components/paid-ads/ads-campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import { createInterpolateElement } from '@wordpress/element';
import StepContent from '.~/components/stepper/step-content';
import StepContentHeader from '.~/components/stepper/step-content-header';
import StepContentFooter from '.~/components/stepper/step-content-footer';
import StepContentActions from '.~/components/stepper/step-content-actions';
import AppDocumentationLink from '.~/components/app-documentation-link';
import AppButton from '.~/components/app-button';
import { useAdaptiveFormContext } from '.~/components/adaptive-form';
import AudienceSection from './audience-section';
import BudgetSection from './budget-section';
import { CampaignPreviewCard } from './campaign-preview';
import FaqsSection from './faqs-section';
import PaidAdsFaqsPanel from './faqs-panel';

/**
* @typedef {import('.~/data/actions').Campaign} Campaign
Expand Down Expand Up @@ -97,15 +98,18 @@ export default function AdsCampaign( {
>
<CampaignPreviewCard />
</BudgetSection>
<FaqsSection />

<StepContentFooter>
<AppButton
isPrimary
disabled={ ! isValidForm }
onClick={ onContinue }
>
{ __( 'Continue', 'google-listings-and-ads' ) }
</AppButton>
<StepContentActions>
<AppButton
isPrimary
disabled={ ! isValidForm }
onClick={ onContinue }
>
{ __( 'Continue', 'google-listings-and-ads' ) }
</AppButton>
</StepContentActions>
<PaidAdsFaqsPanel />
</StepContentFooter>
</StepContent>
);
Expand Down
80 changes: 45 additions & 35 deletions js/src/components/paid-ads/asset-group/asset-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
import StepContent from '.~/components/stepper/step-content';
import StepContentHeader from '.~/components/stepper/step-content-header';
import StepContentFooter from '.~/components/stepper/step-content-footer';
import StepContentActions from '.~/components/stepper/step-content-actions';
import AppButton from '.~/components/app-button';
import AssetGroupFaqsPanel from './faqs-panel';
import AssetGroupSection from './asset-group-section';
import FaqsSection from './faqs-section';
import { recordGlaEvent } from '.~/utils/tracks';

export const ACTION_SUBMIT_CAMPAIGN_AND_ASSETS = 'submit-campaign-and-assets';
Expand Down Expand Up @@ -114,50 +115,59 @@
) }
/>
<AssetGroupSection />
<FaqsSection />

<StepContentFooter>
{ ( isCreation || adapter.isEmptyAssetEntityGroup ) && (
// Currently, the PMax Assets feature in this extension doesn't offer the function
// to delete the asset entity group, so it needs to hide the skip button if the editing
// asset group is not considered empty.
<StepContentActions>
{ ( isCreation || adapter.isEmptyAssetEntityGroup ) && (

Check warning on line 121 in js/src/components/paid-ads/asset-group/asset-group.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/asset-group.js#L121

Added line #L121 was not covered by tests
// Currently, the PMax Assets feature in this extension doesn't offer the function
// to delete the asset entity group, so it needs to hide the skip button if the editing
// asset group is not considered empty.
<AppButton

Check warning on line 125 in js/src/components/paid-ads/asset-group/asset-group.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/asset-group.js#L125

Added line #L125 was not covered by tests
isTertiary
data-action={ ACTION_SUBMIT_CAMPAIGN_ONLY }
disabled={
! isValidForm ||
isSubmitted ||
currentAction ===

Check warning on line 131 in js/src/components/paid-ads/asset-group/asset-group.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/asset-group.js#L129-L131

Added lines #L129 - L131 were not covered by tests
ACTION_SUBMIT_CAMPAIGN_AND_ASSETS
}
loading={
isSubmitting &&
currentAction === ACTION_SUBMIT_CAMPAIGN_ONLY

Check warning on line 136 in js/src/components/paid-ads/asset-group/asset-group.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/asset-group.js#L135-L136

Added lines #L135 - L136 were not covered by tests
}
onClick={ handleSkipClick }
>
{ __(
'Skip this step',
'google-listings-and-ads'
) }
</AppButton>
) }
<AppButton
isTertiary
data-action={ ACTION_SUBMIT_CAMPAIGN_ONLY }
isPrimary
data-action={ ACTION_SUBMIT_CAMPAIGN_AND_ASSETS }
disabled={
! isValidForm ||
! adapter.baseAssetGroup[

Check warning on line 150 in js/src/components/paid-ads/asset-group/asset-group.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/asset-group.js#L150

Added line #L150 was not covered by tests
ASSET_FORM_KEY.FINAL_URL
] ||
isSubmitted ||
currentAction === ACTION_SUBMIT_CAMPAIGN_AND_ASSETS
currentAction === ACTION_SUBMIT_CAMPAIGN_ONLY

Check warning on line 154 in js/src/components/paid-ads/asset-group/asset-group.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/asset-group.js#L154

Added line #L154 was not covered by tests
}
loading={
isSubmitting &&
currentAction === ACTION_SUBMIT_CAMPAIGN_ONLY
currentAction === ACTION_SUBMIT_CAMPAIGN_AND_ASSETS

Check warning on line 158 in js/src/components/paid-ads/asset-group/asset-group.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/asset-group.js#L158

Added line #L158 was not covered by tests
}
onClick={ handleSkipClick }
onClick={ handleLaunchClick }
>
{ __( 'Skip this step', 'google-listings-and-ads' ) }
{ isCreation
? __(

Check warning on line 163 in js/src/components/paid-ads/asset-group/asset-group.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/asset-group.js#L163

Added line #L163 was not covered by tests
'Launch paid campaign',
'google-listings-and-ads'
)
: __( 'Save changes', 'google-listings-and-ads' ) }

Check warning on line 167 in js/src/components/paid-ads/asset-group/asset-group.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/asset-group.js#L167

Added line #L167 was not covered by tests
</AppButton>
) }
<AppButton
isPrimary
data-action={ ACTION_SUBMIT_CAMPAIGN_AND_ASSETS }
disabled={
! adapter.baseAssetGroup[ ASSET_FORM_KEY.FINAL_URL ] ||
isSubmitted ||
currentAction === ACTION_SUBMIT_CAMPAIGN_ONLY
}
loading={
isSubmitting &&
currentAction === ACTION_SUBMIT_CAMPAIGN_AND_ASSETS
}
onClick={ handleLaunchClick }
>
{ isCreation
? __(
'Launch paid campaign',
'google-listings-and-ads'
)
: __( 'Save changes', 'google-listings-and-ads' ) }
</AppButton>
</StepContentActions>
<AssetGroupFaqsPanel />
</StepContentFooter>
</StepContent>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/**
* Internal dependencies
*/
import Section from '.~/wcdl/section';
import FaqsPanel from '.~/components/faqs-panel';
import AppDocumentationLink from '.~/components/app-documentation-link';

Expand Down Expand Up @@ -70,12 +69,8 @@
* @fires gla_faq with `{ context: 'campaign-management', id: 'what-makes-these-ads-different-from-product-ads', action: 'expand' | 'collapse' }`.
* @fires gla_documentation_link_click with `{ context: 'assets-faq', linkId: 'assets-faq-about-ad-formats-available-in-different-campaign-types', href: 'https://support.google.com/google-ads/answer/1722124' }`.
*/
const FaqsSection = () => {
return (
<Section>
<FaqsPanel context="campaign-management" faqItems={ faqItems } />
</Section>
);
const AssetGroupFaqsPanel = () => {
return <FaqsPanel context="campaign-management" faqItems={ faqItems } />;

Check warning on line 73 in js/src/components/paid-ads/asset-group/faqs-panel.js

View check run for this annotation

Codecov / codecov/patch

js/src/components/paid-ads/asset-group/faqs-panel.js#L73

Added line #L73 was not covered by tests
};

export default FaqsSection;
export default AssetGroupFaqsPanel;
Loading
Loading