Skip to content

Commit c155b3f

Browse files
authored
Merge branch 'main' into gi/update-text-supportpage
2 parents 92f1f85 + 45bb790 commit c155b3f

File tree

11 files changed

+906
-103
lines changed

11 files changed

+906
-103
lines changed

apps/dashboard/src/app/pay/[id]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getCurrencyMetadata } from "thirdweb/extensions/erc20";
44
import { checksumAddress } from "thirdweb/utils";
55
import { getPaymentLink } from "@/api/universal-bridge/links";
66
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
7-
import { PayPageEmbed } from "../components/client/PayPageEmbed.client";
7+
import { PayPageWidget } from "../components/client/PayPageWidget.client";
88

99
const title = "thirdweb Pay";
1010
const description = "Fast, secure, and simple payments.";
@@ -54,7 +54,7 @@ export default async function PayPage({
5454
};
5555

5656
return (
57-
<PayPageEmbed
57+
<PayPageWidget
5858
amount={paymentLink.amount ? BigInt(paymentLink.amount) : undefined}
5959
chainId={Number(paymentLink.destinationToken.chainId)}
6060
clientId={paymentLink.clientId}

apps/dashboard/src/app/pay/components/client/PayPageEmbed.client.tsx

Lines changed: 0 additions & 98 deletions
This file was deleted.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
"use client";
2+
import { payAppThirdwebClient } from "app/pay/constants";
3+
import { useTheme } from "next-themes";
4+
import { useEffect } from "react";
5+
import { createThirdwebClient, NATIVE_TOKEN_ADDRESS, toTokens } from "thirdweb";
6+
import { AutoConnect, CheckoutWidget } from "thirdweb/react";
7+
import { checksumAddress } from "thirdweb/utils";
8+
import { useV5DashboardChain } from "@/hooks/chains/v5-adapter";
9+
10+
export function PayPageWidget({
11+
chainId,
12+
recipientAddress,
13+
paymentLinkId,
14+
amount,
15+
token,
16+
name,
17+
image,
18+
redirectUri,
19+
theme,
20+
purchaseData,
21+
clientId,
22+
}: {
23+
chainId: number;
24+
recipientAddress: string;
25+
paymentLinkId?: string;
26+
amount?: bigint;
27+
token: { name: string; symbol: string; address: string; decimals: number };
28+
name?: string;
29+
image?: string;
30+
redirectUri?: string;
31+
clientId: string;
32+
theme?: "light" | "dark";
33+
purchaseData: Record<string, unknown> | undefined;
34+
}) {
35+
const { theme: browserTheme, setTheme } = useTheme();
36+
37+
// eslint-disable-next-line no-restricted-syntax
38+
useEffect(() => {
39+
if (theme) {
40+
setTheme(theme);
41+
}
42+
}, [theme, setTheme]);
43+
const chain = useV5DashboardChain(chainId);
44+
45+
return (
46+
<>
47+
<AutoConnect
48+
client={
49+
clientId ? createThirdwebClient({ clientId }) : payAppThirdwebClient
50+
}
51+
/>
52+
<CheckoutWidget
53+
amount={amount ? toTokens(amount, token.decimals) : "0"}
54+
chain={chain}
55+
client={
56+
clientId ? createThirdwebClient({ clientId }) : payAppThirdwebClient
57+
}
58+
image={image}
59+
name={name}
60+
onSuccess={() => {
61+
if (!redirectUri) return;
62+
const url = new URL(redirectUri);
63+
return window.open(url.toString());
64+
}}
65+
paymentLinkId={paymentLinkId}
66+
purchaseData={purchaseData}
67+
seller={checksumAddress(recipientAddress)}
68+
theme={theme ?? (browserTheme === "light" ? "light" : "dark")}
69+
tokenAddress={
70+
token.address === NATIVE_TOKEN_ADDRESS
71+
? undefined
72+
: checksumAddress(token.address)
73+
}
74+
/>
75+
</>
76+
);
77+
}

apps/dashboard/src/app/pay/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createThirdwebClient, defineChain, getContract } from "thirdweb";
33
import { getCurrencyMetadata } from "thirdweb/extensions/erc20";
44
import { checksumAddress } from "thirdweb/utils";
55
import { PaymentLinkForm } from "./components/client/PaymentLinkForm.client";
6-
import { PayPageEmbed } from "./components/client/PayPageEmbed.client";
6+
import { PayPageWidget } from "./components/client/PayPageWidget.client";
77
import type { PayParams } from "./components/types";
88
import { payAppThirdwebClient } from "./constants";
99

@@ -84,7 +84,7 @@ export default async function PayPage({
8484
};
8585

8686
return (
87-
<PayPageEmbed
87+
<PayPageWidget
8888
amount={BigInt(params.amount)}
8989
chainId={Number(params.chainId)}
9090
clientId={client.clientId}

apps/portal/src/app/dotnet/sidebar.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,30 @@ const walletActions: SidebarLink = (() => {
104104
href: `${parentSlug}/generateexternalloginlink`,
105105
name: "GenerateExternalLoginLink",
106106
},
107+
{
108+
href: `${parentSlug}/createsessionkey7702`,
109+
name: "CreateSessionKey (EIP-7702)",
110+
},
111+
{
112+
href: `${parentSlug}/signerhaspermissions7702`,
113+
name: "SignerHasFullPermissions",
114+
},
115+
{
116+
href: `${parentSlug}/getcallpolicies7702`,
117+
name: "GetCallPoliciesForSigner",
118+
},
119+
{
120+
href: `${parentSlug}/gettransferpolicies7702`,
121+
name: "GetTransferPoliciesForSigner",
122+
},
123+
{
124+
href: `${parentSlug}/getsessionexpiration7702`,
125+
name: "GetSessionExpirationForSigner",
126+
},
127+
{
128+
href: `${parentSlug}/getsessionstate7702`,
129+
name: "GetSessionStateForSigner",
130+
},
107131
],
108132
name: "InAppWallet & EcosystemWallet",
109133
},
@@ -116,7 +140,7 @@ const walletActions: SidebarLink = (() => {
116140
},
117141
{
118142
href: `${parentSlug}/createsessionkey`,
119-
name: "CreateSessionKey",
143+
name: "CreateSessionKey (EIP-4337)",
120144
},
121145
{
122146
href: `${parentSlug}/addadmin`,

0 commit comments

Comments
 (0)