Description of your new file.
window.AdoptAI
) or the NPM package (import { ... } from '@adoptai/sdk
), the method signatures remain consistent.
init(licenseKey: string, opts?: InitConfig): Promise<void>
Initializes the SDK (required for NPM installs only).
boot(userId: string, userProperties?: object, instanceAttributes?: object): Promise<void>
Starts the Copilot for a specific user session.
shutdown(): void
Hides the Copilot UI. Typically called on logout or user switch.
setUserProperties({ userProperties: object }): void
Updates user-specific properties after boot.
addRouter(callback: (url: string) => void): void
Registers your app’s router so Adopt can track and respond to route changes in SPAs.
setCopilotHeaders(headers: Record<string, string>): void
Dynamically updates API headers—useful for refreshing tokens mid-session.
try/catch
blocks to gracefully handle issues during init or boot: