Skip to content

Commit

Permalink
Remove onboarding emails
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Jun 24, 2024
1 parent dd8d6ea commit 2ad4c24
Show file tree
Hide file tree
Showing 71 changed files with 57 additions and 1,144 deletions.
3 changes: 0 additions & 3 deletions apps/dashboard/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ GITHUB_TOKEN=
#Novu
NEXT_PUBLIC_NOVU_APPLICATION_IDENTIFIER=

UNSUBSCRIBE_JWT_SECRET=
UNSUBSCRIBE_JWT_ISSUER=

# Plain
PLAIN_API_KEY=

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/actions/ai/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
getUser,
} from "@midday/supabase/cached-queries";
import { Ratelimit } from "@upstash/ratelimit";
import { nanoid } from "ai";
import {
createAI,
createStreamableValue,
getMutableAIState,
streamUI,
} from "ai/rsc";
import { startOfMonth, subMonths } from "date-fns";
import { nanoid } from "nanoid";
import { headers } from "next/headers";
import { getAssistantSettings, saveChat } from "../storage";
import type { AIState, Chat, ClientMessage, UIState } from "../types";
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/actions/ai/chat/tools/burn-rate.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { MutableAIState } from "@/actions/ai/types";
import { calculateAvgBurnRate } from "@/utils/format";
import { getBurnRate, getRunway } from "@midday/supabase/cached-queries";
import { nanoid } from "ai";
import { startOfMonth } from "date-fns";
import { nanoid } from "nanoid";
import { z } from "zod";
import { BurnRateUI } from "./ui/burn-rate-ui";

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/actions/ai/chat/tools/forecast.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { MutableAIState } from "@/actions/ai/types";
import { getMetrics } from "@midday/supabase/cached-queries";
import { nanoid } from "ai";
import { generateText } from "ai";
import { startOfMonth } from "date-fns";
import { nanoid } from "nanoid";
import { z } from "zod";
import { selectModel } from "..";
import { ForecastUI } from "./ui/forecast-ui";
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/actions/ai/chat/tools/get-documents.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MutableAIState } from "@/actions/ai/types";
import { getInboxSearchQuery } from "@midday/supabase/queries";
import { createClient } from "@midday/supabase/server";
import { nanoid } from "ai";
import { nanoid } from "nanoid";
import { z } from "zod";
import { DocumentsUI } from "./ui/documents-ui";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MutableAIState } from "@/actions/ai/types";
import { getTransactions } from "@midday/supabase/cached-queries";
import { nanoid } from "ai";
import { nanoid } from "nanoid";
import { z } from "zod";
import { TransactionsUI } from "./ui/transactions-ui";

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/actions/ai/chat/tools/profit.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MutableAIState } from "@/actions/ai/types";
import { getMetrics } from "@midday/supabase/cached-queries";
import { nanoid } from "ai";
import { startOfMonth } from "date-fns";
import { nanoid } from "nanoid";
import { z } from "zod";
import { ProfitUI } from "./ui/profit-ui";

Expand Down
3 changes: 1 addition & 2 deletions apps/dashboard/src/actions/ai/chat/tools/report.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { MutableAIState } from "@/actions/ai/types";
import { createClient } from "@midday/supabase/server";
import { nanoid } from "ai";
import { startOfMonth } from "date-fns";
import { Dub } from "dub";
// import { nanoid } from "ai";
import { nanoid } from "nanoid";
import { z } from "zod";
import { ReportUI } from "./ui/report-ui";

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/actions/ai/chat/tools/revenue.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MutableAIState } from "@/actions/ai/types";
import { getMetrics } from "@midday/supabase/cached-queries";
import { nanoid } from "ai";
import { startOfMonth } from "date-fns";
import { nanoid } from "nanoid";
import { z } from "zod";
import { RevenueUI } from "./ui/revenue-ui";

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/actions/ai/chat/tools/runway.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MutableAIState } from "@/actions/ai/types";
import { getRunway } from "@midday/supabase/cached-queries";
import { nanoid } from "ai";
import { startOfMonth } from "date-fns";
import { nanoid } from "nanoid";
import { z } from "zod";
import { RunwayUI } from "./ui/runway-ui";

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/actions/ai/chat/tools/spending.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MutableAIState } from "@/actions/ai/types";
import { getSpending } from "@midday/supabase/cached-queries";
import { nanoid } from "ai";
import { startOfMonth } from "date-fns";
import { nanoid } from "nanoid";
import { z } from "zod";
import { SpendingUI } from "./ui/spending-ui";

