Setup

Bridge’s React SDK is in beta! Expect breaking changes, bugs, and missing features. Please talk to us before integrating.

Configuration

API Keys, create a Publishable API Key from your Bridge Dashboard. These are not masked in the UI, and have a green check next to them.

BE CAREFUL - Do not use a secret API key in your frontend!

BridgeSdkProvider

This component must be rendered as a parent to any other Bridge components or hooks. The config input is defined as:

1interface BridgeSdkConfig {
2 /**
3 * Publishable Bridge API key
4 */
5 publishableKey: string
6 /**
7 * Logger implementation (optional)
8 */
9 logger?: Logger
10 /**
11 * Environment to use, defaults to "production"
12 */
13 environment?: "production" | "sandbox" | string
14}

In your layout.tsx, create a new BridgeLayoutProvider component. Inside, configure and render the children in the BridgeSdkProvider.

1const BridgeLayoutProvider = ({children}) => {
2 return (
3 <BridgeSdkProvider config={{ publishableKey: ******" }}>
4 {children}
5 </BridgeSdkProvider>
6 )
7}

To use the SDK in sandbox, set environment: "sandbox".

To attach your own logger, implement the Logger interface and provide one. Alternatively, attach the consoleLogger (exported from the SDK package), for debugging.