Skip to content

Commit ef9cf34

Browse files
committed
SDK: Delete Bridge Orchestrator, Refactor Bridge widget components (#8169)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR primarily focuses on refactoring and updating various components related to payment and transaction handling in the `thirdweb` library. It introduces new props, modifies existing interfaces, and cleans up the codebase by removing unused files. ### Detailed summary - Deleted several unused files related to payment and transaction handling. - Updated `transaction` and `payment` components to use new props and interfaces. - Replaced `type` definitions with `interface` in some components for consistency. - Improved error handling and state management in transaction modals. - Enhanced `SuccessScreen` and `UnsupportedTokenScreen` with new props for better UI. - Modified various story files to reflect component updates and new props. - Adjusted payment selection and fund wallet components to align with new data structures. > The following files were skipped due to too many changes: `packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx`, `packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx`, `packages/thirdweb/src/stories/Bridge/fixtures.ts`, `packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx`, `packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx`, `packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx`, `packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx`, `packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Optional fiat currency display across payment & transaction modals (defaults to USD). * Token support detection with a dedicated unsupported-token screen. * **Refactor** * Bridge flows reorganized into modular multi-step UIs (selection, quote, preview, execute, success). * Components now use explicit metadata (title/description/image) and explicit currency/mode props; branding handling centralized. * **Documentation** * Storybook reorganized: decorator-based theming, updated/added widget stories, and cleaned-up story exports. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent fd20a6c commit ef9cf34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2069
-3805
lines changed

apps/playground-web/src/app/payments/components/RightSection.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export function RightSection(props: {
8989
}
9090
name={props.options.payOptions.title || "Your Product Name"}
9191
paymentMethods={props.options.payOptions.paymentMethods}
92-
presetOptions={[1, 2, 3]}
9392
seller={props.options.payOptions.sellerAddress}
9493
theme={themeObj}
9594
tokenAddress={props.options.payOptions.buyTokenAddress}

packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as Bridge from "../../../../bridge/index.js";
66
import type { Chain } from "../../../../chains/types.js";
77
import type { BuyWithCryptoStatus } from "../../../../pay/buyWithCrypto/getStatus.js";
88
import type { BuyWithFiatStatus } from "../../../../pay/buyWithFiat/getStatus.js";
9+
import type { SupportedFiatCurrency } from "../../../../pay/convert/type.js";
910
import type { PurchaseData } from "../../../../pay/types.js";
1011
import type { FiatProvider } from "../../../../pay/utils/commonTypes.js";
1112
import type { GaslessOptions } from "../../../../transaction/actions/gasless/types.js";
@@ -94,6 +95,11 @@ export type SendTransactionPayModalConfig =
9495
* The user's ISO 3166 alpha-2 country code. This is used to determine onramp provider support.
9596
*/
9697
country?: string;
98+
/**
99+
* The currency to use for showing the fiat values
100+
* @default "USD"
101+
*/
102+
currency?: SupportedFiatCurrency;
97103
}
98104
| false;
99105

packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { getThirdwebBaseUrl } from "../../../utils/domains.js";
77
import { getClientFetch } from "../../../utils/fetch.js";
88
import { toTokens, toUnits } from "../../../utils/units.js";
99
import type { Wallet } from "../../../wallets/interfaces/wallet.js";
10-
import type { PaymentMethod } from "../machines/paymentMachine.js";
10+
import type { PaymentMethod } from "../../web/ui/Bridge/types.js";
1111
import type { SupportedTokens } from "../utils/defaultTokens.js";
1212
import { useActiveWallet } from "./wallets/useActiveWallet.js";
1313

@@ -33,15 +33,13 @@ export function usePaymentMethods(options: {
3333
destinationAmount: string;
3434
client: ThirdwebClient;
3535
payerWallet?: Wallet;
36-
includeDestinationToken?: boolean;
3736
supportedTokens?: SupportedTokens;
3837
}) {
3938
const {
4039
destinationToken,
4140
destinationAmount,
4241
client,
4342
payerWallet,
44-
includeDestinationToken,
4543
supportedTokens,
4644
} = options;
4745
const localWallet = useActiveWallet(); // TODO (bridge): get all connected wallets
@@ -135,7 +133,6 @@ export function usePaymentMethods(options: {
135133
destinationToken.address,
136134
destinationAmount,
137135
payerWallet?.getAccount()?.address,
138-
includeDestinationToken,
139136
supportedTokens,
140137
], // 5 minutes
141138
refetchOnWindowFocus: false,

0 commit comments

Comments
 (0)