Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hip-mammals-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Adds the ability to hide thirdweb branding in the payment widgets with showThirdwebBranding
2 changes: 2 additions & 0 deletions apps/playground-web/src/app/connect/pay/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ export type BridgeComponentsPlaygroundOptions = {
transactionData?: string; // Simplified for demo; could be more complex in real implementation

paymentMethods: ("crypto" | "card")[];

showThirdwebBranding: boolean;
};
};
17 changes: 17 additions & 0 deletions apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,23 @@ export function LeftSection(props: {
}}
theme={options.theme}
/>

<div className="my-4 flex items-center gap-2">
<Checkbox
checked={payOptions.showThirdwebBranding}
id={"branding"}
onCheckedChange={(checked) => {
setOptions((v) => ({
...v,
payOptions: {
...v.payOptions,
showThirdwebBranding: checked === true,
},
}));
}}
/>
<Label htmlFor={"branding"}>Show Branding</Label>
</div>
</CollapsibleSection>

<CollapsibleSection icon={FuelIcon} title="Sponsor gas fees">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function RightSection(props: {
theme={themeObj}
title={props.options.payOptions.title}
tokenAddress={props.options.payOptions.buyTokenAddress}
showThirdwebBranding={props.options.payOptions.showThirdwebBranding}
/>
);
}
Expand All @@ -87,6 +88,7 @@ export function RightSection(props: {
seller={props.options.payOptions.sellerAddress}
theme={themeObj}
tokenAddress={props.options.payOptions.buyTokenAddress}
showThirdwebBranding={props.options.payOptions.showThirdwebBranding}
/>
);
}
Expand All @@ -106,6 +108,7 @@ export function RightSection(props: {
to: account?.address || "",
tokenId: 2n,
})}
showThirdwebBranding={props.options.payOptions.showThirdwebBranding}
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions apps/playground-web/src/app/connect/pay/embed/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const defaultConnectOptions: BridgeComponentsPlaygroundOptions = {
title: "",
transactionData: "",
widget: "buy",
showThirdwebBranding: true,
},
theme: {
darkColorOverrides: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
* @default ["crypto", "card"]
*/
paymentMethods?: ("crypto" | "card")[];

/**
* Whether to show thirdweb branding in the widget.
* @default true
*/
showThirdwebBranding?: boolean;
}

export function BridgeOrchestrator({
Expand All @@ -135,6 +141,7 @@
paymentLinkId,
presetOptions,
paymentMethods = ["crypto", "card"],
showThirdwebBranding = true,

Check warning on line 144 in packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L144 was not covered by tests
}: BridgeOrchestratorProps) {
// Initialize adapters
const adapters = useMemo(
Expand All @@ -145,6 +152,18 @@
[],
);

// Create modified connect options with branding setting
const modifiedConnectOptions = useMemo(() => {
if (!connectOptions) return undefined;
return {
...connectOptions,
connectModal: {
...connectOptions.connectModal,
showThirdwebBranding,
},
};
}, [connectOptions, showThirdwebBranding]);

Check warning on line 165 in packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx#L156-L165

Added lines #L156 - L165 were not covered by tests

// Use the payment machine hook
const [state, send] = usePaymentMachine(adapters, uiOptions.mode);

Expand Down Expand Up @@ -239,28 +258,31 @@
{state.value === "init" && uiOptions.mode === "fund_wallet" && (
<FundWallet
client={client}
connectOptions={connectOptions}
connectOptions={modifiedConnectOptions}

Check warning on line 261 in packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L261 was not covered by tests
onContinue={handleRequirementsResolved}
presetOptions={presetOptions}
receiverAddress={receiverAddress}
showThirdwebBranding={showThirdwebBranding}

Check warning on line 265 in packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L265 was not covered by tests
uiOptions={uiOptions}
/>
)}

{state.value === "init" && uiOptions.mode === "direct_payment" && (
<DirectPayment
client={client}
connectOptions={connectOptions}
connectOptions={modifiedConnectOptions}

Check warning on line 273 in packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L273 was not covered by tests
onContinue={handleRequirementsResolved}
showThirdwebBranding={showThirdwebBranding}

Check warning on line 275 in packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L275 was not covered by tests
uiOptions={uiOptions}
/>
)}

{state.value === "init" && uiOptions.mode === "transaction" && (
<TransactionPayment
client={client}
connectOptions={connectOptions}
connectOptions={modifiedConnectOptions}

Check warning on line 283 in packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L283 was not covered by tests
onContinue={handleRequirementsResolved}
showThirdwebBranding={showThirdwebBranding}

Check warning on line 285 in packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L285 was not covered by tests
uiOptions={uiOptions}
/>
)}
Expand All @@ -272,7 +294,7 @@
<PaymentSelection
client={client}
connectLocale={connectLocale || en}
connectOptions={connectOptions}
connectOptions={modifiedConnectOptions}

Check warning on line 297 in packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L297 was not covered by tests
destinationAmount={state.context.destinationAmount}
destinationToken={state.context.destinationToken}
feePayer={
Expand Down
7 changes: 7 additions & 0 deletions packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@

className?: string;

/**
* Whether to show thirdweb branding in the widget.
* @default true
*/
showThirdwebBranding?: boolean;

/**
* The chain the accepted token is on.
*/
Expand Down Expand Up @@ -391,6 +397,7 @@
purchaseData={props.purchaseData}
receiverAddress={undefined}
uiOptions={bridgeDataQuery.data.data}
showThirdwebBranding={props.showThirdwebBranding}

Check warning on line 400 in packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L400 was not covered by tests
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@

className?: string;

/**
* Whether to show thirdweb branding in the widget.
* @default true
*/
showThirdwebBranding?: boolean;

/**
* The chain the accepted token is on.
*/
Expand Down Expand Up @@ -353,6 +359,7 @@
presetOptions={props.presetOptions}
purchaseData={props.purchaseData}
receiverAddress={props.seller}
showThirdwebBranding={props.showThirdwebBranding}

Check warning on line 362 in packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L362 was not covered by tests
uiOptions={bridgeDataQuery.data.data}
/>
);
Expand Down
16 changes: 13 additions & 3 deletions packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,20 @@
* Connect options for wallet connection
*/
connectOptions?: PayEmbedConnectOptions;

/**
* Whether to show thirdweb branding in the widget.
* @default true
*/
showThirdwebBranding?: boolean;
}

