+
+
+
+
+`;
diff --git a/src/routes/api/email/welcome/+server.js b/src/routes/api/email/welcome/+server.js
index 1bd10675..702b5f91 100644
--- a/src/routes/api/email/welcome/+server.js
+++ b/src/routes/api/email/welcome/+server.js
@@ -1,9 +1,10 @@
import { render } from 'svelte-email';
import { json } from '@sveltejs/kit';
-import WelcomeTemplate from './template.svelte';
import { getSendgrid, SENDGRID_FROM } from '$lib/utils/services/sendgrid';
import { getSupabase } from '$lib/utils/functions/supabase';
+import { sendEmail } from '$lib/utils/services/notification/send';
+
const sendgrid = getSendgrid();
const supabase = getSupabase();
@@ -28,19 +29,29 @@ export async function POST({ request }) {
return json({ success: false, message: 'Unauthenticated user' }, { status: 401 });
}
- const options = {
- from: SENDGRID_FROM,
+ await sendEmail({
to,
subject: 'Thank you so so so much for choosing ClassroomIO!',
- html: render({
- template: WelcomeTemplate,
- props: {
- name
- }
- })
- };
-
- sendgrid.send(options);
+ content: `
+
Dear ${name},
+
My name is Best the CEO of ClassroomIO and I will personally like to welcome to the vibrant community of ClassroomIO!
+
+ We're thrilled to have you join us in shaping the future of education. Your decision to embark on
+ this journey with us is deeply appreciated, and we're genuinely excited about the possibilities
+ that lie ahead.
+
+
+ Once again, welcome to the ClassroomIO family. We're here to help, to listen, and to celebrate
+ your successes. Get ready to unlock a world of possibilities in education!
+
+
+ If you have any question or face any issues just send me an email best@classroomio.com 😃
+
+ `
+ });
return json({
success: true,
diff --git a/src/routes/api/email/welcome/template.svelte b/src/routes/api/email/welcome/template.svelte
deleted file mode 100644
index aed13b4a..00000000
--- a/src/routes/api/email/welcome/template.svelte
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
diff --git a/src/routes/api/email/welcome/welcome.svelte b/src/routes/api/email/welcome/welcome.svelte
deleted file mode 100644
index 40149e0c..00000000
--- a/src/routes/api/email/welcome/welcome.svelte
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-Dear {name},
-Welcome to the vibrant community of ClassroomIO!
-
- We're thrilled to have you join us in shaping the future of education. Your decision to embark on
- this journey with us is deeply appreciated, and we're genuinely excited about the possibilities
- that lie ahead.
-
-
- At ClassroomIO, we understand the dedication and passion that educators like you bring to the
- table. That's why we've built a platform that's not only designed to make your teaching experience
- seamless but also to empower you to create transformative learning moments for your students.
-
-
- Your choice to use ClassroomIO is a testament to your commitment to innovation in education. It's
- educators like you who drive progress and inspire change, and we're here to support you every step
- of the way.
-
-
- Our team is working diligently behind the scenes, shipping new features and updates daily. This
- means you can expect a platform that's constantly evolving, adapting to your needs, and staying at
- the forefront of educational technology.
-
-
- We encourage you to explore ClassroomIO's range of features, from interactive quizzes and robust
- course management tools to collaborative forums and AI-integrated lesson planning. Your feedback
- is invaluable to us as we work together to refine and enhance these features to best suit your
- teaching style and objectives.
-
-
- Once again, welcome to the ClassroomIO family. We're here to help, to listen, and to celebrate
- your successes. Get ready to unlock a world of possibilities in education!
-
-
-
-
-Best regards
-Rotimi Best
-ClassroomIO
diff --git a/src/routes/onboarding/+page.svelte b/src/routes/onboarding/+page.svelte
index b30428f2..d6545576 100644
--- a/src/routes/onboarding/+page.svelte
+++ b/src/routes/onboarding/+page.svelte
@@ -10,9 +10,11 @@
import { blockedSubdomain } from '$lib/utils/constants/app';
import { welcomeModalStore } from '$lib/components/WelcomeModal/store';
import { getOrganizations } from '$lib/utils/services/org';
- import { sendWelcomeEmail } from './utils';
- import { currentOrg } from '$lib/utils/store/org';
import { generateSitename } from '$lib/utils/functions/org';
+ import {
+ triggerSendEmail,
+ NOTIFICATION_NAME
+ } from '$lib/utils/services/notification/notification';
interface OnboardingField {
fullname?: string;
@@ -182,7 +184,10 @@
loading = false;
if (fields.fullname) {
- sendWelcomeEmail($profile.email, fields.fullname);
+ triggerSendEmail(NOTIFICATION_NAME.WELCOME_TO_APP, {
+ to: $profile.email,
+ name: fields.fullname
+ });
}
console.log('data', data);
diff --git a/src/routes/onboarding/utils.ts b/src/routes/onboarding/utils.ts
deleted file mode 100644
index f0d5c16a..00000000
--- a/src/routes/onboarding/utils.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { supabase } from '$lib/utils/functions/supabase';
-
-export async function sendWelcomeEmail(to: string, name: string) {
- const { data } = await supabase.auth.getSession();
- const accessToken = data.session?.access_token || '';
-
- try {
- const response = await fetch('/api/email/welcome', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- Authorization: accessToken
- },
- body: JSON.stringify({
- to,
- name
- })
- });
- if (!response.ok) {
- throw new Error(await response.text());
- }
- const result = await response.json();
-
- console.log('Sent confirmation email', result);
- } catch (error) {
- console.error('Error sending confirmation email', error);
- }
-}