Skip to main content

GravityRailContextValue

@gravity-rail/react


@gravity-rail/react / GravityRailContextValue

Interface: GravityRailContextValue

@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​

apiBase​

apiBase: string

Resolved same-origin API base (config → site context → "").


apiPath()​

apiPath: (suffix) => string

Build a workspace-scoped API path: apiPath("/chats") → /api/v2/w/{uuid}/chats

Parameters​

suffix​

string

Returns​

string


config​

config: GravityRailConfig


fetch()​

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

Fetch a relative, same-origin path with credentials. (Standalone module-scope callers use the exported grFetch; the name differs to avoid shadowing the global fetch.)

Parameters​

path​

string

init?​

RequestInit

Returns​

Promise<Response>


getSetting()​

getSetting: <T>(key, fallback?) => T | undefined

Read a resolved theme setting (gravityrail.config.json).

Type Parameters​

T​

T = unknown

Parameters​

key​

string

fallback?​

T

Returns​

T | undefined


siteContext​

siteContext: SiteContext


workspaceUuid​

workspaceUuid: string | undefined

Resolved workspace UUID (config → site context).