export function DirectPayment({
uiOptions,
client,
onContinue,
connectOptions,
showThirdwebBranding = true,

Check warning on line 55 in packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L55 was not covered by tests
}: DirectPaymentProps) {
const activeAccount = useActiveAccount();
const chain = defineChain(uiOptions.paymentInfo.token.chainId);
Expand Down Expand Up @@ -224,9 +231,12 @@
/>
)}

<Spacer y="md" />

<PoweredByThirdweb />
{showThirdwebBranding ? (
<div>
<Spacer y="md" />
<PoweredByThirdweb />
</div>
) : null}

Check warning on line 239 in packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx#L234-L239

Added lines #L234 - L239 were not covered by tests
<Spacer y="lg" />
</Container>
</WithHeader>
Expand Down
16 changes: 13 additions & 3 deletions packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
* Connect options for wallet connection
*/
connectOptions?: PayEmbedConnectOptions;

/**
* Whether to show thirdweb branding in the widget.
* @default true
*/
showThirdwebBranding?: boolean;
}

export function FundWallet({
Expand All @@ -65,6 +71,7 @@
onContinue,
presetOptions = [5, 10, 20],
connectOptions,
showThirdwebBranding = true,

Check warning on line 74 in packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L74 was not covered by tests
}: FundWalletProps) {
const [amount, setAmount] = useState(uiOptions.initialAmount ?? "");
const theme = useCustomTheme();
Expand Down Expand Up @@ -335,9 +342,12 @@
/>
)}

<Spacer y="md" />

<PoweredByThirdweb />
{showThirdwebBranding ? (
<div>
<Spacer y="md" />
<PoweredByThirdweb />
</div>
) : null}

Check warning on line 350 in packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx#L345-L350

Added lines #L345 - L350 were not covered by tests
<Spacer y="lg" />
</WithHeader>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,20 @@
* Connect options for wallet connection
*/
connectOptions?: PayEmbedConnectOptions;

/**
* Whether to show thirdweb branding in the widget.
* @default true
*/
showThirdwebBranding?: boolean;
}

export function TransactionPayment({
uiOptions,
client,
onContinue,
connectOptions,
showThirdwebBranding = true,

Check warning on line 64 in packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L64 was not covered by tests
}: TransactionPaymentProps) {
const theme = useCustomTheme();
const activeAccount = useActiveAccount();
Expand Down Expand Up @@ -121,10 +128,13 @@
}}
/>

<Spacer y="md" />

<PoweredByThirdweb />
<Spacer y="md" />
{showThirdwebBranding ? (
<div>
<Spacer y="md" />
<PoweredByThirdweb />
<Spacer y="md" />
</div>
) : null}

Check warning on line 137 in packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx#L131-L137

Added lines #L131 - L137 were not covered by tests
</WithHeader>
);
}
Expand Down Expand Up @@ -342,9 +352,12 @@
/>
)}

<Spacer y="md" />

<PoweredByThirdweb />
{showThirdwebBranding ? (
<div>
<Spacer y="md" />
<PoweredByThirdweb />
</div>
) : null}

Check warning on line 360 in packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx#L355-L360

Added lines #L355 - L360 were not covered by tests
<Spacer y="lg" />
</WithHeader>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@

className?: string;

/**
* Whether to show thirdweb branding in the widget.
* @default true
*/
showThirdwebBranding?: boolean;

/**
* The token address needed to complete this transaction. Leave undefined if no token is required.
*/
Expand Down Expand Up @@ -413,6 +419,7 @@
purchaseData={props.purchaseData}
receiverAddress={undefined}
uiOptions={bridgeDataQuery.data.data}
showThirdwebBranding={props.showThirdwebBranding}

Check warning on line 422 in packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L422 was not covered by tests
/>
);
}
Expand Down
Loading