Every export of @epilot/spark-sdk at a glance.
A complete map of the public surface. Follow the links for usage and examples.
| Export | Signature | Description |
|---|
initialize | (options?: InitOptions) => Promise<SparkSession> | Connect to the parent portal; resolves to the session. Idempotent. |
getSession | () => SparkSession | The current session. Throws if not yet initialized. |
isInitialized | () => boolean | Whether a session exists. |
updateContentHeight | (height: number) => void | Report content height so the portal resizes the iframe. |
updateContentSize | (size: { height?: number; width?: number }) => void | Report width and/or height. |
→ Session & bridge
| Export | Signature | Description |
|---|
getEntity | (params: EntityGetParams) => Promise<EntityItem | undefined> | Fetch one entity for the portal user. |
searchEntities | (params: EntitySearchParams) => Promise<EntityResponseWithHits> | Search entities for the portal user. |
getPortalClient | () => Client | The configured customer-portal client for operations the SDK doesn't wrap. |
→ Entities
| Export | Signature | Description |
|---|
executeUseCase | (params: ExecuteUseCaseParams) => Promise<ExecuteUseCaseResult> | Run an Integration Hub use case via the portal proxy. |
→ Use cases
| Export | Signature | Description |
|---|
onLocaleUpdate | (handler: (lang: string) => void) => Unsubscribe | React to portal language changes. |
on | <T>(event: string, handler: MessageHandler<T>) => Unsubscribe | Subscribe to messages from the portal (supports *). |
send | (event: string, data?: Record<string, unknown>) => void | Send a message to the portal. |
→ Localization · Custom events
| Export | Signature | Description |
|---|
injectCSSVariables | (css: string) => boolean | Inject/replace the portal theme <style>. |
removeCSSVariables | () => void | Remove the injected theme styles. |
setThemeClass | (theme: 'light' | 'dark') => void | Set the light/dark class on <html>. |
removeThemeClass | () => void | Remove both theme classes. |
→ Theming
| Export | Description |
|---|
sendMessageToParent | Post a raw message to window.parent. |
subscribeToParentMessages | Listen for matching parent messages; returns an unsubscribe fn. |
setTrustedParentOrigins | Restrict trusted inbound/outbound origins. |
SPARK_BRIDGE_SOURCE | The source tag stamped on outbound messages ('spark-bridge'). |
→ Custom events
| Export | Description |
|---|
SparkError | Base class for all SDK errors. |
SparkTimeoutError | A bridge request (or init) timed out. |
SparkNotInitializedError | Used the SDK before initialize() resolved. |
→ Errors
| Type | Description |
|---|
SparkSession | The authenticated context: token, config, theme, lang… |
InitOptions | Options for initialize (timeout, apiBaseUrl, allowedParentOrigins). |
RequestOptions | Per-request options (timeout). |
ExecuteUseCaseParams / ExecuteUseCaseResult | Input and result of executeUseCase. |
MessageHandler<T> | (data: T) => void event handler. |
Unsubscribe | () => void returned by subscriptions. |
EntityItem, EntityGetParams, EntitySearchParams, EntityResponse, EntityResponseWithHits, EntitySlug | Entity shapes re-exported from @epilot/customer-portal-client. |
→ Session · Entities
| Export | Description |
|---|
VERSION | The SDK version string. |