Skip to main content
usePluginContext returns the full PluginUIContext object that the shell injects into every plugin’s React tree via PluginShellProvider. It is the foundational hook — all other shell utility hooks (useShellAuth, useShellToast, etc.) call it internally.

Import

import { usePluginContext } from "@skyvexsoftware/stratos-sdk";

Signature

function usePluginContext(): PluginUIContext

Return value

See PluginUIContext for the full shape. The nested types referenced by PluginUIContext are also documented in the Type Reference:

Usage

import { usePluginContext } from "@skyvexsoftware/stratos-sdk";

export function MyComponent() {
  const { auth, airline, toast } = usePluginContext();

  return (
    <div>
      <p>Airline: {airline?.name ?? "Unknown"}</p>
      {auth.isAuthenticated && auth.user ? (
        <p>Welcome, {auth.user.firstName} {auth.user.lastName}</p>
      ) : (
        <p>Not authenticated</p>
      )}
      <button onClick={() => toast.success("Saved!")}>Save</button>
    </div>
  );
}

Notes

  • Convenience wrappers like useShellAuth, useShellToast, etc. are available if you only need a single field from the context. They call usePluginContext() internally.
  • The socket field is the plugin-scoped bridge to your own background module’s ctx.ipc.send broadcasts. For high-frequency simulator data sourced from outside your plugin, use useSimData or useSocket instead.