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

Signup: Change signup flow for domain only sites #10936

Merged
merged 10 commits into from
Feb 2, 2017

Conversation

gziolo
Copy link
Member

@gziolo gziolo commented Jan 25, 2017

That change allows to create a site only on checkout.
Requires backend patch to make it work: D4196.

screen shot 2017-02-01 at 19 17 44

Testing

  1. Apply D4196 patch.
  2. Open http://calypso.localhost:3000/start/domain-first.
  3. Pick domain name.
  4. Select domain only flow.
  5. Create your account.
  6. You should see checkout page with the following url: http://calypso.localhost:3000/checkout/no-site.
  7. After checkout you should be redirected to the domain management of the the purchased domain: http://calypso.localhost:3000/domains/manage/domain.live

Testing cart is empty after checkout:

  1. Complete checkout according the steps above
  2. Restart the domain only flow with the same user, you should be able to complete it with a new domain.
    -or-
    GET the no-site (the "copy as cURL") shopping cart from the API and see it has no products.
    You can do so on chrome by copying the request from the network tab and executing on a shell:
curl 'https://public-api.wordpress.com/rest/v1.1/me/shopping-cart/no-site?http_envelope=1&locale=en' -H ....

@gziolo gziolo added [Feature Group] Emails & Domains Features related to email integrations and domain management. [Feature] Signup & Account Creation All screens and flows for making a new WordPress.com account. [Status] In Progress labels Jan 25, 2017
@gziolo gziolo added this to the Tortuga MVP milestone Jan 25, 2017
@gziolo gziolo self-assigned this Jan 25, 2017
@matticbot
Copy link
Contributor

if ( designType === 'domain' ) {
// TODO: Find a way to create cart without a site
// SignupCart.addToCart depends on the site's slug
callback( undefined, [ null, null, domainItem, themeItem ] );
Copy link
Member Author

@gziolo gziolo Jan 25, 2017

Choose a reason for hiding this comment

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

@Tug @drewblaisdell I guess you know better what should be done here. I assume we need to build custom /me/transactions call which creates a site behind the scenes and adds domainItem to the cart.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's tricky because we now take advantage of site slug and redirect users to /checkout/:siteSlug url when an item is added to the cart. It looks like we need to build new page from scratch. It would work only with a single domain and wouldn't need to have connected site.

@gziolo gziolo force-pushed the update/create-cart-without-site branch 2 times, most recently from 85bc00e to eedd4d2 Compare January 31, 2017 18:08

_synchronizer = cartSynchronizer( selectedSite.ID, wpcom );
_synchronizer = cartSynchronizer( _cartItem, wpcom );
Copy link
Contributor

Choose a reason for hiding this comment

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

@gziolo I think _cartItem should be _cartKey.

@drewblaisdell
Copy link
Contributor

drewblaisdell commented Feb 1, 2017

Thanks for working on this. It is possible to purchase a domain without a site in this PR now. :) The redirect post-checkout-success needs to be updated to point to the domain the user just purchased, and the sites-list needs to be refetched at this point, but otherwise, I think this is close!

@yurynix
Copy link
Contributor

yurynix commented Feb 1, 2017

I've updated it to cause user re-fetch after checkout of domain only site, also change siteSelection controller to wait for user fetching.

@yurynix yurynix added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Feb 1, 2017
const allSitesPath = route.sectionify( context.path );

