feat: onboarding for existing users (#160)

* feat: onboarding for existing users

* fix: escape character

* chore: update msg
This commit is contained in:
Aslam
2024-09-10 22:05:28 +07:00
committed by GitHub
parent 00a2a53781
commit 0668dd5625
5 changed files with 219 additions and 0 deletions
+8
View File
@@ -1,6 +1,8 @@
"use server"
import { authedProcedure } from "@/lib/utils/auth-procedure"
import { currentUser } from "@clerk/nextjs/server"
import { get } from "ronin"
import { create } from "ronin"
import { z } from "zod"
import { ZSAError } from "zsa"
@@ -68,3 +70,9 @@ export const storeImage = authedProcedure
throw new ZSAError("ERROR", "Failed to store image")
}
})
export const isExistingUser = async () => {
const clerkUser = await currentUser()
const roninUser = await get.existingStripeSubscriber.with({ email: clerkUser?.emailAddresses[0].emailAddress })
return clerkUser?.emailAddresses[0].emailAddress === roninUser?.email
}
+2
View File
@@ -10,6 +10,7 @@ import { DeepLinkProvider } from "@/lib/providers/deep-link-provider"
import { GeistMono, GeistSans } from "./fonts"
import { JazzAndAuth } from "@/lib/providers/jazz-provider"
import { TooltipProvider } from "@/components/ui/tooltip"
import { LearnAnythingOnboarding } from "@/components/custom/learn-anything-onboarding"
export const metadata: Metadata = {
title: "Learn Anything",
@@ -42,6 +43,7 @@ export default function RootLayout({
<body className={cn("h-full w-full font-sans antialiased", GeistSans.variable, GeistMono.variable)}>
<Providers>
{children}
<LearnAnythingOnboarding />
<Toaster expand={false} />
</Providers>
</body>