Interacting with the Host UI Container

Every application runs inside the Deskpro UI and has one Deskpro UI Component which acts as a container for the application, managing its lifecycle and dispatching UI Events to it

You have access to the Host Container via methods available directly on the context object which you can obtain from the application client:

    const { context } = this.props.dpapp

Based on the choice of targets from the application manifest, your context object will expose different methods for interacting with the host container. The following chapters will document the usage scenarios for the different types of host containers.

Interacting with Ticket UI Tab

This is one of the most common host containers. You can also check the reference docs for the API exposed in application context by this type of container: https://deskpro.github.io/apps-sdk-core/reference/UITabContext.html

Checking if the UI Tab is active

Your application might need to check the UI Tab which acts as its host is the visible (active) one among all the tabs the user has opened:

    const { context } = this.props.dpapp
    context.isTabActive().then(isActive => console.log(isActive));

Activating the UI Tab

When a certain piece of information becomes available, your application might want to bring itself to the attention of the user by activating the host UI Tab:

    const { context } = this.props.dpapp
    context.activateTab().then(() => console.log('tab activate'));

Closing the UI Tab

Your application might decide to terminate early and not wait for the user to close the host UI Tab:

    const { context } = this.props.dpapp
    context.closeTab().then(() => console.log('tab closed'));

Last updated