-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Signup: move MLB flow to Calypso #541
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2f4efdb
Make the Site Step component more reusable by providing props.domain …
oskosk 83177df
Add MLB signup flow, MLB theme selection and mlb-domains steps.
oskosk e9f0e69
Use the ThemesList component on MLB theme selection step
oskosk 4e8e134
Update MLB Signup flow url from /start/mlb to /start/.mlb.com
oskosk dc60a29
Adapt MLB signup flow to use new ThemesList interface and analytics l…
oskosk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## MLB.com blogs domain selection step | ||
|
||
This step is used by the MLB blogs signup flow (flow `mlb`) | ||
|
||
This step offers the user: | ||
|
||
* Domain selection with proposal of free .mlblogs.com domain and regular `.wordpress.com` domains and prices. | ||
|
||
### Copytext | ||
|
||
* Link to Terms of Use on team/theme selection step. Text: *By clicking continue, you understand that activating an MLB.com/blogs account indicates your acceptance of the [Terms of Use](http://mlb.mlb.com/mlb/official_info/about_mlb_com/terms_of_use.jsp)*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
var React = require( 'react' ); | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
var SiteCreationStep = require( 'signup/steps/site' ); | ||
|
||
module.exports = React.createClass( { | ||
displayName: 'MlbDomainsStep', | ||
|
||
getDefaultProps: function() { | ||
return { | ||
domain: '.mlblogs.com' | ||
}; | ||
}, | ||
|
||
render: function() { | ||
return ( | ||
<SiteCreationStep {...this.props }/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good change 👍 |
||
); | ||
} | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## MLB.com blogs theme selection step | ||
|
||
This step is used by the MLB blogs signup flow (flow `mlb`) | ||
|
||
This step offers the user: | ||
|
||
* Team selection (Defaulting to generic MLB theme set). | ||
* Theme selection (Selectable by thumbnail clicking). | ||
* Fan | ||
* Modern | ||
* Retro | ||
* Continue (button) on team/theme selection step. | ||
* Link to MLB.com/blogs on team/theme selection step. Text: *Welcome to [MLB.com/blogs](http://www.mlb.com/blogs). After choosing your team and theme below you'll be ready to start blogging.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
var React = require( 'react' ), | ||
noop = require( 'lodash/noop' ); | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
var StepWrapper = require( 'signup/step-wrapper' ), | ||
analytics = require( 'lib/analytics' ), | ||
SignupActions = require( 'lib/signup/actions' ); | ||
import ThemesList from 'components/themes-list' ; | ||
|
||
module.exports = React.createClass( { | ||
displayName: 'MlbThemeSelection', | ||
getDefaultProps: function() { | ||
var props = { | ||
variations: [ 'Fan', 'Modern', 'Retro' ], | ||
teams: { | ||
mlb: 'MLB', | ||
'minor-league': 'MiLB.com', | ||
diamondbacks: 'Arizona Diamondbacks', | ||
braves: 'Atlanta Braves', | ||
orioles: 'Baltimore Orioles', | ||
redsox: 'Boston Red Sox', | ||
cubs: 'Chicago Cubs', | ||
whitesox: 'Chicago White Sox', | ||
reds: 'Cincinnati Reds', | ||
indians: 'Cleveland Indians', | ||
rockies: 'Colorado Rockies', | ||
tigers: 'Detroit Tigers', | ||
astros: 'Houston Astros', | ||
royals: 'Kansas City Royals', | ||
angels: 'Los Angeles Angels', | ||
dodgers: 'Los Angeles Dodgers', | ||
marlins: 'Miami Marlins', | ||
brewers: 'Milwaukee Brewers', | ||
twins: 'Minnesota Twins', | ||
mets: 'New York Mets', | ||
yankees: 'New York Yankees', | ||
athletics: 'Oakland Athletics', | ||
phillies: 'Philadelphia Phillies', | ||
pirates: 'Pittsburgh Pirates', | ||
padres: 'San Diego Padres', | ||
giants: 'San Francisco Giants', | ||
mariners: 'Seattle Mariners', | ||
cardinals: 'St. Louis Cardinals', | ||
rays: 'Tampa Bay Rays', | ||
rangers: 'Texas Rangers', | ||
bluejays: 'Toronto Blue Jays', | ||
nationals: 'Washington Nationals' | ||
} | ||
}; | ||
return props; | ||
}, | ||
|
||
getInitialState: function() { | ||
return { | ||
team: 'mlb' | ||
}; | ||
}, | ||
|
||
handleTeamSelect: function( event ) { | ||
event.preventDefault(); | ||
this.setState( { team: event.target.value } ); | ||
}, | ||
|
||
getThumbnailUrl: function( team, variation ) { | ||
var url = 'https://i1.wp.com/s0.wp.com/wp-content/themes/vip/partner-' + | ||
team + '-' + variation.toLowerCase() + '/screenshot.png?w=660'; | ||
if ( team !== 'mlb' ) { | ||
url = 'https://signup.wordpress.com/wp-content/mu-plugins/signup-variants/mlblogs/images/themes/' + | ||
variation.toLowerCase() + '/' + team + '.jpg'; | ||
} | ||
return url; | ||
}, | ||
|
||
handleSubmit: function( theme ) { | ||
var variation = theme.name, | ||
themeSlug = 'partner-mlb-' + variation.toLowerCase(); | ||
|
||
analytics.tracks.recordEvent( 'calypso_mlb_signup_theme_select', { theme: themeSlug, team: this.state.team } ); | ||
SignupActions.submitSignupStep( { | ||
stepName: this.props.stepName, | ||
processingMessage: this.translate( 'Adding your theme' ), | ||
themeSlug | ||
} ); | ||
|
||
this.props.goToNextStep(); | ||
}, | ||
|
||
renderThemes: function() { | ||
var actionLabel = this.translate( 'Pick' ), | ||
themes = this.props.variations.map( ( variation ) => { | ||
return { | ||
id: variation.toLowerCase(), | ||
name: variation, | ||
screenshot: this.getThumbnailUrl( this.state.team, variation ), | ||
actionLabel: actionLabel | ||
}; | ||
} ); | ||
return ( | ||
<div> | ||
<div className="mlb-theme-selection__team-select-container"> | ||
<fieldset className="form-fieldset"> | ||
<select onChange={ this.handleTeamSelect } name="team-field"> | ||
<option key="mlb" value="mlb">{ this.translate( 'Choose your team…' ) }</option> | ||
{ Object.keys( this.props.teams ).map( ( key ) => { | ||
let team = this.props.teams[ key ]; | ||
return <option key={ key } value={ key }>{ team }</option>; | ||
}.bind( this ) ) } | ||
</select> | ||
</fieldset> | ||
</div> | ||
<ThemesList | ||
getButtonOptions= { noop } | ||
onScreenshotClick= { this.handleSubmit } | ||
onMoreButtonClick= { noop } | ||
{ ...this.props } | ||
themes= { themes } /> | ||
<div className="mlb-theme-selection__terms"> | ||
<p> | ||
{ this.translate( 'By selecting a theme or clicking Skip, you understand that activating an MLB.com/blogs account indicates your acceptance of the {{a}}Terms of Use{{/a}}.', { | ||
components: { | ||
a: <a href="http://mlb.mlb.com/mlb/official_info/about_mlb_com/terms_of_use.jsp" target="_blank" /> | ||
} | ||
} ) } | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
}, | ||
|
||
render: function() { | ||
return ( | ||
<StepWrapper | ||
headerText={ this.translate( 'Welcome to MLB.com/blogs.' ) } | ||
fallbackHeaderText={ this.translate( 'Register.' ) } | ||
fallbackSubHeaderText={ this.translate( 'No need to overthink it. You can always switch to a different theme\u00a0later.' ) } | ||
subHeaderText={ this.translate( 'After choosing your team and theme below you\'ll be ready to start blogging.' ) } | ||
stepContent={ this.renderThemes() } | ||
{ ...this.props } /> | ||
); | ||
} | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.mlb-theme-selection__terms p { | ||
text-align: center; | ||
color: #87a6bc; | ||
font-size: 11px; | ||
} | ||
|
||
.mlb-theme-selection__team-select-container { | ||
display: flex; | ||
flex: row wrap; | ||
} | ||
|
||
.mlb-theme-selection__team-select-container fieldset { | ||
width: 220px; | ||
padding: 1px; | ||
flex-grow: 1; | ||
flex-shrink: 0; | ||
} | ||
|
||
.mlb-theme-selection__team-select-container::before, | ||
.mlb-theme-selection__team-select-container::after { | ||
content: " "; | ||
display: block; | ||
width: 230px; | ||
flex-grow: 1; | ||
} | ||
|
||
.mlb-theme-selection__team-select-container select { | ||
width: 100%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean
delayApiRequestUntilComplete
? Or the whole definition? (as opposed to using just theSite
step?)If you meant the latter I can say that at first, I replicated the
domains
step definition, then changed it to be similar tosite
definition.The thing is that the way the API will handle the creation of
.mlblogs.com
sites is still to be defined.If it's implemented as a free product, then this step may be needing to provide the
domainItem
dependency also instead of just thesiteSlug
and use an API request function likestepAction.addDomainsItemToCart
instead ofstepAction.createSite
.And the
mlb-domain
step component would need to have some extra logic for handling submit. (Currently the Site step is handling the submit, sending the step data to the API usingstepActions.createSite
which demands less properties thanstepActions.addDomainsItemToCart
when submitting signup step.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delayApiRequestUntilComplete
is only needed if the user is going to go back and edit the content before the end of the flow. I don't think you need it here.You're right though there is still a big question mark about how we implement the API. For now your solution of using
createSite
is fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, in this case the anonymous user should not be able to get back to domain screen?
I mean, If the user is logged, there's no extra step after selecting domain. But if the user is anonymous there's still one more screen (the
user
step) where there's a back button that would allow to alter the domain.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it some more and I think you're right. Lets leave this how it is; that's the way its done in other flows.