-
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: Change signup flow for domain only sites #10936
Conversation
client/lib/signup/step-actions.js
Outdated
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 ] ); |
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.
@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.
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.
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.
85bc00e
to
eedd4d2
Compare
client/lib/cart/store/index.js
Outdated
|
||
_synchronizer = cartSynchronizer( selectedSite.ID, wpcom ); | ||
_synchronizer = cartSynchronizer( _cartItem, wpcom ); |
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.
@gziolo I think _cartItem
should be _cartKey
.
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! |
I've updated it to cause user re-fetch after checkout of domain only site, also change siteSelection controller to wait for user fetching. |
client/my-sites/controller.js
Outdated
const allSitesPath = route.sectionify( context.path ); | ||
|
||
const redirectToPrimary = () => { | ||
let redirectPath = `${ context.pathname }/${ sites.getPrimary().slug }`; | ||
const onUserReady = () => { |
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.
@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…' ) |
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.
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).
I made some changes. They will probably be easier to understand if you read them commit-by-commit.
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 |
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. |
Indeed Paypal payment is broken and an error is thrown in
Other than that it works well! |
} | ||
|
||
if ( receipt && receipt.receipt_id ) { | ||
receiptId = receipt.receipt_id; | ||
|
||
this.props.fetchReceiptCompleted( receiptId, { |
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.
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', |
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.
We could generalize to /checkout/:cart-key
. Maybe in another PR.
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'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
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.
Also maybe we should come up with a better path fragment? https://wordpress.com/checkout/no-site doesn't look really nice for users.
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.
Any ideas? I'm happy to update it :D
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'm out of ideas, but I asked some feedback on Slack.
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.
The domain-first
flow isn't public yet, so we can update this in the future if we decide on a different path.
I think the error @Tug mentioned is due of us not having |
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.
The code looks good so far, great job!
createSiteWithCart: createSiteWithCart, | ||
createCart, | ||
|
||
createSiteWithCart, |
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.
If we use the shorthand syntax here then we should probably update the rest of exports as well.
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.
good idea :)
PropTypes.object | ||
] ) | ||
}, | ||
|
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.
Thanks for adding those prop types!
@@ -252,6 +252,11 @@ module.exports = function() { | |||
); | |||
|
|||
page( | |||
'/checkout/no-site', |
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.
Also maybe we should come up with a better path fragment? https://wordpress.com/checkout/no-site doesn't look really nice for users.
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.
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, |
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.
Comma.
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.
Babel removes this comma, and it's valid syntax as of ES6+ :)
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.
Tbh, I like the comma, but it wasn't by the docs. Good to know. 😆
…and add `handleCheckoutCompleteRedirect`
…checkout We do the same during signup.
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.
1d6543d
to
dd9d46b
Compare
Looks good to me! I tested:
The patch has been deployed, so I'm going to merge this. |
That change allows to create a site only on checkout.
Requires backend patch to make it work:
D4196
.Testing
D4196
patch.http://calypso.localhost:3000/domains/manage/domain.live
Testing cart is empty after checkout:
-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 ....