-
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
Checkout: Add thank you page for the domain only site flow #11702
Conversation
630d4c0
to
1a37150
Compare
@@ -234,7 +234,7 @@ module.exports = function() { | |||
|
|||
if ( config.isEnabled( 'upgrades/checkout' ) ) { | |||
page( | |||
'/checkout/thank-you/no-site/:receiptId', | |||
'/checkout/thank-you/no-site/: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.
Thanks for fixing this.
@@ -229,6 +229,17 @@ const CheckoutThankYou = React.createClass( { | |||
); | |||
} | |||
|
|||
if ( this.props.domainOnlySiteFlow && ! failedPurchases ) { |
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.
Empty arrays are still truthy so we need to check the length here.
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 had this locally:)
if ( this.props.domainOnlySiteFlow && failedPurchases.length === 0 && purchases.some( isDomainRegistration ) ) {
{ translate( 'Visit Your Site' ) } | ||
</a> | ||
</div> | ||
<div className="plan-thank-you-card__heading"> |
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 think these styles should live in ThankYouCard
instead of PlanThankYouCard
because we want to use them in every (currently, both) version of the thank you card.
Unfortunately, this means we won't be able to use children
which is a nice API for this component. The other options would be to:
- Reference
thank-you-card
styles inplan-thank-you-card
. - Duplicate the styles between
domain-thank-you-card
andplan-thank-you-card
.
I don't think either of those are preferable to using props instead of props.children
here. What do you think?
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 perfectly fine with this approach. This was my first idea, but I quickly got distracted by the power of children
:)
What you proposed fits what we need in this particular approach and removes code duplication. If it turns out we need something different inside body we can always extract this content and create another component and get back to the concept of using children
.
2474044
to
414c641
Compare
heading={ this.translate( 'Thank you for your purchase!' ) } | ||
description={ this.translate( "That looks like a great domain. Now it's time to get it all set up." ) } | ||
buttonUrl={ domainManagementEdit( domainName, domainName ) } | ||
buttonText={ this.translate( 'Manage Your 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.
Hi! I've found a possible matching string that has already been translated 52 times:
translate( 'Manage Your Domains' )
ES Score: 11
See 1 additional suggestion 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).
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 this is ready for review. :) |
// this placeholder is using just wp logo here because two possible states do not share a common layout | ||
if ( ! purchases && ! failedPurchases && ! this.isGenericReceipt() ) { | ||
if ( ! purchases.length && ! failedPurchases.length && ! this.isGenericReceipt() ) { |
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 👍
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.
That's personal preference but I like using isEmpty()
in those cases since it makes the code reads like a sentence.
|
||
<ThankYouCard | ||
name={ this.translate( 'Domain Registration' ) } | ||
price={ purchase.displayPrice } |
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.
What about privacy protection?
@drewblaisdell thanks for finishing this PR. Everything looks awesome. I had only two comments, one related to the different copy for the button. We also need to double check if privacy protection cost is included in the price displayed on this page. |
1fb005a
to
581a6d4
Compare
@drewblaisdell thanks for fixing the issue raised by @stephanethomas 👍 |
@stephanethomas can you try to reproduce the issue you discovered with the updated backend patch and client code? :) |
@@ -288,10 +282,12 @@ const Checkout = React.createClass( { | |||
} | |||
|
|||
if ( receipt && receipt.receipt_id ) { | |||
const receiptId = receipt.receipt_id; | |||
const receiptId = receipt.receipt_id, | |||
displayPrice = receipt.display_price; |
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.
This is where destructuring comes in handy:
const { receipt_id: receiptId, display_price: displayPrice } = receipt;
@gziolo: I've just tested it and had the same issue again with the
|
581a6d4
to
52cd24b
Compare
@stephanethomas There was an issue where we were camelCasing keys that were expected to be raw from the API that I fixed in 52cd24b. I tested several times with and without the privacy upgrade and never saw a |
It might be because @stephanethomas has tested it with credits. I'll double check it today with free credits :) I guess 0 price is sth expected in such case. |
I tested also the case when paying with card, everything works properly. Product 👍 |
Implements #11452.
Requires D4612-code.This PR:
ThankYouCard
fromPlanThankYouCard
.PlanThankYouCard
to useThankYouCard
.ThankYouCard
to display a domain-only thank you page.Testing
PlanThankYouCard
Make sure https://wpcalypso.wordpress.com/devdocs/blocks/plan-thank-you-card and http://calypso.localhost:3000/devdocs/blocks/plan-thank-you-card looks the same after refactoring. See also image below for comparison.
Visit
/start
while logged out (PlanThankYouCard
is only displayed for new users).Select a non-free plan on the plans page.
Proceed through signup and create a new user.
Assert that you land in checkout with the plan you selected in the second step.
Purchase the plan.
Assert that you land on a thank you page with
PlanThankYouCard
displayed for the plan you purchased like in the image above.New thank you page
/start/domain-first?new=DOMAIN
whereDOMAIN
is a domain likethisisaniquedomain123.live
.Just purchase a domain
.ThankYouCard
displayed for the domain you purchased like:Review