Skip to content

Commit 7d667c9

Browse files
committed
Update support page with nebula chat components
1 parent f0dce0a commit 7d667c9

File tree

6 files changed

+58
-120
lines changed

6 files changed

+58
-120
lines changed

.env.example

Lines changed: 0 additions & 7 deletions
This file was deleted.

apps/dashboard/.env.example

Lines changed: 0 additions & 107 deletions
This file was deleted.

apps/dashboard/src/app/(app)/(dashboard)/support/page.tsx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import contractsIcon from "../../../../../public/assets/support/contracts.png";
99
import engineIcon from "../../../../../public/assets/support/engine.png";
1010
import miscIcon from "../../../../../public/assets/support/misc.svg";
1111
import connectIcon from "../../../../../public/assets/support/wallets.png";
12+
import { NebulaFloatingChatButton } from "../../../nebula-app/(app)/components/FloatingChat/FloatingChat";
13+
import {
14+
getAuthToken,
15+
getAuthTokenWalletAddress,
16+
} from "../../api/lib/getAuthToken";
17+
import { getThirdwebClient } from "@/constants/thirdweb.server";
1218

1319
export const metadata: Metadata = {
1420
title: "thirdweb Support",
@@ -112,7 +118,25 @@ const HELP_PRODUCTS = [
112118
},
113119
] as const;
114120

115-
export default function SupportPage() {
121+
export default async function SupportPage() {
122+
const [authToken, accountAddress] = await Promise.all([
123+
getAuthToken(),
124+
getAuthTokenWalletAddress(),
125+
]);
126+
127+
const client = getThirdwebClient({
128+
jwt: authToken,
129+
teamId: undefined,
130+
});
131+
132+
const supportPromptPrefix = "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: ";
133+
const examplePrompts = [
134+
"ERC20 - Transfer Amount Exceeds Allowance",
135+
"Replacement transaction underpriced / Replacement fee too low",
136+
"Nonce too low: next nonce #, tx nonce #",
137+
"Nonce too high"
138+
];
139+
116140
return (
117141
<main className="flex flex-col gap-12 pb-12">
118142
<div className="bg-gradient-to-b from-card/0 to-card py-20">
@@ -185,6 +209,22 @@ export default function SupportPage() {
185209
))}
186210
</div>
187211
</section>
212+
213+
<NebulaFloatingChatButton
214+
pageType="support"
215+
authToken={authToken ?? undefined}
216+
label="Ask AI about your issue"
217+
client={client}
218+
nebulaParams={{
219+
messagePrefix: supportPromptPrefix,
220+
chainIds: [],
221+
wallet: accountAddress ?? undefined,
222+
}}
223+
examplePrompts={examplePrompts.map((prompt) => ({
224+
title: prompt,
225+
message: prompt,
226+
}))}
227+
/>
188228
</main>
189229
);
190230
}

apps/dashboard/src/app/nebula-app/(app)/components/ChatBar.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
import { shortenAddress } from "thirdweb/utils";
3636
import type { Wallet } from "thirdweb/wallets";
3737
import type { NebulaContext } from "../api/chat";
38+
import Link from "next/link";
3839

3940
export type WalletMeta = {
4041
walletId: Wallet["id"];
@@ -55,6 +56,7 @@ export function ChatBar(props: {
5556
activeAccountAddress: string | undefined;
5657
setActiveWallet: (wallet: WalletMeta) => void;
5758
isConnectingWallet: boolean;
59+
includeSupportButton: boolean;
5860
}) {
5961
const [message, setMessage] = useState(props.prefillMessage || "");
6062
const selectedChainIds = props.context?.chainIds?.map((x) => Number(x)) || [];
@@ -173,7 +175,16 @@ export function ChatBar(props: {
173175
</div>
174176
)}
175177
</div>
176-
178+
{props.includeSupportButton && (
179+
<Button
180+
variant="default"
181+
className="!h-auto w-auto shrink-0 gap-2 p-2"
182+
>
183+
<Link href="/support/create-ticket">
184+
Create Support Ticket
185+
</Link>
186+
</Button>
187+
)}
177188
{/* Send / Stop */}
178189
{props.isChatStreaming ? (
179190
<Button

apps/dashboard/src/app/nebula-app/(app)/components/FloatingChat/FloatingChat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { NebulaIcon } from "../../icons/NebulaIcon";
2222
const LazyFloatingChatContent = lazy(() => import("./FloatingChatContent"));
2323

2424
export function NebulaFloatingChatButton(props: {
25-
pageType: "chain" | "contract";
25+
pageType: "chain" | "contract" | "support";
2626
authToken: string | undefined;
2727
examplePrompts: ExamplePrompt[];
2828
label: string;
@@ -104,7 +104,7 @@ function NebulaChatUIContainer(props: {
104104
hasBeenOpened: boolean;
105105
authToken: string | undefined;
106106
examplePrompts: ExamplePrompt[];
107-
pageType: "chain" | "contract";
107+
pageType: "chain" | "contract" | "support";
108108
client: ThirdwebClient;
109109
nebulaParams:
110110
| {

apps/dashboard/src/app/nebula-app/(app)/components/FloatingChat/FloatingChatContent.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function FloatingChatContent(props: {
2525
authToken: string | undefined;
2626
client: ThirdwebClient;
2727
examplePrompts: ExamplePrompt[];
28-
pageType: "chain" | "contract";
28+
pageType: "chain" | "contract" | "support";
2929
nebulaParams:
3030
| {
3131
messagePrefix: string;
@@ -52,7 +52,7 @@ export default function FloatingChatContent(props: {
5252
function FloatingChatContentLoggedIn(props: {
5353
authToken: string;
5454
client: ThirdwebClient;
55-
pageType: "chain" | "contract";
55+
pageType: "chain" | "contract" | "support";
5656
examplePrompts: ExamplePrompt[];
5757
nebulaParams:
5858
| {
@@ -222,6 +222,7 @@ function FloatingChatContentLoggedIn(props: {
222222
isChatStreaming={isChatStreaming}
223223
prefillMessage=""
224224
sendMessage={handleSendMessage}
225+
includeSupportButton={props.pageType === "support"}
225226
className="rounded-none border-x-0 border-b-0"
226227
/>
227228
</div>

0 commit comments

Comments
 (0)