Skip to content

Commit

Permalink
IOnitial cleanup + todo notes
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Feb 10, 2025
1 parent 1c01a55 commit be15721
Show file tree
Hide file tree
Showing 16 changed files with 109 additions and 156 deletions.
36 changes: 8 additions & 28 deletions client/blocks/login/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class Login extends Component {
isLinking: PropTypes.bool,
isJetpack: PropTypes.bool.isRequired,
isWhiteLogin: PropTypes.bool.isRequired,
isJetpackWooCommerceFlow: PropTypes.bool.isRequired,
isFromAkismet: PropTypes.bool,
isFromMigrationPlugin: PropTypes.bool,
isFromAutomatticForAgenciesPlugin: PropTypes.bool,
Expand Down Expand Up @@ -115,7 +114,6 @@ class Login extends Component {
static defaultProps = {
isJetpack: false,
isWhiteLogin: false,
isJetpackWooCommerceFlow: false,
};

componentDidMount() {
Expand Down Expand Up @@ -191,7 +189,6 @@ class Login extends Component {
showContinueAsUser = () => {
const {
isJetpack,
isJetpackWooCommerceFlow,
oauth2Client,
privateSite,
socialConnect,
Expand All @@ -210,7 +207,8 @@ class Login extends Component {
! privateSite &&
// Show the continue as user flow WooCommerce and Blaze Pro but not for other OAuth2 clients
! ( oauth2Client && ! isWCCOM && ! isBlazePro ) &&
! isJetpackWooCommerceFlow &&
// Note: do we need to replace with other flows?
// ! isJetpackWooCommerceFlow &&
! isJetpack &&
! fromSite &&
! twoFactorEnabled &&
Expand Down Expand Up @@ -352,7 +350,6 @@ class Login extends Component {
isGravPoweredClient,
isGravPoweredLoginPage,
isJetpack,
isJetpackWooCommerceFlow,
isManualRenewalImmediateLoginAttempt,
isP2Login,
isSignupExistingAccount,
Expand Down Expand Up @@ -617,26 +614,6 @@ class Login extends Component {
}
preHeader = null;
postHeader = <p className="login__header-subtitle">{ subtitle }</p>;
} else if ( isJetpackWooCommerceFlow ) {
headerText = translate( 'Log in to your WordPress.com account' );
preHeader = (
<div className="login__jetpack-logo">
<AsyncLoad
require="calypso/components/jetpack-header"
placeholder={ null }
partnerSlug={ this.props.partnerSlug }
isWooOnboarding
width={ 200 }
/>
</div>
);
postHeader = (
<p className="login__header-subtitle">
{ translate(
'Your account will enable you to start using the features and benefits offered by Jetpack & WooCommerce Services.'
) }
</p>
);
} else if ( isFromMigrationPlugin ) {
headerText = translate( 'Log in to your account' );
} else if ( isJetpack ) {
Expand Down Expand Up @@ -1059,9 +1036,12 @@ export default connect(
'automattic-for-agencies-client' ===
new URLSearchParams( getRedirectToOriginal( state )?.split( '?' )[ 1 ] ).get( 'from' ),
isJetpackWooDnaFlow: wooDnaConfig( getCurrentQueryArguments( state ) ).isWooDnaFlow(),
isJetpackWooCommerceFlow:
'woocommerce-onboarding' === get( getCurrentQueryArguments( state ), 'from' ),
isWooJPC: isWooJPCFlow( state ),
isWooJPC:
// The legacy "Jetpack WooCommerce" flow is deprecated and absorbed
// into the Woo JPC flow
// TODO: move to isWooJPCFlow check
'woocommerce-onboarding' === get( getCurrentQueryArguments( state ), 'from' ) ||
isWooJPCFlow( state ),
isWCCOM: getIsWCCOM( state ),
isWoo: getIsWoo( state ),
wccomFrom: getWccomFrom( state ),
Expand Down
34 changes: 19 additions & 15 deletions client/blocks/login/login-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,14 @@ export class LoginForm extends Component {
};

recordWooCommerceLoginTracks( method ) {
const { isJetpackWooCommerceFlow, isWoo, wccomFrom } = this.props;
if ( isJetpackWooCommerceFlow ) {
this.props.recordTracksEvent( 'wcadmin_storeprofiler_login_jetpack_account', {
login_method: method,
} );
} else if ( isWoo && 'cart' === wccomFrom ) {
const { isWoo, wccomFrom } = this.props;
// Note: replace with other flow, or delete?
// if ( isJetpackWooCommerceFlow ) {
// this.props.recordTracksEvent( 'wcadmin_storeprofiler_login_jetpack_account', {
// login_method: method,
// } );
// } else
if ( isWoo && 'cart' === wccomFrom ) {
this.props.recordTracksEvent( 'wcadmin_storeprofiler_payment_login', {
login_method: method,
} );
Expand Down Expand Up @@ -648,6 +650,7 @@ export class LoginForm extends Component {
! canDoMagicLogin(
this.props.twoFactorAuthType,
this.props.oauth2Client,
// TODO: replace with other flow, or delete?
this.props.isJetpackWooCommerceFlow
)
) {
Expand All @@ -670,8 +673,9 @@ export class LoginForm extends Component {
if (
! canDoMagicLogin(
this.props.twoFactorAuthType,
this.props.oauth2Client,
this.props.isJetpackWooCommerceFlow
this.props.oauth2Client
// TODO: replace with other flow, or delete?
// this.props.isJetpackWooCommerceFlow
)
) {
return null;
Expand Down Expand Up @@ -792,7 +796,6 @@ export class LoginForm extends Component {
oauth2Client,
requestError,
socialAccountIsLinking: linkingSocialUser,
isJetpackWooCommerceFlow,
isP2Login,
isJetpack,
isJetpackWooDnaFlow,
Expand Down Expand Up @@ -878,9 +881,10 @@ export class LoginForm extends Component {
) : null;
}

if ( isJetpackWooCommerceFlow ) {
return this.renderWooCommerce( { socialToS } );
}
// TODO: replace with other flow, or delete?
// if ( isJetpackWooCommerceFlow ) {
// return this.renderWooCommerce( { socialToS } );
// }

if ( isJetpackWooDnaFlow ) {
return this.renderWooCommerce( {
Expand Down Expand Up @@ -1176,10 +1180,10 @@ export default connect(
oauth2Client: getCurrentOAuth2Client( state ),
isFromAutomatticForAgenciesPlugin:
'automattic-for-agencies-client' === get( getCurrentQueryArguments( state ), 'from' ),
isJetpackWooCommerceFlow:
'woocommerce-onboarding' === get( getCurrentQueryArguments( state ), 'from' ),
isJetpackWooDnaFlow: wooDnaConfig( getCurrentQueryArguments( state ) ).isWooDnaFlow(),
isWooJPC: isWooJPCFlow( state ),
isWooJPC:
'woocommerce-onboarding' === get( getCurrentQueryArguments( state ), 'from' ) ||
isWooJPCFlow( state ),
isWoo: getIsWoo( state ),
redirectTo: getRedirectToOriginal( state ),
requestError: getRequestError( state ),
Expand Down
27 changes: 17 additions & 10 deletions client/blocks/signup-form/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -765,12 +765,14 @@ class SignupForm extends Component {
}

recordWooCommerceSignupTracks( method ) {
const { isJetpackWooCommerceFlow, isWoo, wccomFrom } = this.props;
if ( isJetpackWooCommerceFlow ) {
recordTracksEvent( 'wcadmin_storeprofiler_create_jetpack_account', {
signup_method: method,
} );
} else if ( isWoo && 'cart' === wccomFrom ) {
const { isWoo, wccomFrom } = this.props;
// TODO: replace with other flow, or delete?
// if ( isJetpackWooCommerceFlow ) {
// recordTracksEvent( 'wcadmin_storeprofiler_create_jetpack_account', {
// signup_method: method,
// } );
// } else
if ( isWoo && 'cart' === wccomFrom ) {
recordTracksEvent( 'wcadmin_storeprofiler_payment_create_account', {
signup_method: method,
} );
Expand Down Expand Up @@ -1191,7 +1193,9 @@ class SignupForm extends Component {
);
}

if ( this.props.isJetpackWooCommerceFlow || this.props.isJetpackWooDnaFlow ) {
// TODO: is it ok to merge it with JPC flow? Should we replace the check
// with the JPC flow, or simply remove it from the check?
if ( /* this.props.isJetpackWooCommerceFlow || */ this.props.isJetpackWooDnaFlow ) {
return (
<div className={ clsx( 'signup-form__woocommerce', this.props.className ) }>
<LoggedOutForm onSubmit={ this.handleWooCommerceSubmit } noValidate>
Expand Down Expand Up @@ -1380,14 +1384,17 @@ class SignupForm extends Component {
export default connect(
( state, props ) => {
const oauth2Client = getCurrentOAuth2Client( state );
const isWooJPC = isWooJPCFlow( state );
const isWooJPC =
// TODO:
// - is it ok to merge legacy flow with JPC, or should we merge it with DNA?
// - move check directly to isWooJPCFlow
'woocommerce-onboarding' === get( getCurrentQueryArguments( state ), 'from' ) ||
isWooJPCFlow( state );

return {
currentUser: getCurrentUser( state ),
oauth2Client,
sectionName: getSectionName( state ),
isJetpackWooCommerceFlow:
'woocommerce-onboarding' === get( getCurrentQueryArguments( state ), 'from' ),
isJetpackWooDnaFlow: wooDnaConfig( getCurrentQueryArguments( state ) ).isWooDnaFlow(),
from: get( getCurrentQueryArguments( state ), 'from' ),
wccomFrom: getWccomFrom( state ),
Expand Down
21 changes: 0 additions & 21 deletions client/components/jetpack-header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class JetpackHeader extends PureComponent {
darkColorScheme: PropTypes.bool,
partnerSlug: PropTypes.string,
isFromAutomatticForAgenciesPlugin: PropTypes.bool,
isWooOnboarding: PropTypes.bool,
isWooJPC: PropTypes.bool,
isWooDna: PropTypes.bool,
width: PropTypes.number,
Expand All @@ -26,7 +25,6 @@ export class JetpackHeader extends PureComponent {
partnerSlug,
width,
isFromAutomatticForAgenciesPlugin,
isWooOnboarding,
isWooJPC,
isWooDna,
translate,
Expand All @@ -36,25 +34,6 @@ export class JetpackHeader extends PureComponent {
return null;
}

if ( isWooOnboarding ) {
// @todo Implement WooCommerce + partner co-branding in the future.
return (
<JetpackPartnerLogoGroup
width={ width || 662.5 }
viewBox="0 0 1270 170"
partnerName="WooCommerce"
>
<g transform="translate(360 25)">
<AsyncLoad
require="calypso/components/jetpack-header/woocommerce"
darkColorScheme={ darkColorScheme }
placeholder={ null }
/>
</g>
</JetpackPartnerLogoGroup>
);
}

if ( isWooDna ) {
return (
<svg width={ width } viewBox="0 0 1270 170">
Expand Down
11 changes: 5 additions & 6 deletions client/components/social-buttons/qr-code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ type QrCodeLoginButtonProps = {
const QrCodeLoginButton = ( { loginUrl }: QrCodeLoginButtonProps ) => {
const dispatch = useDispatch();
const translate = useTranslate();
const { isDisabled, isJetpackWooCommerceFlow, oauth2Client, isWoo } = useSelector( ( select ) => {
const { isDisabled, oauth2Client, isWoo } = useSelector( ( select ) => {
return {
isJetpackWooCommerceFlow:
'woocommerce-onboarding' === getCurrentQueryArguments( select )?.from,
oauth2Client: getCurrentOAuth2Client( select ) as { id: string },
locale: getCurrentLocaleSlug( select ),
isWoo: getIsWoo( select ),
Expand All @@ -35,9 +33,10 @@ const QrCodeLoginButton = ( { loginUrl }: QrCodeLoginButtonProps ) => {
return null;
}

if ( isJetpackWooCommerceFlow ) {
return null;
}
// TODO: replace with another flow, or just delete?
// if ( isJetpackWooCommerceFlow ) {
// return null;
// }

const handleClick = () => {
recordTracksEvent( 'calypso_login_magic_login_request_click', {
Expand Down
7 changes: 3 additions & 4 deletions client/document/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ class Document extends Component {
? `var localeFromRoute = ${ jsonStringifyForHtml( params.lang ?? '' ) };\n`
: '' );

const isJetpackWooCommerceFlow =
'jetpack-connect' === sectionName && 'woocommerce-onboarding' === requestFrom;

const isJetpackWooDnaFlow = 'jetpack-connect' === sectionName && isWooDna;

const theme = config( 'theme' );
Expand Down Expand Up @@ -177,7 +174,9 @@ class Document extends Component {
className={ clsx( 'layout', {
[ 'is-group-' + sectionGroup ]: sectionGroup,
[ 'is-section-' + sectionName ]: sectionName,
'is-jetpack-woocommerce-flow': isJetpackWooCommerceFlow,
// TODO: clean up classname in styles too
// Should we replace it with another flow, or can we just delete?
// 'is-jetpack-woocommerce-flow': isJetpackWooCommerceFlow,
'is-jetpack-woo-dna-flow': isJetpackWooDnaFlow,
} ) }
>
Expand Down
23 changes: 0 additions & 23 deletions client/jetpack-connect/auth-form-header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { authQueryPropTypes } from './utils';
export class AuthFormHeader extends Component {
static propTypes = {
authQuery: authQueryPropTypes.isRequired,
isWooOnboarding: PropTypes.bool,
isWooJPC: PropTypes.bool,
isWpcomMigration: PropTypes.bool,
wooDnaConfig: PropTypes.object,
Expand Down Expand Up @@ -57,7 +56,6 @@ export class AuthFormHeader extends Component {
const {
translate,
partnerSlug,
isWooOnboarding,
isWooJPC,
wooDnaConfig,
isWpcomMigration,
Expand Down Expand Up @@ -96,15 +94,6 @@ export class AuthFormHeader extends Component {

const currentState = this.getState();

if ( isWooOnboarding ) {
switch ( currentState ) {
case 'logged-out':
return translate( 'Create a Jetpack account' );
default:
return translate( 'Connecting your store' );
}
}

if ( isWooJPC ) {
switch ( currentState ) {
case 'logged-out':
Expand Down Expand Up @@ -150,25 +139,13 @@ export class AuthFormHeader extends Component {
getSubHeaderText() {
const {
translate,
isWooOnboarding,
isWooJPC,
wooDnaConfig,
isWpcomMigration,
isFromAutomatticForAgenciesPlugin,
} = this.props;
const currentState = this.getState();

if ( isWooOnboarding ) {
switch ( currentState ) {
case 'logged-out':
return translate(
'Your account will enable you to start using the features and benefits offered by Jetpack & WooCommerce Services.'
);
default:
return translate( "Once connected we'll continue setting up your store" );
}
}

if ( isWooJPC ) {
const pluginName = getPluginTitle( this.props.authQuery?.plugin_name, translate );
const reviewDocLink = (
Expand Down
Loading

0 comments on commit be15721

Please sign in to comment.