Skip to content

Commit bfd728a

Browse files
Add branding hide prop to widgets (#7575)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 381a282 commit bfd728a

File tree

12 files changed

+121
-17
lines changed

12 files changed

+121
-17
lines changed

.changeset/hip-mammals-sip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Adds the ability to hide thirdweb branding in the payment widgets with showThirdwebBranding

apps/playground-web/src/app/connect/pay/components/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ export type BridgeComponentsPlaygroundOptions = {
2525
transactionData?: string; // Simplified for demo; could be more complex in real implementation
2626

2727
paymentMethods: ("crypto" | "card")[];
28+
29+
showThirdwebBranding: boolean;
2830
};
2931
};

apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,23 @@ export function LeftSection(props: {
464464
}}
465465
theme={options.theme}
466466
/>
467+
468+
<div className="my-4 flex items-center gap-2">
469+
<Checkbox
470+
checked={payOptions.showThirdwebBranding}
471+
id={"branding"}
472+
onCheckedChange={(checked) => {
473+
setOptions((v) => ({
474+
...v,
475+
payOptions: {
476+
...v.payOptions,
477+
showThirdwebBranding: checked === true,
478+
},
479+
}));
480+
}}
481+
/>
482+
<Label htmlFor={"branding"}>Show Branding</Label>
483+
</div>
467484
</CollapsibleSection>
468485

469486
<CollapsibleSection icon={FuelIcon} title="Sponsor gas fees">

apps/playground-web/src/app/connect/pay/embed/RightSection.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export function RightSection(props: {
6464
theme={themeObj}
6565
title={props.options.payOptions.title}
6666
tokenAddress={props.options.payOptions.buyTokenAddress}
67+
showThirdwebBranding={props.options.payOptions.showThirdwebBranding}
6768
/>
6869
);
6970
}
@@ -87,6 +88,7 @@ export function RightSection(props: {
8788
seller={props.options.payOptions.sellerAddress}
8889
theme={themeObj}
8990
tokenAddress={props.options.payOptions.buyTokenAddress}
91+
showThirdwebBranding={props.options.payOptions.showThirdwebBranding}
9092
/>
9193
);
9294
}
@@ -106,6 +108,7 @@ export function RightSection(props: {
106108
to: account?.address || "",
107109
tokenId: 2n,
108110
})}
111+
showThirdwebBranding={props.options.payOptions.showThirdwebBranding}
109112
/>
110113
);
111114
}