Expand Down
5 changes: 5 additions & 0 deletions apps/dashboard/src/actions/delete-user-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import { setupAnalytics } from "@midday/events/server";
import { getUser } from "@midday/supabase/cached-queries";
import { deleteUser } from "@midday/supabase/mutations";
import { createClient } from "@midday/supabase/server";
import { LoopsClient } from "loops";
import { redirect } from "next/navigation";

const loops = new LoopsClient(process.env.LOOPS_API_KEY!);

export const deleteUserAction = async () => {
const supabase = createClient();
const user = await getUser();
Expand All @@ -27,6 +30,8 @@ export const deleteUserAction = async () => {

const userId = await deleteUser(supabase);

await loops.deleteContact({ userId });

const analytics = await setupAnalytics({
userId,
});
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/app/[locale]/(app)/(sidebar)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { setupAnalytics } from "@midday/events/server";
import { getCountryCode, isEUCountry } from "@midday/location";
import { currencies } from "@midday/location/src/currencies";
import { getUser } from "@midday/supabase/cached-queries";
import { nanoid } from "ai";
import { nanoid } from "nanoid";
import dynamic from "next/dynamic";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AI } from "@/actions/ai/chat";
import { Assistant } from "@/components/assistant";
import { getUser } from "@midday/supabase/cached-queries";
import { nanoid } from "ai";
import { nanoid } from "nanoid";

export default async function Page() {
const user = await getUser();
Expand Down

This file was deleted.

29 changes: 20 additions & 9 deletions apps/dashboard/src/app/api/webhook/registered/route.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import * as crypto from "node:crypto";
import { env } from "@/env.mjs";
import WelcomeEmail from "@midday/email/emails/welcome";
import { LogEvents } from "@midday/events/events";
import { setupAnalytics } from "@midday/events/server";
import { Events, client } from "@midday/jobs";
import { renderAsync } from "@react-email/components";
import { LoopsClient } from "loops";
import { nanoid } from "nanoid";
import { headers } from "next/headers";
import { NextResponse } from "next/server";
import { Resend } from "resend";

export const dynamic = "force-dynamic";

const loops = new LoopsClient(env.LOOPS_API_KEY);
const resend = new Resend(env.RESEND_API_KEY);

// NOTE: This is trigger from supabase database webhook
export async function POST(req: Request) {
Expand Down Expand Up @@ -52,14 +56,21 @@ export async function POST(req: Request) {
channel: LogEvents.Registered.channel,
});

await client.sendEvent({
id: userId,
name: Events.ONBOARDING_EMAILS,
payload: {
fullName,
email,
},
});
if (fullName) {
await resend.emails.send({
to: email,
subject: "Welcome to Midday",
from: "Pontus from Midday <[email protected]>",
html: await renderAsync(
WelcomeEmail({
fullName,
})
),
headers: {
"X-Entity-Ref-ID": nanoid(),
},
});
}

try {
const found = await loops.findContact(email);
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/components/assistant/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type { AI } from "@/actions/ai/chat";
import { getUIStateFromAIState } from "@/actions/ai/chat/utils";
import { getChat } from "@/actions/ai/storage";
import { Chat } from "@/components/chat";
import { nanoid } from "ai";
import { useAIState, useUIState } from "ai/rsc";
import { nanoid } from "nanoid";
import { useEffect, useState } from "react";
import { useHotkeys } from "react-hotkeys-hook";
import { AssistantFeedback } from "./feedback";
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export async function middleware(request: NextRequest) {
!session &&
newUrl.pathname !== "/login" &&
!newUrl.pathname.includes("/report") &&
!newUrl.pathname.includes("/unsubscribe") &&
!newUrl.pathname.includes("/setup")
) {
const encodedSearchParams = `${newUrl.pathname.substring(1)}${
Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed apps/website/public/email/get-started-connect.png
Binary file not shown.
Binary file removed apps/website/public/email/get-started-download.png
Binary file not shown.
Binary file not shown.
Binary file removed apps/website/public/email/get-started-header.png
Binary file not shown.
Binary file removed apps/website/public/email/get-started-invite.png
Binary file not shown.
Binary file removed apps/website/public/email/get-started-overview.png
Binary file not shown.
Binary file removed apps/website/public/email/inbox-email.png
Binary file not shown.
Binary file removed apps/website/public/email/inbox-export.png
Binary file not shown.
Binary file removed apps/website/public/email/inbox-mapping.png
Binary file not shown.
Binary file removed apps/website/public/email/logo-dark.png
Binary file not shown.
Binary file removed apps/website/public/email/logo-footer-dark.png
Binary file not shown.
Binary file not shown.
Binary file removed apps/website/public/email/magic-inbox-header.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed apps/website/public/email/pre-accounting-export.png
Binary file not shown.
Binary file not shown.
Binary file removed apps/website/public/email/pre-accounting-header.png
Binary file not shown.
Binary file removed apps/website/public/email/profit-loss.png
Binary file not shown.
Binary file removed apps/website/public/email/signature-dark.png
Binary file not shown.
Binary file removed apps/website/public/email/spending.png
Binary file not shown.
Binary file not shown.
Binary file removed apps/website/public/email/time-tracker-header.png
Binary file not shown.
Binary file removed apps/website/public/email/tracker-log.png
Diff not rendered.
Binary file removed apps/website/public/email/tracker-overview.png
Diff not rendered.
Binary file removed apps/website/public/email/tracker-project.png
Diff not rendered.
Binary file removed apps/website/public/email/vault-header-dark.png
Diff not rendered.
Binary file removed apps/website/public/email/vault-header.png
Diff not rendered.
Binary file removed apps/website/public/email/vault-overview.png
Diff not rendered.
Binary file removed apps/website/public/email/vault-structure.png
Diff not rendered.
Binary file removed apps/website/public/email/vault-upload.png
Diff not rendered.
Binary file modified bun.lockb
Binary file not shown.
37 changes: 10 additions & 27 deletions packages/email/components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import {
Section,
Text,
} from "@react-email/components";

import React from "react";
import { TripleColumn } from "responsive-react-email";

type Props = {
baseUrl?: string;
unsubscribeLink?: string;
};

export function Footer({ baseUrl, unsubscribeLink }: Props) {
export function Footer({ baseUrl }: Props) {
return (
<Section className="w-full">
<Hr />
Expand Down Expand Up @@ -275,29 +272,15 @@ export function Footer({ baseUrl, unsubscribeLink }: Props) {
</Text>
</Row>

{unsubscribeLink && (
<Row>
<Link
className="text-[#707070] text-[14px]"
href={unsubscribeLink}
title="Unsubscribe"
>
Unsubscribe
</Link>
</Row>
)}

{!unsubscribeLink && (
<Row>
<Link
className="text-[#707070] text-[14px]"
href="https://app.midday.ai/settings/notifications"
title="Unsubscribe"
>
Notification preferences
</Link>
</Row>
)}
<Row>
<Link
className="text-[#707070] text-[14px]"
href="https://app.midday.ai/settings/notifications"
title="Unsubscribe"
>
Notification preferences
</Link>
</Row>

<br />
<br />
Expand Down
1 change: 0 additions & 1 deletion packages/email/components/get-started.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Button, Section } from "@react-email/components";
import React from "react";

export function GetStarted() {
return (
Expand Down
7 changes: 5 additions & 2 deletions packages/email/components/logo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Img, Section } from "@react-email/components";
import React from "react";

export function Logo({ baseUrl }) {
type Props = {
baseUrl: string;
};

export function Logo({ baseUrl }: Props) {
return (
<Section className="mt-[32px]">
<Img
Expand Down
Loading

0 comments on commit 2ad4c24

Please sign in to comment.