11import { Button } from "@/components/ui/button" ;
22import { Card , CardContent , CardHeader , CardTitle } from "@/components/ui/card" ;
3+ import { getThirdwebClient } from "@/constants/thirdweb.server" ;
4+ import { NebulaIcon } from "app/nebula-app/(app)/icons/NebulaIcon" ;
35import { BookOpenIcon , ChevronRightIcon } from "lucide-react" ;
46import type { Metadata } from "next" ;
57import Image from "next/image" ;
@@ -9,6 +11,11 @@ import contractsIcon from "../../../../../public/assets/support/contracts.png";
911import engineIcon from "../../../../../public/assets/support/engine.png" ;
1012import miscIcon from "../../../../../public/assets/support/misc.svg" ;
1113import connectIcon from "../../../../../public/assets/support/wallets.png" ;
14+ import { NebulaFloatingChatButton } from "../../../nebula-app/(app)/components/FloatingChat/FloatingChat" ;
15+ import {
16+ getAuthToken ,
17+ getAuthTokenWalletAddress ,
18+ } from "../../api/lib/getAuthToken" ;
1219
1320export const metadata : Metadata = {
1421 title : "thirdweb Support" ,
@@ -112,7 +119,26 @@ const HELP_PRODUCTS = [
112119 } ,
113120] as const ;
114121
115- export default function SupportPage ( ) {
122+ export default async function SupportPage ( ) {
123+ const [ authToken , accountAddress ] = await Promise . all ( [
124+ getAuthToken ( ) ,
125+ getAuthTokenWalletAddress ( ) ,
126+ ] ) ;
127+
128+ const client = getThirdwebClient ( {
129+ jwt : authToken ,
130+ teamId : undefined ,
131+ } ) ;
132+
133+ const supportPromptPrefix =
134+ "You are a Customer Success Agent at thirdweb, assisting customers with blockchain and Web3-related issues. Use the following details to craft a professional, empathetic response: " ;
135+ const examplePrompts = [
136+ "ERC20 - Transfer Amount Exceeds Allowance" ,
137+ "Replacement transaction underpriced / Replacement fee too low" ,
138+ "Nonce too low: next nonce #, tx nonce #" ,
139+ "Nonce too high" ,
140+ ] ;
141+
116142 return (
117143 < main className = "flex flex-col gap-12 pb-12" >
118144 < div className = "bg-gradient-to-b from-card/0 to-card py-20" >
@@ -127,12 +153,31 @@ export default function SupportPage() {
127153 How can we help?
128154 </ h1 >
129155 < p className = "text-center text-lg text-muted-foreground" >
130- Our dedicated support team is here to help you with any questions
131- or issues you may have. Contact us today and let us assist you.
156+ Get instant answers with Nebula AI, our onchain support assistant.
157+ Still need help? You can also create a support case to reach our
158+ team.
132159 </ p >
133- < Button variant = "default" className = "mt-6" size = "lg" asChild >
134- < Link href = "/support/create-ticket" > Get Support</ Link >
135- </ Button >
160+ { /* biome-ignore lint/nursery/useSortedClasses: <explanation> */ }
161+ < div className = "mt-6 w-full flex flex-col items-center gap-3" >
162+ < Button
163+ variant = "default"
164+ className = "gap-2 rounded-full"
165+ size = "default"
166+ >
167+ < NebulaIcon className = "size-4" />
168+ Ask Nebula AI for support
169+ </ Button >
170+
171+ < Link
172+ href = "/support/create-ticket"
173+ target = "_blank"
174+ rel = "noreferrer"
175+ // biome-ignore lint/nursery/useSortedClasses: <explanation>
176+ className = "text-sm text-muted-foreground hover:underline"
177+ >
178+ Open a support case
179+ </ Link >
180+ </ div >
136181 </ div >
137182 </ header >
138183 </ div >
@@ -185,6 +230,22 @@ export default function SupportPage() {
185230 ) ) }
186231 </ div >
187232 </ section >
233+
234+ < NebulaFloatingChatButton
235+ pageType = "support"
236+ authToken = { authToken ?? undefined }
237+ label = "Ask Nebula AI for support"
238+ client = { client }
239+ nebulaParams = { {
240+ messagePrefix : supportPromptPrefix ,
241+ chainIds : [ ] ,
242+ wallet : accountAddress ?? undefined ,
243+ } }
244+ examplePrompts = { examplePrompts . map ( ( prompt ) => ( {
245+ title : prompt ,
246+ message : prompt ,
247+ } ) ) }
248+ />
188249 </ main >
189250 ) ;
190251}
0 commit comments