Embedding Core Intelligence Aviator

Overview

This document provides a detailed guide for embedding a React application within another application by using a custom web component. By defining a custom HTML element, such as <intelligence-aviator>, you can encapsulate the React application, making it easier to integrate and reuse across different platforms and frameworks. This approach separates the React application from the host environment, ensuring better modularity and simplifying integration.

Custom element definition

The custom element named "IntelligenceAviator" is implemented with the following code:

import ReactDOM from "react-dom";
import EmbedEntry from "./components/entry/EmbedEntry";

class IntelligenceAviator extends HTMLElement {
  connectedCallBack() {
    const mountPoint = document.createElement("div");
    ReactDOM(<EmbedEntry/>, mountPoint);
   }
}

customElements.define("intelligence-aviator", IntelligenceAviator);
  • <EmbedEntry/> is the entry point to the Aviator application, and it renders into the mountPoint element.
  • <intelligence-aviator> is the custom HTML tag that renders the Aviator UI.

Using custom element

  1. Add the script that defines the IntelligenceAviator custom element in the host application through a script tag.
    Link to Aviator JSAPI
    <script src="https://mbir-cia-app-mbir.dev.ca.opentext.com/aviator/jsapi"></script>
  2. Add the custom element to the host application's HTML. This can be done in two ways, with botId parameter and without botId parameter. Following are the examples:
    With botId
    <intelligence-aviator
       token={token}
       host={"https://mbir-cia-app-mbir.dev.ca.opentext.com"}
       botId={"400920000100"}
       enableExploreData={"true"}
       enablePinning={"true"} >
    </intelligence-aviator>
    Without botId
    <intelligence-aviator
       token={token}
       host={"https://mbir-cia-app-mbir.dev.ca.opentext.com"}
       enableExploreData={"true"}
       enablePinning={"true"} >
    </intelligence-aviator>
    The parameters required are:
    Parameter Required Description
    token Mandatory A valid OTDS token to access Aviator.
    host Mandatory The host URL where aviator is deployed.
    botId Optional If botId is provided, the selection page is not displayed.
    enableExploreData Optional Enables or disables the Explore Data panel. Default is true.
    enablePinning Optional Enables or disables the Pinned panel. Default is true.
  3. The size of the Aviator container depends on the wrapping parent container. Aviator takes the full width of the container.
    Sizing
    In this scenario, height and width will be 1000 px and 400 px.
    <div style="height: 1000px; width: 400px">
        <intelligence-aviator
            token={token}
            host={"https://mbir-cia-app-mbir.dev.ca.opentext.com"}
            enableExploreData={"true"}
               enablePinning={"true"}
        ></intelligence-aviator>
    </div>

Screenshots post embedding

Screenshots post embedding

Host application requirements

  • The browser must support custom elements (available in all modern browsers).
  • Any global styles in the host application can affect the React application. Use CSS scoping or libraries like CSS Modules to isolate styles.
  • The OTDS token passed as the token parameter must include the user roles. To include roles in the token, add otds:roles to the scope during the OAuth/OIDC authentication flow.