Skip to content
Open
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
14 changes: 7 additions & 7 deletions src/lib/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ const RESEND_ENDPOINT = 'https://api.resend.com/emails';

export function buildConfirmationBody(region: WaitlistRegion): string {
const regionLabel =
region === 'EU' ? 'Europa' : region === 'USA' ? 'Estados Unidos' : 'Latinoamérica';
region === 'EU' ? 'Europe' : region === 'USA' ? 'United States' : 'Latin America';

return [
'Hola,',
'Hi,',
'',
'¡Gracias por apuntarte a la lista de espera de NaN Community!',
'Thank you for joining the NaN Community waitlist!',
'',
`Tu solicitud para la región ${regionLabel} ha sido registrada correctamente.`,
'Te avisaremos por email en cuanto haya una plaza disponible para ti.',
`Your request for the ${regionLabel} region has been registered successfully.`,
'We will email you as soon as a spot opens up for you.',
'',
'Si tienes cualquier duda, responde directo a este correo.',
'If you have any questions, just reply to this email.',
'',
'— Cristian',
'nan.builders',
Expand All @@ -45,7 +45,7 @@ export async function sendConfirmationEmail(
params: SendEmailParams,
): Promise<SendEmailOutcome> {
const { to, region, apiKey, from } = params;
const subject = 'NaN Community — Estás en la lista de espera';
const subject = 'NaN Community — You are on the waitlist';
const text = buildConfirmationBody(region);

try {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/api/waitlist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe('POST /api/waitlist', () => {
expect(resendCall).toBeDefined();
const body = JSON.parse(resendCall![1].body);
expect(body.to).toBe('new@acme.co');
expect(body.subject).toContain('lista de espera');
expect(body.subject).toContain('waitlist');
});

it('does not send confirmation email for honeypot submissions', async () => {
Expand Down
22 changes: 11 additions & 11 deletions src/tests/lib/email.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ import {
} from '../../lib/email';

describe('buildConfirmationBody', () => {
it('mentions Europa for EU region', () => {
it('mentions Europe for EU region', () => {
const body = buildConfirmationBody('EU');
expect(body).toContain('Europa');
expect(body).not.toContain('Latinoamérica');
expect(body).toContain('Europe');
expect(body).not.toContain('Latin America');
});

it('mentions Latinoamérica for LATAM region', () => {
it('mentions Latin America for LATAM region', () => {
const body = buildConfirmationBody('LATAM');
expect(body).toContain('Latinoamérica');
expect(body).toContain('Latin America');
});

it('mentions Estados Unidos for USA region', () => {
it('mentions United States for USA region', () => {
const body = buildConfirmationBody('USA');
expect(body).toContain('Estados Unidos');
expect(body).toContain('United States');
});

it('is written in Spanish', () => {
it('is written in English', () => {
const body = buildConfirmationBody('EU');
expect(body).toContain('lista de espera');
expect(body).toContain('waitlist');
expect(body).toContain('Cristian');
expect(body).toContain('nan.builders');
});
Expand Down Expand Up @@ -65,8 +65,8 @@ describe('sendConfirmationEmail', () => {
const body = JSON.parse(options.body);
expect(body.to).toBe('alice@acme.co');
expect(body.from).toBe('Cristian · NaN <cristian@nan.builders>');
expect(body.subject).toContain('lista de espera');
expect(body.text).toContain('Europa');
expect(body.subject).toContain('waitlist');
expect(body.text).toContain('Europe');
});

it('returns error on non-2xx response', async () => {
Expand Down
Loading