SDKClientInstance

The main SDK client interface providing methods for managing encounters, ambient sessions, and events.
interface SDKClientInstance {
  activeAmbientId: string | null;
  attemptLogin(): Promise<true | void>;
  setPartnerToken(partnerToken: string): void;
  cancelAmbient(): void;
  cleanup(): void;
  destroy(): void;
  mount(options: MountOptions): Promise<void>;
  on<T extends keyof EmitterEvents>(
    type: T,
    handler: (data: EmitterEvents[T]) => void | Promise<void>,
  ): () => void;
  pauseAmbient(): void;
  resumeAmbient(): void;
  setAmbientOptions(options: AmbientOptions): void;
  setEncounter(encounter: Encounter): Promise<void>;
  startAmbient(): void;
  submitAmbient(): void;
}

Properties

PropertyTypeDescription
activeAmbientIdstring | nullThe ID of the currently active ambient session, or null if no session is active

Methods

MethodParametersReturn TypeDescription
attemptLogin-Promise<true | void>Re-authenticates the user with the SDK
cancelAmbient-voidCancels the current ambient session
cleanup-voidCleans up the SDK and removes all event listeners
destroy-voidDestroys the SDK instance and stops token refresh
mountoptions: MountOptionsPromise<void>Mounts the SDK to a DOM element with the specified configuration
ontype: T, handler: Function() => voidSubscribes to SDK events. Returns an unsubscribe function
pauseAmbient-voidPauses the current ambient session
resumeAmbient-voidResumes a paused ambient session
setAmbientOptionsoptions: AmbientOptionsvoidUpdates the ambient session configuration
setEncounterencounter: EncounterPromise<void>Sets the encounter context
setPartnerTokenpartnerToken: stringvoidUpdates the partner token for authentication after token refresh
startAmbient-voidStarts a new ambient session
submitAmbient-voidSubmits the current ambient session