Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions packages/auth/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { members, subscriptions } from "@superset/db/schema";
import type { sessions } from "@superset/db/schema/auth";
import * as authSchema from "@superset/db/schema/auth";
import { seedDefaultStatuses } from "@superset/db/seed-default-statuses";
import { WelcomeEmail } from "@superset/email/emails/activation/00-welcome";
import { MemberAddedBillingEmail } from "@superset/email/emails/billing/member-added";
import { MemberRemovedBillingEmail } from "@superset/email/emails/billing/member-removed";
import { PaymentFailedEmail } from "@superset/email/emails/billing/payment-failed";
Expand Down Expand Up @@ -326,17 +325,13 @@ export const auth = betterAuth({

// The welcome email is unconditional in BOTH arms. Gating it is
// what invalidated experiment 387868: a6beb048b changed the control
// condition mid-flight and the run became unreadable.
// condition mid-flight and the run became unreadable. The `welcome`
// automation sends it, because only automation sends get Resend's
// unsubscribe link and List-Unsubscribe headers.
try {
const { error } = await resend.emails.send({
from: "Superset <noreply@superset.sh>",
replyTo: "support@superset.sh",
to: user.email,
subject: "Welcome to Superset",
react: WelcomeEmail({
userName: user.name,
userEmail: user.email,
}),
const { error } = await resend.events.send({
event: "user.welcome",
email: user.email,
});
// Resend reports API failures in `error` rather than throwing.
if (error) throw new Error(error.message);
Expand Down
18 changes: 18 additions & 0 deletions packages/email/scripts/sync-automations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,24 @@ function template(alias: string, variables?: Record<string, unknown>) {
}

const desired: DesiredAutomation[] = [
{
// Every signup's welcome email; stopping this stops them all. It has its
// own event because `user.signed_up` is withheld from the A/B control arm.
name: "welcome",
steps: [
{
key: "start",
type: "trigger",
config: { eventName: "user.welcome" },
},
{
key: "send_welcome",
type: "send_email",
config: { template: template("activation-00-welcome") },
},
],
connections: [{ from: "start", to: "send_welcome", type: "default" }],
},
{
name: "pro-cancellation-feedback",
steps: [
Expand Down
7 changes: 6 additions & 1 deletion packages/email/src/emails/activation/00-welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ const DOWNLOAD = "https://superset.sh/download";
interface WelcomeEmailProps {
userName?: string;
userEmail?: string;
unsubscribeUrl?: string;
}

export function WelcomeEmail({ userEmail }: WelcomeEmailProps = {}) {
export function WelcomeEmail({
userEmail,
unsubscribeUrl,
}: WelcomeEmailProps = {}) {
const assets = `${env.NEXT_PUBLIC_MARKETING_URL}/assets/emails`;

return (
<EmailLayout
preview="They do the work. You review the diffs."
recipientEmail={userEmail}
unsubscribeUrl={unsubscribeUrl}
>
<Heading className="text-[22px] font-medium leading-8 text-foreground m-0 mb-3">
Welcome to Superset
Expand Down
Loading