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

Domains: Update domain mapping thank you page #51031

Merged
merged 30 commits into from
Mar 18, 2021

Conversation

leonardost
Copy link
Contributor

@leonardost leonardost commented Mar 12, 2021

Changes proposed in this Pull Request

In order to improve the user experience when buying domains and mappings, domain mapping instructions were updated in #50668. This PR updates the Thank You page, which is shown after a user buys a domain mapping, to reflect the same instructions that were changed in #50668.

Depending on the type of site the mapping was bought for - root domain or sub domain, for a simple or AT site - there should be one recommended setup (usually setting name servers) and one or two alternative, more advanced, options, usually setting A or CNAME records.

Testing instructions

Both simple and atomic sites should be tested, as well as root domain mappings and subdomain mappings.

  1. In Calypso, go to Upgrades > Domains > Add a domain to this site
  2. Select "Use a domain I own"
  3. "Map your domain"
  4. Insert a root domain or subdomain
  5. Buy that domain mapping for your site
  6. The "Thank you" page with further instructions to setup domain mapping will be shown.

Root domain mappings instructions differ if the site is simple or atomic.

  • For simple sites: The recommended setup should be to set NS records pointing to our name servers, and the advanced setup should show the default IP addresses (*.24 and *.25) to be set as A records
  • For AT sites: The recommended setup should be to set NS records pointing to our name servers, and the advanced setup should show the AT site's IP addresses to be set as A records

Subdomain mappings should show the following instructions: The recommended setup should be to set CNAME or NS records pointing to our name servers, and no advanced setup should be shown

@matticbot
Copy link
Contributor

@leonardost leonardost added [Feature Group] Emails & Domains Features related to email integrations and domain management. [Status] In Progress Back to Basics labels Mar 12, 2021
@matticbot
Copy link
Contributor

matticbot commented Mar 12, 2021

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~1643 bytes added 📈 [gzipped])

name      parsed_size           gzip_size
checkout      +3374 B  (+0.2%)    +1247 B  (+0.3%)
domains       +1531 B  (+0.1%)     +396 B  (+0.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@klimeryk klimeryk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving comments from our call together so that they are not lost.
Sorry for the brevity - the code and approach is overall looking really good. Good job figuring out all the moving pieces from other places in our code!

) : (
<span />
);
const renderLinkTo = ( url ) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use ExternalLink here.

