Skip to content

Conversation

@sebastianekstrom
Copy link
Contributor

📋 Summary

Related Issue: Fixes #7984

🎯 What

This PR will add some more data to the order confirmation email to give our users a quick glance of the purchase that has been made:

  • Product image
  • CTA that will take you to the order
  • Customer details, including name and address

I also took the opportunity to redesign the email a bit.

🖼️ Screenshots/Recordings

Frame 3822

@vercel
Copy link

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
polar Ignored Ignored Preview Dec 1, 2025 2:03pm
polar-sandbox Ignored Ignored Preview Dec 1, 2025 2:03pm

Copy link
Contributor

@Yopi Yopi left a comment

Choose a reason for hiding this comment

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

A few small comments, but otherwise nice work!

const formattedAddress =
addressParts.length > 0 ? addressParts.join(', ') : null

const orderUrl = `https://polar.sh/dashboard/${organization_slug}/sales/${order_id}`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we send emails in both environments, in which case this needs to handle sandbox / prod

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch!

class MaintainerNewProductSaleNotificationPayload(NotificationPayloadBase):
customer_name: str
customer_email: str
customer_name: str | None = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't we still always have a customer_name? So this should just be : str

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, or was the previous guarantee based on that we were passing in the customer_email?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, or was the previous guarantee based on that we were passing in the customer_email?

Exactly!

order_date=order.created_at.isoformat(),
organization_name=organization.name,
organization_slug=organization.slug,
billing_reason=order.billing_reason,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is typed as a non-str (OrderBillingReasonInternal), so you should be able to pass through the enum instead of a string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call!


@computed_field
def formatted_billing_reason(self) -> str:
reasons = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Passing through the enum (as per the other comment) will make this a bit more complete. I think you can even get an exhaustive switch in that case (if you opt to not use a dict)

@sebastianekstrom sebastianekstrom force-pushed the chore/order-email-updates branch 4 times, most recently from 5d181b9 to 491018f Compare December 1, 2025 13:11
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

📦 Next.js Bundle Analysis for web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@sebastianekstrom sebastianekstrom force-pushed the chore/order-email-updates branch from 491018f to 457b5f2 Compare December 1, 2025 13:54
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

📦 Next.js Bundle Analysis for web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@sebastianekstrom sebastianekstrom force-pushed the chore/order-email-updates branch from 457b5f2 to e2dc6c8 Compare December 1, 2025 14:03
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

📦 Next.js Bundle Analysis for web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@sebastianekstrom sebastianekstrom merged commit 6d26294 into main Dec 1, 2025
14 of 15 checks passed
@sebastianekstrom sebastianekstrom deleted the chore/order-email-updates branch December 1, 2025 14:49
sebastianekstrom added a commit that referenced this pull request Dec 1, 2025
sebastianekstrom added a commit that referenced this pull request Dec 1, 2025
sebastianekstrom added a commit that referenced this pull request Dec 1, 2025
sebastianekstrom added a commit that referenced this pull request Dec 2, 2025
* Revert "Revert "Update order email (#8173)" (#8183)"

This reverts commit 6feafac.

* Add fix for crash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

More details in new sale email

3 participants