Unblu Embedded App Component API
    Preparing search index...

    Class UnbluEmbeddedAppElement

    By itself this contains only the definition of the custom element and will load further JavaScript from the collaboration server on initialization to provide the full functionality.

    To use the custom element just place a tag named "unblu-embedded-app" somewhere into the webpages body`.

    ...
    <body>
    ...
    <div>
    <unblu-embedded-app></unblu-embedded-app>
    </div>
    ...
    </body>
    ...

    The size and positioning fully depends on the styles applied to the element by the website it is embedded into. The styling within the unblu embedded app can't be influenced by the website's styles however as a shadow root is used for its content. Unblu provides a large list of configuration properties to nicely integrate the unblu embedded app's visual appearance with the website it is embedded into.

    The example above will simply add the unblu embedded app into the DOM but it won't initialize anything. To initialize the element with Unblu content at least the attribute ATTR_API_KEY or property UnbluEmbeddedAppElement.apiKey need to be defined. If UnbluEmbeddedAppElement.autoInit is set to true (default), it will automatically start the initialization, as soon as the API key is defined either via its attribute ATTR_API_KEY or property UnbluEmbeddedAppElement.apiKey. If not a call to UnbluEmbeddedAppElement.initialize has to be done to trigger the initialization.

    Initializing:

    Initialization can either be done manually or automatically. If the element is configured to do automatic initialization ATTR_AUTO_INIT / UnbluEmbeddedAppElement.autoInit the initialization will be automatically started as soon as at least the API key ATTR_API_KEY / UnbluEmbeddedAppElement.apiKey is defined. If you intent to define other attributes/properties relevant for the initialization these must all be set in the same JavaScript execution cycle. If automatic initialization is disabled the initialization must be done manually by calling the UnbluEmbeddedAppElement.initialize method.

    There are additional attributes/properties which can be defined to define from where and how the Unblu JavaScript code is loaded from the collaboration server.

    The Unblu UI inside the custom element will always fill the whole content of the unblu-embedded-app independent of what size it is given.

    Note: if an Unblu Floating UI is already integrated on the website via the Floating JS API, the embedded app will automatically deinitialize it as there can always only one active instance of Unblu on the page.

    Hierarchy

    • HTMLElement
      • UnbluEmbeddedAppElement

    Implements

    • InitializedUnbluElement
    Index

    Constructors

    Properties

    ATTR_ACCESS_TOKEN: "access-token" = 'access-token'

    The access token used to log the user in before initializing Unblu.

    Note: Changes to this attribute trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.ATTR_AUTO_INIT is true.

    UnbluEmbeddedAppElement.accessToken to set or get this via a property

    ATTR_API_KEY: "api-key" = 'api-key'

    The API Key to connect this app with a specific Unblu account This is the minimum configuration that has to be done to trigger the initialization of Unblu.

    Note: Changes to this attribute trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.ATTR_AUTO_INIT is true.

    UnbluEmbeddedAppElement.apiKey to set or get this via a property

    ATTR_AUTO_INIT: "auto-init" = 'auto-init'

    Defines if Unblu automatically tries to (re-)initialize as soon as an attribute or property changes that triggers (re-)initialization.

    To trigger a initialization at least the attribute ATTR_API_KEY or property UnbluEmbeddedAppElement.apiKey.

    true.
    

    UnbluEmbeddedAppElement.autoInit to set or get this via a property

    ATTR_CONVERSATION_ID: "conversation-id" = 'conversation-id'

    Opens the conversation with the specified ID. If Unblu is not initialized yet, it will wait for the initialization and then automatically open the specified conversation. If Unblu is already initialized, the conversation will be opened directly.

    If the conversation doesn't exist or the user doesn't have the right to access it, a dialog will be displayed with the respective error message.

    • UnbluEmbeddedAppElement.openConversation to set this value and also retrieve a promise to know, when the conversation was opened.
    • UnbluEmbeddedAppElement.conversationId to read the value as property. This will always represent the currently opened conversation.

    Static ReadonlyATTR_ENTRY_PATH

    ATTR_ENTRY_PATH: "entry-path" = 'entry-path'

    The path pointing to the root of the Unblu collaboration server.

    "/unblu".

    Note: Changes to this attribute trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.ATTR_AUTO_INIT is true.

    UnbluEmbeddedAppElement.entryPath to set or get this via a property

    ATTR_FULLSCREEN: "fullscreen" = 'fullscreen'

    When this attribute is set to true, the embedded app will ignore the position and size set to its element and will used fixed positioning to display itself to cover the whole website.

    This is useful when the user is currently in a call.

    This can be set even if the API is not initialized yet. The value will then be applied on initialization.

    Note: The user itself can also toggle this inside the UI.

    UnbluEmbeddedAppElement.fullscreen to set or get this via a property

    false
    
    ATTR_INIT_TIMEOUT: "init-timeout" = 'init-timeout'

    The timeout im milliseconds that should be waited for the Unblu integration to load.

    30'000 (30 seconds).
    

    UnbluEmbeddedAppElement.initTimeout to set or get this via a property

    ATTR_LOCALE: "locale" = 'locale'

    The locale (language) used for all Unblu UIs. If not specified this is derived from the webpage or the browser.

    Note: Changes to this attribute trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.ATTR_AUTO_INIT is true.

    ATTR_NAMED_AREA: "named-area" = 'named-area'

    The named area for which the configuration should be loaded and with which new queue requests will be labeled. If not specified this can be derived from the corresponding meta tag on the webpage or the domain.

    Note: Changes to this attribute trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.ATTR_AUTO_INIT is true. If this is not desired it can be prevented by changing the named area via a meta tag, however in this case this will only effect the queue routing and not the configuration. Alternatively you can disable the automatic initialization.

    ATTR_SERVER_URL: "server-url" = 'server-url'

    The URL to the collaboration server.

    If not specified it is assumed that the server is reachable on the domain of the current webpage at the defined UnbluEmbeddedAppElement.entryPath

    Note: Changes to this attribute trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.ATTR_AUTO_INIT is true.

    UnbluEmbeddedAppElement.serverUrl to set or get this via a property

    ATTR_VIEW_MODE: "view-mode" = 'view-mode'

    Sets the view mode of the embedded app element.

    Depending on the view mode the UI is displayed the following way:

    • ViewMode.SPLIT: The UI will be divided into two parts. The list of conversations is displayed on the left and the active conversation on the right side.

    • ViewMode.SINGLE: Both the conversation list and the active conversation will be displayed in the same view using UI navigation to switch between them.

    • ViewMode.AUTO: The UI will automatically switch back and forth between the two other modes depending on the available width. The trigger point when to switch between the two modes can be configured on the Unblu collaboration server.

    This value can be set even if the API is not initialized yet. The value will then be applied on initialization.

    UnbluEmbeddedAppElement.viewMode to set or get this via a property

    Accessors

    • get accessToken(): string

      Returns string

    • set accessToken(accessToken: string): void

      The access token used to log the user in before initializing Unblu.

      Note: Changes to this property trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.autoInit is true.

      Parameters

      • accessToken: string

      Returns void

      UnbluEmbeddedAppElement.ATTR_ACCESS_TOKEN to set this as an attribute

    • get apiKey(): string

      Returns string

    • set apiKey(apiKey: string): void

      The API Key to connect this app with a specific Unblu account. This is the minimum configuration that has to be done to trigger the initialization of Unblu.

      Note: Changes to this property trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.autoInit is true.

      Parameters

      • apiKey: string

      Returns void

      UnbluEmbeddedAppElement.ATTR_API_KEY to set this as an attribute

    • get autoInit(): boolean

      Returns boolean

    • set autoInit(autoInit: boolean): void

      Defines if Unblu automatically tries to (re-)initialize as soon as an attribute or property changes that triggers (re-)initialization. Attributes/properties that trigger a (re-)initialization have a note in their documentation. At least the attribute ATTR_API_KEY or property UnbluEmbeddedAppElement.apiKey has to be configured to trigger an initialization.

      If this property gets set from false to true, it will automatically initialize if it is not already initialized. If it is already initialized, it will NOT deinitialize.

      Parameters

      • autoInit: boolean

      Returns void

      true.
      

      UnbluEmbeddedAppElement.ATTR_AUTO_INIT to set this as an attribute

    • get conversationId(): string

      Returns string

    • set conversationId(conversationId: string): void

      Opens the conversation for the given conversation ID.

      This can be set already before Unblu is initialized. The conversation will then be opened as soon as Unblu gets initialized.

      If the conversation doesn't exist or the user doesn't have the right to access it, a dialog will be displayed with the respective error message. In such a case the conversation ID will be reset to null.

      Parameters

      • conversationId: string

        The id of the conversation to open

      Returns void

      UnbluEmbeddedAppElement.ATTR_CONVERSATION_ID to set this as an attribute

    • get entryPath(): string

      Returns string

    • set entryPath(entryPath: string): void

      The entry path on the collaboration server.

      Parameters

      • entryPath: string

      Returns void

      "/unblu".

      Note: Changes to this property trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.autoInit is true.

      UnbluEmbeddedAppElement.ATTR_ENTRY_PATH to set this as an attribute

    • get fullscreen(): boolean

      Returns boolean

    • set fullscreen(fullscreen: boolean): void

      When this attribute is set to true, the embedded app element will ignore the position and size set to its element and will used fixed positioning to display itself to cover the whole website.

      This is useful when the user is currently in a call.

      This can be set even if the API is not initialized yet. The value will then be applied on initialization.

      Note: The user itself can also toggle this inside the UI.

      Parameters

      • fullscreen: boolean

        True to enable fullscreen, false otherwise.

      Returns void

      false
      
    • get initTimeout(): number

      Returns number

    • set initTimeout(initTimeout: number): void

      The timeout im milliseconds that should be waited for the Unblu integration to load.

      Parameters

      • initTimeout: number

      Returns void

      30'000 (30 seconds).
      

      UnbluEmbeddedAppElement.ATTR_INIT_TIMEOUT to set this as an attribute

    • get locale(): string

      Returns string

    • set locale(locale: string): void

      The locale (language) used for all Unblu UIs. If not specified this is derived from the webpage or the browser.

      Note: Changes to this property trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.autoInit is true.

      Parameters

      • locale: string

      Returns void

      UnbluEmbeddedAppElement.ATTR_LOCALE to set this as an attribute

    • get namedArea(): string

      Returns string

    • set namedArea(namedArea: string): void

      The named area for which the configuration should be loaded and with which new queue requests will be labeled. If not specified this can be derived from meta tags on the webpage.

      Note: Changes to this property trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.autoInit is true. If this is not desired it can be prevented by changing the named area via a meta tag, however in this case this will only effect the queue routing and not the configuration. Alternatively you can disable the auto init.

      Parameters

      • namedArea: string

      Returns void

      UnbluEmbeddedAppElement.ATTR_NAMED_AREA to set this as an attribute

    • get serverUrl(): string

      Returns string

    • set serverUrl(serverUrl: string): void

      The URL to the collaboration server.

      If not specified it is assumed that the server is reachable on the same domain of the current webpage at the defined UnbluEmbeddedAppElement.entryPath

      Note: Changes to this property trigger a reinitialization of Unblu if UnbluEmbeddedAppElement.autoInit is true.

      Parameters

      • serverUrl: string

      Returns void

      UnbluEmbeddedAppElement.ATTR_SERVER_URL to set this as an attribute

    • get viewMode(): ViewMode

      Returns ViewMode

    • set viewMode(viewMode: ViewMode): void

      Sets the view mode of the embedded app element.

      Depending on the view mode the UI is displayed the following way:

      • ViewMode.SPLIT: The UI will be divided into two parts. The list of conversations is displayed on the left and the active conversation on the right side.

      • ViewMode.SINGLE: Both the conversation list and the active conversation will be displayed in the same view using UI navigation to switch between them.

      • ViewMode.AUTO: The UI will automatically switch back and forth between the two other modes depending on the available width. The trigger point when to switch between the two modes can be configured on the Unblu collaboration server.

      This value can be set even if the API is not initialized yet. The value will then be applied on initialization.

      Parameters

      • viewMode: ViewMode

        The new view mode to use

      Returns void

    Methods

    • Registers for the UnbluEmbeddedAppElement.STATE_CHANGE event

      Parameters

      • type: "stateChange"
      • listener: (event: StateChangeEvent) => void
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Registers for the UnbluEmbeddedAppElement.READY event

      Parameters

      • type: "ready"
      • listener: (event: ReadyEvent) => void
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Registers for the UnbluEmbeddedAppElement.ERROR event

      Parameters

      • type: "error"
      • listener: (event: ErrorEvent) => void
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Parameters

      Returns void

    • Registers for the UnbluEmbeddedAppElement.DEINITIALIZED event

      Parameters

      Returns void

    • Parameters

      Returns void

    • Parameters

      • type: "fullscreenChange"
      • listener: (event: FullscreenChangeEvent) => void
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Parameters

      • type: "viewModeChange"
      • listener: (event: ViewModeChangeEvent) => void
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Deinitializes the app element and destroys all of its containing UI. By changing one of the attributes that trigger a reinitialization (e.g. UnbluEmbeddedAppElement.apiKey) the app element will be automatically initialized again (if the value is really changed).

      Note: Calling this method will not remove the element itself out of the DOM.

      Returns Promise<void>

    • Removes a listener registration for the UnbluEmbeddedAppElement.STATE_CHANGE event

      Parameters

      Returns void

    • Removes a listener registration for the UnbluEmbeddedAppElement.READY event

      Parameters

      • type: "ready"
      • listener: (event: ReadyEvent) => void

      Returns void

    • Removes a listener registration for the UnbluEmbeddedAppElement.ERROR event

      Parameters

      • type: "error"
      • listener: (event: ErrorEvent) => void

      Returns void

    • Removes a listener registration for the UnbluEmbeddedAppElement.DEINITIALIZING event

      Parameters

      Returns void

    • Removes a listener registration for the UnbluEmbeddedAppElement.DEINITIALIZED event

      Parameters

      Returns void

    • Removes a listener registration for the UnbluEmbeddedAppElement.ACTIVE_CONVERSATION_CHANGE event

      Parameters

      Returns void

    • Removes a listener registration for the UnbluEmbeddedAppElement.FULLSCREEN_CHANGE event

      Parameters

      Returns void

    • Removes a listener registration for the UnbluEmbeddedAppElement.VIEW_MODE_CHANGE event

      Parameters

      Returns void

    Events

    ACTIVE_CONVERSATION_CHANGE: "activeConversationChange" = 'activeConversationChange'

    Event emitted every time one of the conversations accessible to the current user changes or one is added or removed.

    DEINITIALIZED: "deinitialized" = 'deinitialized'

    Event emitted when the de-initialization of the API has finished.

    It usually makes sense to use this event if a re-initialization is required after de-init.

    DEINITIALIZING: "deinitializing" = 'deinitializing'

    Event emitted when the de-initialization of the API is started..

    It usually makes sense to use this event to clean up resources and/or unregistering of listeners so they don't try to use the API again until it is initialized again.

    ERROR: "error" = 'error'

    Event emitted if the API initialization fails.

    It usually makes sense to use this event if there is some general action that has to be triggered when the API initialization fails.

    FULLSCREEN_CHANGE: "fullscreenChange" = 'fullscreenChange'

    Event emitted every time the embedded app switches to fullscreen mode or back.

    READY: "ready" = 'ready'

    Event emitted as soon as the API is initialized.

    It usually makes sense to use this event to wait for APIs on this element to be ready. E.g. the UnbluEmbeddedAppElement.personInfo or UnbluEmbeddedAppElement.agentAvailable. You will find a note in the documentation of the properties when they are only available after initialization.

    STATE_CHANGE: "stateChange" = 'stateChange'

    Event emitted whenever the API state changes

    VIEW_MODE_CHANGE: "viewModeChange" = 'viewModeChange'

    Event emitted every time the view mode changes.