Skip to main content
Every public symbol exported by @westyx-nexus/sdk-vue. Composables are the primary surface; the imperative NexusClient is exposed via useNexus() for advanced use cases.

Setup

provideNexus(app, config): Promise<NexusClient>

Creates the NexusClient instance, performs the blocking initial sync, registers the client on the Vue application instance, and starts the SSE stream. Use with await so children render against a populated cache.

createNexusPlugin(config): Plugin

Vue plugin factory - alternative to provideNexus() for setups that prefer the standard app.use() pattern. Does not await the initial sync; components must handle the loading state.
The plugin starts the initial sync as a fire-and-forget Promise and logs failures via NexusLogger.error(...). While the sync is in flight, all composables return their defaults (undefined / false).

Composables

useNexus(): NexusClient

Escape hatch - returns the underlying NexusClient instance for advanced use. Reads via this client are not reactive (don’t subscribe to the cache). Use the typed composables below unless you have a specific reason.

useConfig<T>(key): ComputedRef<T | undefined>

Read a config value. Returns undefined when the key is absent.

useFlag(key, defaultValue?): ComputedRef<boolean>

Read a flag value. Returns defaultValue (default false) when the key is absent.

useSecret(key): ComputedRef<string | undefined>

Read a secret value. Returns undefined if the client uses a public key, or if the key is missing - it never throws.
In browser apps you’ll typically be using a public key, so useSecret always returns undefined.

AB Testing

useEvaluateAB(): (keys, userId, attributes) => Promise<Record<string, boolean>>

Returns a stable bound function that performs a batch AB evaluation. The returned function is safe to destructure and pass around.
Missing keys come back as false. Re-call the function whenever userId or attributes change - the result is intentionally not cached by the SDK.

useNexusSyncedAt(): ComputedRef<Date>

Last successful sync timestamp. Useful for “last refreshed N seconds ago” UIs.

useNexusSync(): () => Promise<void>

Returns a function that triggers a manual sync. Use sparingly - the SDK syncs automatically.

useNexusStreamStatus(): ComputedRef<{ connected: boolean }>

Reactive SSE state. Useful for surfacing a “live” / “polling” indicator.

Imperative NexusClient (rarely needed)

Error types

Type helpers