const primaryMessage = translate(
'Please log into your account at your domain registrar and {{strong}}update the name servers{{/strong}} of your domain to use the following values, as detailed in {{link}}these instructions{{/link}}:',
{
comment: 'Notice for mapped domain notice with NS records pointing to somewhere else',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be needed.

<li>{ domain }. IN NS ns1.wordpress.com.</li>
<li>{ domain }. IN NS ns2.wordpress.com.</li>
<li>{ domain }. IN NS ns3.wordpress.com.</li>
const isDataLoaded = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's maybe refactor the whole component to be a normal one - or at least, pull these methods out of this component.

};

const renderARecordsList = () => {
if ( isDataLoaded() ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe let's inverse the logic here - and return the placeholder component early. As that's the least interesting case (and avoids big nested lines).

margin: 0;
}
.purchase-detail__image {
@include breakpoint-deprecated( '>660px' ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@klimeryk klimeryk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I really like the separate component that we will be then be able to share in different places. Left a few comments from our call.

Be sure to also test with ?flag=force-sympathy in development mode to simulate loading Calypso with an empty Redux tree.

domain: PropTypes.object,
isAtomic: PropTypes.bool,
isLoaded: PropTypes.bool,
translate: PropTypes.func.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By convention, translate is not included in the prop types, as it comes from the localize HOC wrapper.

isLoaded: false,
};

render() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By convention, render is usually the last method in the component. The way I've always approached it was go from most internal to most "public" ones. So, lifecycle methods like willReceiveProps, etc. first and then smaller render* methods. And then finally the main render method.

};

render() {
const { domain } = this.props;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid inconsistent messaging as the domain object is loaded, let's maybe simply show a placeholder here and return early.

static propTypes = {
domain: PropTypes.object,
isAtomic: PropTypes.bool,
isLoaded: PropTypes.bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's maybe put a more descriptive variable name here - it's unclear what exactly "is loaded" otherwise.


class DomainMappingInstructions extends React.Component {
static propTypes = {
domain: PropTypes.object,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing in the whole domain object, maybe it'd be better to pass in only the props we need:

  • domain name
  • A records list
  • areDomainDetailsLoaded type of prop that will probably look like ! isRequestingSiteDomains && domain - meaning, do we have the domain object and we're not waiting for a new version of it.

@@ -0,0 +1,143 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discusses on call, maybe let's put it in my-sites/domains/components/mapping-instructions, since this will be shared between domain management and checkout 🙇

</div>
);
};

const mapStateToProps = ( state, { domain } ) => {
const selectedSite = getSelectedSite( state );
return {
domains: getDomainsBySiteId( state, selectedSite.ID ),
isBusinessPlan: isBusiness( selectedSite.plan ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to add something like isRequestingSiteDomains: isRequestingSiteDomains( state, selectedSite.ID ) here from import { isRequestingSiteDomains } from 'calypso/state/sites/domains/selectors';.

@leonardost leonardost force-pushed the update/domain-mapping-thank-you-page branch from 009ebf2 to 5a86e40 Compare March 16, 2021 17:48
@leonardost leonardost marked this pull request as ready for review March 17, 2021 13:37
@leonardost leonardost requested a review from a team as a code owner March 17, 2021 13:37
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 17, 2021
Copy link
Contributor

@klimeryk klimeryk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! This looks almost perfect - I've just left a few nitpicks, but we're almost there ❤️

Comment on lines 51 to 53
const selectedSite = getSelectedSite( state );
return {
domains: getDomainsBySiteId( state, selectedSite.ID ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const selectedSite = getSelectedSite( state );
return {
domains: getDomainsBySiteId( state, selectedSite.ID ),
const selectedSite = getSelectedSite( state );
const domains = getDomainsBySiteId( state, selectedSite.ID );
return {
purchasedDomain: getSelectedDomain( { domains, selectedDomainName: domain } );

I'd move fetching the selected domain name to here, instead of doing it inside the component.

import { getSelectedSite } from 'calypso/state/ui/selectors';
import QuerySiteDomains from 'calypso/components/data/query-site-domains';
import { getDomainsBySiteId, isRequestingSiteDomains } from 'calypso/state/sites/domains/selectors';
import DomainMappingInstructions from 'calypso/my-sites/domains/components/mapping-instructions';

const DomainMappingDetails = ( {
domain,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe to avoid confusion on whether domain is the domain object or string, you could rename it here like this:

Suggested change
domain,
domain: domainName,

@@ -78,7 +78,7 @@ export default class PurchaseDetail extends PureComponent {

return (
<div className="purchase-detail__body">
{ this.renderPurchaseButton() }
{ this.props.href && this.renderPurchaseButton() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change might not be needed or correct in fact - I can imagine a use case where onClick is the only handler passed (like navigating to a different section in Calypso) and this change would break that behaviour.

Maybe we're misusing this component at all - instead of passing in description, it should not be a body?


> div:last-of-type .foldable-faq__answer {
border-bottom: 0;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule was conflicting with another one in mapping-instructions/style.scss

Copy link
Contributor

@klimeryk klimeryk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested again and all looks great! 💖

@leonardost leonardost added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 18, 2021
Moved from `my-sites/domains/domain-management/` to
`my-sites/domains/components/` as the component will be shared between
doman management and checkout.
@leonardost leonardost force-pushed the update/domain-mapping-thank-you-page branch from 13b0a98 to 9808de3 Compare March 18, 2021 18:47
@leonardost leonardost merged commit 381247b into trunk Mar 18, 2021
@leonardost leonardost deleted the update/domain-mapping-thank-you-page branch March 18, 2021 19:14
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 18, 2021
leonardost added a commit that referenced this pull request Mar 31, 2021
Continuing the changes done in #51031 and #50668, this PR updates the subdomain mapping instructions that are presented to users. These instructions are shown in the thank you page, after the user buys the subdomain mapping, and in the domains management page, when a subdomain isn't mapped yet.

This PR presents CNAME or NS records mappings as recommended setups depending if the site is simple or AT, respectively. Alternative mapping setups (e.g. using A records) are shown as advanced setup options.
@a8ci18n
Copy link

a8ci18n commented Mar 31, 2021

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/5639196

Hi @leonardost, could you please edit the description of this PR and add a screenshot for our translators? Ideally it'd include this string: Please set the following IP addresses as A records for %(subdomain)s using {{link}}these instructions{{/link}}:

Thank you in advance!

@a8ci18n
Copy link

a8ci18n commented Apr 8, 2021

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Back to Basics [Feature Group] Emails & Domains Features related to email integrations and domain management.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants