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

Implement the dotlink version of Link in Bio flow on Stepper #71204

Merged
merged 15 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
Expand Up @@ -146,7 +146,8 @@ button {
* Tailored flow stylings
*/
.newsletter,
.link-in-bio:not(.domains) {
.link-in-bio:not(.domains),
.link-in-bio-tld:not(.domains) {
&:not(.launchpad):not(.subscribers) {
@include onboarding-break-mobile-landscape {
padding: 40px 0 0;
Expand All @@ -168,6 +169,7 @@ button {

.newsletter,
.link-in-bio,
.link-in-bio-tld,
.setup-form__form {
button {
&[type="submit"] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable wpcalypso/jsx-classname-namespace */

import { StepContainer } from '@automattic/onboarding';
import { StepContainer, LINK_IN_BIO_FLOW, LINK_IN_BIO_TLD_FLOW } from '@automattic/onboarding';
import { useSelect, useDispatch } from '@wordpress/data';
import { createInterpolateElement } from '@wordpress/element';
import { useI18n } from '@wordpress/react-i18n';
Expand Down Expand Up @@ -94,6 +94,10 @@ const DomainsStep: Step = function DomainsStep( { navigation, flow } ) {
showSkipButton = true;
}

if ( flow === LINK_IN_BIO_TLD_FLOW ) {
includeWordPressDotCom = false;
}

const domainsWithPlansOnly = true;
const isPlanSelectionAvailableLaterInFlow = true;

Expand Down Expand Up @@ -187,7 +191,8 @@ const DomainsStep: Step = function DomainsStep( { navigation, flow } ) {
),
decideLaterComponent
);
case 'link-in-bio':
case LINK_IN_BIO_FLOW:
case LINK_IN_BIO_TLD_FLOW:
return createInterpolateElement(
__(
'Set your Link in Bio apart with a custom domain. Not sure yet? <span>Decide later</span>.'
Expand Down Expand Up @@ -330,6 +335,24 @@ const DomainsStep: Step = function DomainsStep( { navigation, flow } ) {
);
};

const getOtherManagedSubdomains = () => {
if ( flow === LINK_IN_BIO_TLD_FLOW ) {
return [ 'link' ];
}
};

const getOtherManagedSubdomainsCountOverride = () => {
if ( flow === LINK_IN_BIO_TLD_FLOW ) {
return 2;
}
};

const getPromoTlds = () => {
if ( flow === LINK_IN_BIO_TLD_FLOW ) {
return [ 'link' ];
}
};

const renderDomainForm = () => {
let initialState: DomainForm = {};
if ( domainForm ) {
Expand Down Expand Up @@ -376,12 +399,15 @@ const DomainsStep: Step = function DomainsStep( { navigation, flow } ) {
key="domainForm"
mapDomainUrl={ getUseYourDomainUrl() }
offerUnavailableOption
otherManagedSubdomains={ getOtherManagedSubdomains() }
otherManagedSubdomainsCountOverride={ getOtherManagedSubdomainsCountOverride() }
onAddDomain={ handleAddDomain }
onAddMapping={ handleAddMapping }
onSave={ setDomainForm }
onSkip={ handleSkip }
path={ path }
products={ productsList }
promoTlds={ getPromoTlds() }
selectedSite={ selectedSite }
showExampleSuggestions={ showExampleSuggestions }
showSkipButton={ showSkipButton }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
LINK_IN_BIO_FLOW,
NEWSLETTER_FLOW,
ECOMMERCE_FLOW,
VIDEOPRESS_FLOW,
FREE_FLOW,
isLinkInBioFlow,
} from '@automattic/onboarding';
import { createInterpolateElement, useMemo } from '@wordpress/element';
import { useI18n } from '@wordpress/react-i18n';
Expand All @@ -18,7 +18,7 @@ const useIntroContent = ( flowName: string | null ): IntroContent => {
const { __ } = useI18n();

return useMemo( () => {
if ( flowName === LINK_IN_BIO_FLOW ) {
if ( isLinkInBioFlow( flowName ) ) {
return {
title: createInterpolateElement(
__( 'You’re 3 minutes away from<br />a stand-out Link in Bio site.<br />Ready? ' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@

.newsletter,
.link-in-bio:not(.domains),
.link-in-bio-tld:not(.domains),
.free {
.step-container {
.step-container__content h1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LINK_IN_BIO_FLOW, LINK_IN_BIO_TLD_FLOW } from '@automattic/onboarding';
import { LaunchpadFlowTaskList, Task } from './types';

export const tasks: Task[] = [
Expand Down Expand Up @@ -87,15 +88,18 @@ export const tasks: Task[] = [
},
];

const linkInBioTaskList = [
'design_selected',
'setup_link_in_bio',
'plan_selected',
'links_added',
'link_in_bio_launched',
];

export const launchpadFlowTasks: LaunchpadFlowTaskList = {
newsletter: [ 'setup_newsletter', 'plan_selected', 'subscribers_added', 'first_post_published' ],
'link-in-bio': [
'design_selected',
'setup_link_in_bio',
'plan_selected',
'links_added',
'link_in_bio_launched',
],
[ LINK_IN_BIO_FLOW ]: linkInBioTaskList,
[ LINK_IN_BIO_TLD_FLOW ]: linkInBioTaskList,
free: [
'setup_free',
'design_selected',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
LINK_IN_BIO_FLOW,
LINK_IN_BIO_TLD_FLOW,
NEWSLETTER_FLOW,
VIDEOPRESS_FLOW,
FREE_FLOW,
Expand All @@ -23,6 +24,7 @@ export function getLaunchpadTranslations( flow: string | null ): TranslatedLaunc
);
break;
case LINK_IN_BIO_FLOW:
case LINK_IN_BIO_TLD_FLOW:
translatedStrings.flowName = translate( 'Link in Bio' );
translatedStrings.title = translate( "You're ready to link and launch" );
translatedStrings.launchTitle = translate( "You're ready to link and launch" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

$font-family: "SF Pro Text", $sans;

.link-in-bio-setup {
.link-in-bio-setup,
.link-in-bio-tld-setup {
.step-container__content {
display: flex;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import "../style";

.link-in-bio.patterns {
.link-in-bio.patterns,
.link-in-bio-tld.patterns {
height: 100vh;

@supports ( height: 100svh ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
StepContainer,
isNewsletterOrLinkInBioFlow,
LINK_IN_BIO_FLOW,
isLinkInBioFlow,
isFreeFlow,
} from '@automattic/onboarding';
import { useSelect } from '@wordpress/data';
Expand Down Expand Up @@ -118,7 +118,7 @@ const ProcessingStep: Step = function ( props ) {
const isJetpackPowered = isNewsletterOrLinkInBioFlow( flowName );

// Currently we have the Domains and Plans only for link in bio
if ( flowName === LINK_IN_BIO_FLOW || isFreeFlow( flowName ) ) {
if ( isLinkInBioFlow( flowName ) || isFreeFlow( flowName ) ) {
return <TailoredFlowPreCheckoutScreen flowName={ flowName } />;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NEWSLETTER_FLOW, LINK_IN_BIO_FLOW } from '@automattic/onboarding';
import { NEWSLETTER_FLOW, LINK_IN_BIO_FLOW, LINK_IN_BIO_TLD_FLOW } from '@automattic/onboarding';
import { useI18n } from '@wordpress/react-i18n';
import PropTypes from 'prop-types';
import { useRef, useState, useEffect } from 'react';
Expand All @@ -15,6 +15,7 @@ const useSteps = ( flowName: string ) => {

switch ( flowName ) {
case LINK_IN_BIO_FLOW:
case LINK_IN_BIO_TLD_FLOW:
steps = [
{ title: __( 'Great choices. Nearly there!' ) },
{ title: __( 'Shining and polishing your Bio' ) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
}
.newsletter,
.link-in-bio,
.link-in-bio-tld,
.free {
.signup-header {
.signup-header__right {
Expand Down Expand Up @@ -96,7 +97,8 @@
}
}

.link-in-bio {
.link-in-bio,
.link-in-bio-tld {
.processing-step__container {
background-color: #d0cce3;
background-image:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Site } from '@automattic/data-stores';
import {
ECOMMERCE_FLOW,
LINK_IN_BIO_FLOW,
isLinkInBioFlow,
addPlanToCart,
createSiteWithCart,
} from '@automattic/onboarding';
Expand Down Expand Up @@ -33,14 +33,14 @@ const SiteCreationStep: Step = function SiteCreationStep( { navigation, flow } )

const { setPendingAction } = useDispatch( ONBOARD_STORE );

const theme = flow === LINK_IN_BIO_FLOW ? 'pub/lynx' : 'pub/lettre';
const theme = isLinkInBioFlow( flow ) ? 'pub/lynx' : 'pub/lettre';
const isPaidDomainItem = Boolean( domainCartItem?.product_slug );

// Default visibility is public
let siteVisibility = Site.Visibility.PublicIndexed;

// Link-in-bio flow defaults to "Coming Soon"
if ( flow === LINK_IN_BIO_FLOW ) {
if ( isLinkInBioFlow( flow ) ) {
siteVisibility = Site.Visibility.PublicNotIndexed;
}

Expand Down
Loading