Entry point for applications to configure and use the SDK. This class contains various utility methods to initialize and shutdown the SDK. Few other functionalities like setting log level, resetting idle timeout, setting event listeners for SDK events are also provided in this class.

Methods

  • Attach event handler callback that needs to be invoked when user has remained inactive for the idleTimeout duration.

    Parameters

    Returns string

    Unique event handler id that was generated by SDK when the event handler was attached.

  • Attach event handler callback that needs to be invoked when SDK gets initialized.

    Type Parameters

    Parameters

    Returns string

    Unique event handler id that was generated by SDK when the event handler was attached.

  • Attach event handler callback that needs to be invoked when SDK shuts down.

    Parameters

    Returns string

    Unique event handler id that was generated by SDK when the event handler was attached.

  • Get the default conversation for this SDK instance. Before calling this method, it is mandatory for the SDK to be initialized.

    Note: In order to fully leverage the advantages of TypeScript, it is recommended to specify the type of the conversation class that was provided to the SDK during initialization. See init method. If no class was provided to the SDK during initialization, then the default conversation class will be AxpConversationCore and there is no need to specify the type.

    Type Parameters

    • T extends Constructable<AxpConversationCore>

      The type of the conversation class that was provided to the SDK during initialization.

    Returns InstanceType<T>

    InstanceType of class T that extends AxpConversationCore and was provided to the SDK in init method.

    const defaultConversation = AxpOmniSdk.getDefaultConversation<typeof AxpConversationMixedClass>();
    
  • Initialize the SDK and conversation with the given parameters. Before any operation can be performed with the SDK, it must be initialized. The initialization process creates a new session for the current user (identified by the JWT) and returns a AxpUserSession object that contains the Conversation object corresponding to the User's ongoing conversation.

    Parameters

    Returns Promise<AxpUserSession<AxpConversationCore>>

    A promise that resolves to AxpUserSession with conversation of type AxpConversationCore.

  • Initialize the SDK and conversation with the given parameters. Before any operation can be performed with the SDK, it must be initialized. The initialization process creates a new session for the current user (identified by the JWT) and returns a AxpUserSession object that contains the Conversation object corresponding to the User's ongoing conversation.

    Type Parameters

    Parameters

    • initParams: AxpOmniSdkInitParams

      Initialization data required to initialize the SDK.

    • EnhancedConversationClass: T

      Enhanced(Mixed) class that extends AxpConversationCore, which was generated by applying the Mixins.

    Returns Promise<AxpUserSession<InstanceType<T>>>

    A promise that resolves to AxpUserSession with conversation of type EnhancedConversationClass.

    const AxpConversationMixedClass = AxpMessagingConversation();

    const SDKUserSession = await AxpOmniSdk.init({
    displayName: <displayName>,
    token: <jwt_token>,
    integrationId: <integration_id>,
    host: <region>,
    appKey: <appKey>,
    logLevel: <logLevel>,
    idleTimeoutDuration: <idleTimeOutDuration>,
    idleShutdownGraceTimeoutDuration: <graceTimeoutDuration>,
    jwtProvider: <jwtProviderImpl>
    }, AxpConversationMixedClass);
  • Remove the event handler callback that was attached to the idleTimeout event.

    Parameters

    • eventHandlerId: string

      Event handler id that was received at the time of attaching the event handler.

    Returns void

  • Remove the event handler callback that was attached to the SDK initialization event.

    Parameters

    • eventHandlerId: string

      Event handler id that was received at the time of attaching the event handler.

    Returns void

  • Remove the event handler callback that was attached to the SDK shutdown event.

    Parameters

    • eventHandlerId: string

      Event handler id that was received at the time of attaching the event handler.

    Returns void

  • Reset the idle timer to indicate the SDK that the user session is still active. The SDK already resets the timeout when it receives a request internally from the modules or other sub modules(AXP Messaging).

    Invoke this method only when client want to indicate a user's activity visible only to the client (apart from the above mentioned activities).

    Returns void

  • Set a new Jwt for the SDK to invoke APIs at server. Before calling this method, it is mandatory for the SDK to be initialized.

    Parameters

    • token: string

      New JWT token to be set.

    Returns void

  • Sets the log level of SDK.

    Parameters

    Returns void

  • Shutdown the SDK and closes the session with AXP. After shutdown, if the SDK is required to be used again, re-initialize it by calling init. Before calling this method, it is mandatory for the SDK to be initialized.

    Parameters

    • OptionalshutdownReason: ShutdownReason

      Reason for shutting down the SDK.

    Returns Promise<void>

  • Returns string