A client for interacting with the embedded sandai iframe.

The SandaiClient handles iframe communication, message passing, and interactions via the InteractionManager.

const client = new SandaiClient("myIframeId", "userId", "apiKey");

The ID of the target iframe element in the DOM.

Throws an error if the specified element does not exist or is not an iframe.

Constructors

  • Initializes the SandaiClient with a given iframe ID.

    Parameters

    • iframeId: string

      The ID of the target iframe element in the DOM.

    • OptionaluserId: string
    • OptionalapiKey: string

    Returns SandaiClient

    Throws an error if the specified element does not exist or is not an iframe.

Properties

authManager: AuthManager
interactionManager: InteractionManager
loadManager: LoadManager

Methods

  • Cleans up all registered message event listeners previously added by _listenForMessage. Call this method when the instance is being destroyed or no longer needs to listen to messages.

    Returns void

  • Initializes both the LoadManager and AuthManager instances in sequence.

    This ensures that:

    1. The iframe is fully loaded and in a "ready" state.
    2. Authentication is performed and the user's access tier is retrieved.

    Returns Promise<void>

    A promise that resolves once both managers have completed initialization.