apps/playground-web/src/app/connect/pay/embed/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const defaultConnectOptions: BridgeComponentsPlaygroundOptions = {
1818
title: "",
1919
transactionData: "",
2020
widget: "buy",
21+
showThirdwebBranding: true,
2122
},
2223
theme: {
2324
darkColorOverrides: {},

packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ export interface BridgeOrchestratorProps {
120120
* @default ["crypto", "card"]
121121
*/
122122
paymentMethods?: ("crypto" | "card")[];
123+
124+
/**
125+
* Whether to show thirdweb branding in the widget.
126+
* @default true
127+
*/
128+
showThirdwebBranding?: boolean;
123129
}
124130

125131
export function BridgeOrchestrator({
@@ -135,6 +141,7 @@ export function BridgeOrchestrator({
135141
paymentLinkId,
136142
presetOptions,
137143
paymentMethods = ["crypto", "card"],
144+
showThirdwebBranding = true,
138145
}: BridgeOrchestratorProps) {
139146
// Initialize adapters
140147
const adapters = useMemo(
@@ -145,6 +152,18 @@ export function BridgeOrchestrator({
145152
[],
146153
);
147154

155+
// Create modified connect options with branding setting
156+
const modifiedConnectOptions = useMemo(() => {
157+
if (!connectOptions) return undefined;
158+
return {
159+
...connectOptions,
160+
connectModal: {
161+
...connectOptions.connectModal,
162+
showThirdwebBranding,
163+
},
164+
};
165+
}, [connectOptions, showThirdwebBranding]);
166+
148167
// Use the payment machine hook
149168
const [state, send] = usePaymentMachine(adapters, uiOptions.mode);
150169

@@ -239,28 +258,31 @@ export function BridgeOrchestrator({
239258
{state.value === "init" && uiOptions.mode === "fund_wallet" && (
240259
<FundWallet
241260
client={client}
242-
connectOptions={connectOptions}
261+
connectOptions={modifiedConnectOptions}
243262
onContinue={handleRequirementsResolved}
244263
presetOptions={presetOptions}
245264
receiverAddress={receiverAddress}
265+
showThirdwebBranding={showThirdwebBranding}
246266
uiOptions={uiOptions}
247267
/>
248268
)}
249269

250270
{state.value === "init" && uiOptions.mode === "direct_payment" && (
251271
<DirectPayment
252272
client={client}
253-
connectOptions={connectOptions}
273+
connectOptions={modifiedConnectOptions}
254274
onContinue={handleRequirementsResolved}
275+
showThirdwebBranding={showThirdwebBranding}
255276
uiOptions={uiOptions}
256277
/>
257278
)}
258279

259280
{state.value === "init" && uiOptions.mode === "transaction" && (
260281
<TransactionPayment
261282
client={client}
262-
connectOptions={connectOptions}
283+
connectOptions={modifiedConnectOptions}
263284
onContinue={handleRequirementsResolved}
285+
showThirdwebBranding={showThirdwebBranding}
264286
uiOptions={uiOptions}
265287
/>
266288
)}
@@ -272,7 +294,7 @@ export function BridgeOrchestrator({
272294
<PaymentSelection
273295
client={client}
274296
connectLocale={connectLocale || en}
275-
connectOptions={connectOptions}
297+
connectOptions={modifiedConnectOptions}
276298
destinationAmount={state.context.destinationAmount}
277299
destinationToken={state.context.destinationToken}
278300
feePayer={

packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ export type BuyWidgetProps = {
102102

103103
className?: string;
104104

105+
/**
106+
* Whether to show thirdweb branding in the widget.
107+
* @default true
108+
*/
109+
showThirdwebBranding?: boolean;
110+
105111
/**
106112
* The chain the accepted token is on.
107113
*/
@@ -391,6 +397,7 @@ export function BuyWidget(props: BuyWidgetProps) {
391397
purchaseData={props.purchaseData}
392398
receiverAddress={undefined}
393399
uiOptions={bridgeDataQuery.data.data}
400+
showThirdwebBranding={props.showThirdwebBranding}
394401
/>
395402
);
396403
}

packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ export type CheckoutWidgetProps = {
9898

9999
className?: string;
100100

101+
/**
102+
* Whether to show thirdweb branding in the widget.
103+
* @default true
104+
*/
105+
showThirdwebBranding?: boolean;
106+
101107
/**
102108
* The chain the accepted token is on.
103109
*/
@@ -353,6 +359,7 @@ export function CheckoutWidget(props: CheckoutWidgetProps) {
353359
presetOptions={props.presetOptions}
354360
purchaseData={props.purchaseData}
355361
receiverAddress={props.seller}
362+
showThirdwebBranding={props.showThirdwebBranding}
356363
uiOptions={bridgeDataQuery.data.data}
357364
/>
358365
);

packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,20 @@ export interface DirectPaymentProps {
3939
* Connect options for wallet connection
4040
*/
4141
connectOptions?: PayEmbedConnectOptions;
42+
43+
/**
44+
* Whether to show thirdweb branding in the widget.
45+
* @default true
46+
*/
47+
showThirdwebBranding?: boolean;
4248
}
4349

4450
export function DirectPayment({
4551
uiOptions,
4652
client,
4753
onContinue,
4854
connectOptions,
55+
showThirdwebBranding = true,
4956
}: DirectPaymentProps) {
5057
const activeAccount = useActiveAccount();
5158
const chain = defineChain(uiOptions.paymentInfo.token.chainId);
@@ -224,9 +231,12 @@ export function DirectPayment({
224231
/>
225232
)}
226233

227-
<Spacer y="md" />
228-
229-
<PoweredByThirdweb />
234+
{showThirdwebBranding ? (
235+
<div>
236+
<Spacer y="md" />
237+
<PoweredByThirdweb />
238+
</div>
239+
) : null}
230240
<Spacer y="lg" />
231241
</Container>
232242
</WithHeader>

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ export interface FundWalletProps {
5656
* Connect options for wallet connection
5757
*/
5858
connectOptions?: PayEmbedConnectOptions;
59+
60+
/**
61+
* Whether to show thirdweb branding in the widget.
62+
* @default true
63+
*/
64+
showThirdwebBranding?: boolean;
5965
}
6066

6167
export function FundWallet({
@@ -65,6 +71,7 @@ export function FundWallet({
6571
onContinue,
6672
presetOptions = [5, 10, 20],
6773
connectOptions,
74+
showThirdwebBranding = true,
6875
}: FundWalletProps) {
6976
const [amount, setAmount] = useState(uiOptions.initialAmount ?? "");
7077
const theme = useCustomTheme();
@@ -335,9 +342,12 @@ export function FundWallet({
335342
/>
336343
)}
337344

338-
<Spacer y="md" />
339-
340-
<PoweredByThirdweb />
345+
{showThirdwebBranding ? (
346+
<div>
347+
<Spacer y="md" />
348+
<PoweredByThirdweb />
349+
</div>
350+
) : null}
341351
<Spacer y="lg" />
342352
</WithHeader>
343353
);

0 commit comments

Comments
 (0)