Skip to content

Commit a578c86

Browse files
chihsuanJess Boctor
authored and
Jess Boctor
committed
Refactor Woo state selectors (#98796)
* Refactor isWoo and isWooPasswordless check * Rename is-woo-passwordless-jpc-flow * Remove isPartnerSignup * Fix tests
1 parent 0e1ce70 commit a578c86

36 files changed

+281
-615
lines changed

client/blocks/authentication/social/social-tos.jsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { localize } from 'i18n-calypso';
33
import { connect } from 'react-redux';
44
import { getCurrentOAuth2Client } from 'calypso/state/oauth2-clients/ui/selectors';
55
import getIsBlazePro from 'calypso/state/selectors/get-is-blaze-pro';
6-
import getIsWooPasswordless from 'calypso/state/selectors/get-is-woo-passwordless';
7-
import isWooPasswordlessJPCFlow from 'calypso/state/selectors/is-woo-passwordless-jpc-flow';
6+
import getIsWCCOM from 'calypso/state/selectors/get-is-wccom';
7+
import isWooJPCFlow from 'calypso/state/selectors/is-woo-jpc-flow';
88

99
const toSLinks = {
1010
components: {
@@ -30,7 +30,7 @@ function getToSComponent( content ) {
3030
}
3131

3232
function SocialAuthToS( props ) {
33-
if ( props.isWooPasswordlessJPC ) {
33+
if ( props.isWooJPC ) {
3434
const termsOfServiceLink = (
3535
<a
3636
href={ localizeUrl( 'https://wordpress.com/tos/' ) }
@@ -71,7 +71,7 @@ function SocialAuthToS( props ) {
7171
);
7272
}
7373

74-
if ( props.isWooPasswordless ) {
74+
if ( props.isWCCOM ) {
7575
return getToSComponent(
7676
props.translate(
7777
'By continuing with any of the options above, you agree to our {{tosLink}}Terms of Service{{/tosLink}} and have read our {{privacyLink}}Privacy Policy{{/privacyLink}}.',
@@ -105,7 +105,7 @@ function SocialAuthToS( props ) {
105105

106106
export default connect( ( state ) => ( {
107107
oauth2Client: getCurrentOAuth2Client( state ),
108-
isWooPasswordless: getIsWooPasswordless( state ),
109-
isWooPasswordlessJPC: isWooPasswordlessJPCFlow( state ),
108+
isWCCOM: getIsWCCOM( state ),
109+
isWooJPC: isWooJPCFlow( state ),
110110
isBlazePro: getIsBlazePro( state ),
111111
} ) )( localize( SocialAuthToS ) );

client/blocks/login/continue-as-user.jsx

+9-35
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export default function ContinueAsUser( {
3737
onChangeAccount,
3838
redirectPath,
3939
isWoo,
40-
isWooPasswordless,
4140
isBlazePro,
4241
notYouText,
4342
} ) {
@@ -84,34 +83,6 @@ export default function ContinueAsUser( {
8483
);
8584

8685
if ( isWoo ) {
87-
if ( isWooPasswordless ) {
88-
return (
89-
<div className="continue-as-user">
90-
<div className="continue-as-user__user-info">
91-
{ gravatarLink }
92-
<div className="continue-as-user__not-you">
93-
<button
94-
type="button"
95-
id="loginAsAnotherUser"
96-
className="continue-as-user__change-user-link"
97-
onClick={ onChangeAccount }
98-
>
99-
{ translate( 'Sign in as a different user' ) }
100-
</button>
101-
</div>
102-
</div>
103-
<Button
104-
primary
105-
className="continue-as-user__continue-button"
106-
busy={ validatingPath }
107-
href={ validatedPath || '/' }
108-
>
109-
{ translate( 'Continue' ) }
110-
</Button>
111-
</div>
112-
);
113-
}
114-
11586
return (
11687
<div className="continue-as-user">
11788
<div className="continue-as-user__user-info">
@@ -123,15 +94,18 @@ export default function ContinueAsUser( {
12394
className="continue-as-user__change-user-link"
12495
onClick={ onChangeAccount }
12596
>
126-
{ translate( 'Log in with a different WordPress.com account' ) }
97+
{ translate( 'Sign in as a different user' ) }
12798
</button>
12899
</div>
129-
<Button primary busy={ validatingPath } href={ validatedPath || '/' }>
130-
{ `${ translate( 'Continue as', {
131-
context: 'Continue as an existing WordPress.com user',
132-
} ) } ${ userName }` }
133-
</Button>
134100
</div>
101+
<Button
102+
primary
103+
className="continue-as-user__continue-button"
104+
busy={ validatingPath }
105+
href={ validatedPath || '/' }
106+
>
107+
{ translate( 'Continue' ) }
108+
</Button>
135109
</div>
136110
);
137111
}

0 commit comments

Comments
 (0)