const redirectToPrimary = () => {
let redirectPath = `${ context.pathname }/${ sites.getPrimary().slug }`;
const onUserReady = () => {
Copy link
Contributor

@drewblaisdell drewblaisdell Feb 1, 2017

Choose a reason for hiding this comment

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

@yurynix Sorry for the previous comment here, I missed your first commit.

return domainManagementList( selectedSite.slug );
if ( cart.create_new_blog ) {
notices.info(
this.translate( 'Almost done…' )
Copy link

@a8ci18n a8ci18n Feb 2, 2017

Choose a reason for hiding this comment

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

Hi! I've found a possible matching string that has already been translated 21 times:
translate( 'Almost done' ) ES Score: 10.40
See 2 additional suggestions in the PR translation status page

Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).

@drewblaisdell
Copy link
Contributor

I made some changes. They will probably be easier to understand if you read them commit-by-commit.

  • I changed the method of fetching the updated site list to match the one we use in signup. The method that involved updating the my-sites controller was sending me to a sitepicker instead of the site (perhaps because the site isn't necessarily present in the next response from the sites endpoint). I included revert commits so that we can switch back to @yurynix's method easily if we want, but we'll want to remove them before merging.
  • Part of this change required addressing an issue that Checkout has had for some time now: getCheckoutCompleteRedirectPath does a lot more that simply return the post-checkout path. I added a commit to move the side effects to handleCheckoutCompleteRedirect. This way, we send PayPal the redirectTo value from getCheckoutCompleteRedirect without triggering any side effects, and can refetch the user/sites in handleCheckoutCompleteRedirect in the case that the user is not checking out through PayPal.

We still need to address the fact that the cart is not cleared during checkout with this PR/patch, so I'm going to label this as Needs Author Reply for now.

@drewblaisdell drewblaisdell added [Status] Needs Author Reply and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Feb 2, 2017
@yurynix
Copy link
Contributor

yurynix commented Feb 2, 2017

Thank you @drewblaisdell , this is awesome.

One concern I had before ( and why I choose to implement user fetch complete validation in the controller ) is:

the part here that from my understanding ( and maybe I'm totally mistaken ) we redirect to paypal, it does it thing and then we go to the success URL from "paypal express" code and therefor don't have a chance to fetch user & sites.

@Tug
Copy link
Contributor

Tug commented Feb 2, 2017

Indeed Paypal payment is broken and an error is thrown in redirectToPayPal:

Uncaught TypeError: Cannot read property 'slug' of null
    at Object.redirectToPayPal (app:///./client/my-sites/upgrades/checkout/paypal-payment-box.jsx:105:62)

Other than that it works well!

}

if ( receipt && receipt.receipt_id ) {
receiptId = receipt.receipt_id;

this.props.fetchReceiptCompleted( receiptId, {
Copy link
Contributor

@Tug Tug Feb 2, 2017

Choose a reason for hiding this comment

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

Maybe we should simply use the constant value ':receiptId' here, it's a bit confusing otherwise

@@ -252,6 +252,11 @@ module.exports = function() {
);

page(
'/checkout/no-site',
Copy link
Contributor

Choose a reason for hiding this comment

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

We could generalize to /checkout/:cart-key. Maybe in another PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm afraid we can't, because of the next route:

/checkout/:domain/:product?

It'll be the same is the route:

/checkout/:cart_key

Given /checkout/tug.blog we can't determine if that's a cart key or a domain

Copy link
Contributor

Choose a reason for hiding this comment

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

Also maybe we should come up with a better path fragment? https://wordpress.com/checkout/no-site doesn't look really nice for users.

Copy link
Member Author

Choose a reason for hiding this comment

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

Any ideas? I'm happy to update it :D

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm out of ideas, but I asked some feedback on Slack.

Copy link
Contributor

Choose a reason for hiding this comment

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

The domain-first flow isn't public yet, so we can update this in the future if we decide on a different path.

@yurynix
Copy link
Contributor

yurynix commented Feb 2, 2017

I think the error @Tug mentioned is due of us not having selectedSite in that flow, that's a different issue IMO then what I've mentioned.

Copy link
Contributor

@stephanethomas stephanethomas left a comment

Choose a reason for hiding this comment

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

The code looks good so far, great job!

createSiteWithCart: createSiteWithCart,
createCart,

createSiteWithCart,
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use the shorthand syntax here then we should probably update the rest of exports as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

good idea :)

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.

Thanks for adding those prop types!

@@ -252,6 +252,11 @@ module.exports = function() {
);

page(
'/checkout/no-site',
Copy link
Contributor

Choose a reason for hiding this comment

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

Also maybe we should come up with a better path fragment? https://wordpress.com/checkout/no-site doesn't look really nice for users.

Copy link
Contributor

@aidvu aidvu left a comment

Choose a reason for hiding this comment

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

Product LGTM.

Code is 👍, but I'd love if someone else would check it.

products: React.PropTypes.object.isRequired,
redirectTo: React.PropTypes.func.isRequired
redirectTo: React.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.

Comma.

Copy link
Member Author

Choose a reason for hiding this comment

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

Babel removes this comma, and it's valid syntax as of ES6+ :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Tbh, I like the comma, but it wasn't by the docs. Good to know. 😆

The user will be redirected away from `PayButton` when the payment is complete.
For some payments, we refetch the sites/user before redirecting, so the
transaction will complete before we want the loading state to change.
@drewblaisdell drewblaisdell force-pushed the update/create-cart-without-site branch from 1d6543d to dd9d46b Compare February 2, 2017 19:18
@drewblaisdell drewblaisdell 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 Author Reply labels Feb 2, 2017
@drewblaisdell
Copy link
Contributor

Looks good to me! I tested:

  • Purchasing a plan.
  • Purchasing a plan with a domain.
  • Purchasing a domain.
  • Purchasing via PayPal.

The patch has been deployed, so I'm going to merge this.

@drewblaisdell drewblaisdell added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Feb 2, 2017
@drewblaisdell drewblaisdell merged commit 87b7652 into master Feb 2, 2017
@Tug Tug deleted the update/create-cart-without-site branch February 2, 2017 21:01
@drewblaisdell drewblaisdell restored the update/create-cart-without-site branch February 2, 2017 22:08
@drewblaisdell drewblaisdell deleted the update/create-cart-without-site branch February 2, 2017 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature Group] Emails & Domains Features related to email integrations and domain management. [Feature] Signup & Account Creation All screens and flows for making a new WordPress.com account.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants