Skip to main content

GravityRailConfig

@gravity-rail/react


@gravity-rail/react / GravityRailConfig

Interface: GravityRailConfig

@gravity-rail/react — canonical React components & hooks for embedding Gravity Rail (chat, forms, voice) into any site: built-in source sites or third-party hosts. Transport is pluggable via GravityRailProvider; the default is same-origin, which works in a sandboxed source-site bundle with zero config.

Properties​

apiUrl?​

optional apiUrl: string

Absolute API origin for cross-origin realtime transports (voice / operator WebSocket). Defaults to the injected site context's apiUrl.


baseUrl?​

optional baseUrl: string

API base URL. Default "" means same-origin (the Gravity Rail origin proxy or the host's own BFF). Set to an absolute origin only when calling a different origin directly (rare — prefer a same-origin proxy).


fetch()?​

optional fetch: (input, init?) => Promise<Response>

Custom fetch implementation. Use this on a third-party host to attach an Authorization header, rewrite paths to your BFF, etc. Defaults to the global fetch with same-origin credentials.

MDN Reference

Parameters​

input​

RequestInfo | URL

init?​

RequestInit

Returns​

Promise<Response>


getAccessToken()?​

optional getAccessToken: () => Promise<string>

Returns a short-lived access token for realtime WebSocket transports. On a source site this should hit a same-origin endpoint that mints the token from the site session; on a third-party host it returns your OAuth token.

Returns​

Promise<string>


siteContext?​

optional siteContext: SiteContext

Explicit site context. Defaults to window.GRAVITY_RAIL_SITE_CONTEXT.


workspaceUuid?​

optional workspaceUuid: string

Workspace UUID. Defaults to the injected site context's workspaceUuid.