diff --git a/src/lib/redirects.ts b/src/lib/redirects.ts index 6107dd8a..3b969b9f 100644 --- a/src/lib/redirects.ts +++ b/src/lib/redirects.ts @@ -28,12 +28,12 @@ const REDIRECTS: Record = { '/contact': '/contact-us' } -const OUR_XRISK_INTROS_YOUTUBE_PLAYLIST = - 'https://www.youtube.com/watch?v=xBqU1QxCao8&list=PLI46NoubGtIJa0JVCBR-9CayxCOmU0EJt&index=1'; +const OUR_XRISK_INTROS_YOUTUBE_PLAYLIST = + 'https://www.youtube.com/watch?v=xBqU1QxCao8&list=PLI46NoubGtIJa0JVCBR-9CayxCOmU0EJt&index=1' /** Temporary redirects (302) - for time-limited campaigns, A/B tests, etc. */ const TEMPORARY_REDIRECTS: Record = { '/see-why': OUR_XRISK_INTROS_YOUTUBE_PLAYLIST, - '/cy': OUR_XRISK_INTROS_YOUTUBE_PLAYLIST, + '/cy': OUR_XRISK_INTROS_YOUTUBE_PLAYLIST } export function handleRedirects(path: string) { diff --git a/src/routes/contact-us/+page.server.ts b/src/routes/contact-us/+page.server.ts index 02316851..3788b552 100644 --- a/src/routes/contact-us/+page.server.ts +++ b/src/routes/contact-us/+page.server.ts @@ -111,6 +111,58 @@ async function sendContactEmail(data: { } } +async function sendConfirmationEmail(data: { + name: string + email: string + type: keyof typeof CONTACT_RECIPIENTS +}) { + if (!env.MAILERSEND_API_KEY || !data.email) return + + const teamEmail = CONTACT_RECIPIENTS[data.type] + + const emailBody = { + from: { + email: teamEmail, + name: 'PauseAI Team' + }, + reply_to: { + email: teamEmail, + name: 'PauseAI Team' + }, + to: [ + { + email: data.email, + name: data.name + } + ], + subject: 'Thank you for contacting PauseAI', + html: ` +

Hello,

+

Thank you for your interest — we appreciate you reaching out.

+

We’ve received your inquiry, and a member of our team will respond promptly.

+

We are a small team, therefore we aim to get back to you within 3 – 4 business days.

+

Thanks again for your patience and interest.

+
+

Best regards,

+

Pause AI team

+ `, + text: `Hello,\n\nThank you for your interest — we appreciate you reaching out.\n\nWe’ve received your inquiry, and a member of our team will respond promptly.\n\nWe are a small team, therefore we aim to get back to you within 3 – 4 business days.\n\nThanks again for your patience and interest.\n\n\nBest regards,\n\nPause AI team` + } + + try { + await fetch('https://api.mailersend.com/v1/email', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${env.MAILERSEND_API_KEY}` + }, + body: JSON.stringify(emailBody) + }) + } catch (error) { + console.error('Failed to send confirmation email:', error) + } +} + export const actions: Actions = { standard: async ({ request }) => { const data = await request.formData() @@ -135,6 +187,8 @@ export const actions: Actions = { return fail(500, { message: result.message }) } + await sendConfirmationEmail({ name, email, type: 'Standard' }) + return { success: true } }, media: async ({ request }) => { @@ -162,6 +216,8 @@ export const actions: Actions = { return fail(500, { message: result.message }) } + await sendConfirmationEmail({ name, email, type: 'Media' }) + return { success: true } }, partnerships: async ({ request }) => { @@ -189,6 +245,8 @@ export const actions: Actions = { return fail(500, { message: result.message }) } + await sendConfirmationEmail({ name, email, type: 'Partnerships' }) + return { success: true } }, feedback: async ({ request }) => { @@ -214,6 +272,10 @@ export const actions: Actions = { return fail(500, { message: result.message }) } + if (email) { + await sendConfirmationEmail({ name, email, type: 'Feedback' }) + } + return { success: true } } } diff --git a/src/routes/contact-us/+page.svelte b/src/routes/contact-us/+page.svelte index d7ef8f2e..df0f768c 100644 --- a/src/routes/contact-us/+page.svelte +++ b/src/routes/contact-us/+page.svelte @@ -10,11 +10,10 @@ const { title, description } = meta - let activeTab: 'standard' | 'media' | 'partnerships' | 'feedback' = 'standard' + let activeTab: 'media' | 'partnerships' | 'feedback' = 'partnerships' let loading = false let formData = { - standard: { name: '', email: '', subject: '', message: '' }, media: { name: '', email: '', subject: '', organization: '', details: '' }, partnerships: { name: '', email: '', organization: '', subject: '', message: '' }, feedback: { name: '', email: '', subject: '', message: '' } @@ -57,14 +56,10 @@ }) => { loading = false if (result.type === 'success') { - toast.success( - "Thank you! We've received your message. We'll get back to you as soon as possible, usually within 3 to 4 working days." - ) + toast.success("Thank you! We've received your message.") // Clear the data for the successfully submitted tab - if (activeTab === 'standard') { - formData.standard = { name: '', email: '', subject: '', message: '' } - } else if (activeTab === 'media') { + if (activeTab === 'media') { formData.media = { name: '', email: '', subject: '', organization: '', details: '' } } else if (activeTab === 'partnerships') { formData.partnerships = { @@ -94,18 +89,15 @@

{title}

-

- Get in touch with the PauseAI team. As we are a small team, please allow 3 to 4 working days for - a response. -

+

Get in touch with the PauseAI team.

- - {:else if activeTab === 'partnerships'} -
-

- Interested in collaborating? Read about our partnership opportunities. -

-
-
- -
-
- -
-
- -
-
- -
-
- -
- -
-
{:else if activeTab === 'feedback'}