Skip to content

Commit a2d4cb5

Browse files
Add option to hide thirdweb branding in bridge widgets
Co-authored-by: gregfromstl <[email protected]>
1 parent 2111b8b commit a2d4cb5

File tree

7 files changed

+72
-8
lines changed

7 files changed

+72
-8
lines changed

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: 8 additions & 1 deletion
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);
@@ -226,7 +233,7 @@ export function DirectPayment({
226233

227234
<Spacer y="md" />
228235

229-
<PoweredByThirdweb />
236+
{showThirdwebBranding && <PoweredByThirdweb />}
230237
<Spacer y="lg" />
231238
</Container>
232239
</WithHeader>

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

Lines changed: 8 additions & 1 deletion
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();
@@ -337,7 +344,7 @@ export function FundWallet({
337344

338345
<Spacer y="md" />
339346

340-
<PoweredByThirdweb />
347+
{showThirdwebBranding && <PoweredByThirdweb />}
341348
<Spacer y="lg" />
342349
</WithHeader>
343350
);

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,20 @@ export interface TransactionPaymentProps {
4848
* Connect options for wallet connection
4949
*/
5050
connectOptions?: PayEmbedConnectOptions;
51+
52+
/**
53+
* Whether to show thirdweb branding in the widget.
54+
* @default true
55+
*/
56+
showThirdwebBranding?: boolean;
5157
}
5258

5359
export function TransactionPayment({
5460
uiOptions,
5561
client,
5662
onContinue,
5763
connectOptions,
64+
showThirdwebBranding = true,
5865
}: TransactionPaymentProps) {
5966
const theme = useCustomTheme();
6067
const activeAccount = useActiveAccount();
@@ -123,7 +130,7 @@ export function TransactionPayment({
123130

124131
<Spacer y="md" />
125132

126-
<PoweredByThirdweb />
133+
{showThirdwebBranding && <PoweredByThirdweb />}
127134
<Spacer y="md" />
128135
</WithHeader>
129136
);
@@ -344,7 +351,7 @@ export function TransactionPayment({
344351

345352
<Spacer y="md" />
346353

347-
<PoweredByThirdweb />
354+
{showThirdwebBranding && <PoweredByThirdweb />}
348355
<Spacer y="lg" />
349356
</WithHeader>
350357
);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ export type TransactionWidgetProps = {
106106

107107
className?: string;
108108

109+
/**
110+
* Whether to show thirdweb branding in the widget.
111+
* @default true
112+
*/
113+
showThirdwebBranding?: boolean;
114+
109115
/**
110116
* The token address needed to complete this transaction. Leave undefined if no token is required.
111117
*/
@@ -413,6 +419,7 @@ export function TransactionWidget(props: TransactionWidgetProps) {
413419
purchaseData={props.purchaseData}
414420
receiverAddress={undefined}
415421
uiOptions={bridgeDataQuery.data.data}
422+
showThirdwebBranding={props.showThirdwebBranding}
416423
/>
417424
);
418425
}

0 commit comments

Comments
 (0)