Configuration
This document provides a reference for the formatting properties available to customize the framing of your Airkit application when it is embedded in another web page via the SDK. See Example Configurations for applied examples that can be copy/pasted directly into your existing web pages after the SDK_API_URL
has been defined.
Inline vs. Popup
When inserting an Airkit application into an existing web page, there are two core ways for the app to be viewed: Inline mode or Popup mode.
The Inline view makes the application appear as though it is directly part of the web page. Visitors to the web page will see the embedded application when navigating to the page, and so an application Journey will be initiated as soon as the web page is accessed.
The Popup view allows the application to be opened as a modal within the web page. Visitors to the web page will only see the application when they click on the floating button to open it, and so the application Journey will be initiated when that button is clicked.
Initializer Configuration
config.instanceId
We recommend passing a unique ID for each embed. config.instanceId
is used to read/write sessionId
and appURL
to/from cookie.
Type | Required | Default |
---|---|---|
| Sometimes | Randomly-generated ID |
🚧 Unique instanceId is required when using multiple embeds in same website.
config.iframeConfig
config.iframeConfig
is used to add properties directly to the iframe
element.
The keys in config.iframeConfig.style
must be CamelCase. For example:
config.iframeConfig.onLoad
is called when iFrame
is loaded.
It is possible to override default values fully or partially by passing your own CSS
Object.
** This attribute is not required.**
Type
Inline Mode Default
Popup Mode Default
config.renderMode
This property determines how SDK renders the iframe
. In inline
mode, the generated UI will be append to existing element. In popup
mode, a floating button will be added to Document and clicking on it will toggle the popup panel that renders the iframe
.
Type | Required | Default |
---|---|---|
| No |
|
For more on how inline
mode and popup
mode impact the structure of the UI, see the UI Layouts section for each rendering mode.
config.testIdPrefix
This property provides support for E2E testing. The SDK adds the data-test-id
property to wrappers and interactive elements.
Type | Required | Default |
---|---|---|
| No |
|
For more details, see the UI Layouts section for each rendering mode.
config.classNamePrefix
This property provides support to style the embed through CSS classes. The SDK adds the class
property to wrappers and interactive elements.
Type | Required | Default |
---|---|---|
| No |
|
For more details, see the UI Layouts section for each rendering mode.
config.renderConfig
config.renderConfig
is an object that defines the appearance of how the embed is framed.
** This attribute is not required.**
Type
Inline Mode
Default
Description
config.renderConfig.containerStyle
is an optional style object which applies as a wrapper HTML Div element. Default values can be either fully or partially overridden by passing a CSS
Object.
config.renderConfig.button
and config.renderConfig.panel
are only used in popup mode
Popup Mode
Default
Description
config.renderConfig.containerStyle
is an style object which applies as a wrapper HTML Div element. It contains both the floating button and popup panel. The position of floating button on page is control by this property.
config.renderConfig.button
holds the configuration of the floating button. Depending on panel being open or closed, the center image could be either openIconSrc
orcloseIconSrc
respectively. The values could be URL
or base64
. buttonStyle
and buttonAria
apply to wrapping the floating button as a HTML Div element. iconStyle
and iconAria
apply to the HTML Image element inside the floating button. hoverColor
defines the floating button background color for the mouse-over effect.
config.renderConfig.panel
holds the optional header
and iframe
. Clicking on floating button toggles this panel. width
and height
must be calculated considering the optional header
and iframe
final box sizes. These two properties are used to render the final popup panel as well as in animation. style
applies to entire panel. Animation on height and opacity are controlled from here.
All default values can be either fully or partially by passing a CSS
Object.
config.headerConfig
config.headerConfig
is an object that defines an optional header that will render outside the iframe
tag. It is most commonly used to display a combination of company logo and trademark text.
** This attribute is not required.**
Type
Inline Mode
Default
This is optional, and there is no default header for inline
mode.
Description
config.headerConfig.headerStyle
applies to the HTML Div element that wraps the entire header. It defaults to an empty object: {}
.
config.headerConfig.trademarkBoxStyle
applies to the HTML Div element that wraps the logo and trademark text. it Defaults to an empty object: {}
. trademarkBox
renders on left hand side of header.
config.headerConfig.logo
renders an HTML Image element and applies the provided style to it. buttonAria
applies to the wrapper HTML Div element. imageAria
applies to the Image element. src
can be URL
or Base64
.
config.headerConfig.typography
renders the HTML Span element at the right hand side of logo
(if any), with text as the body and style
applied directly to element.
Popup Mode
Default
Description
The default header renders actionsBox
with close
icon. This default value can be fully or partially overwritten by passing a CSS
Object.
config.headerConfig.headerStyle
applies to the HTML Div element that wraps the entire header. It defaults to an empty object: {}
.
config.headerConfig.trademarkBoxStyle
applies to the HTML Div element that wraps the logo and trademark text. It defaults to an empty object :{}
. trademarkBox
renders on left hand side of header.
config.headerConfig.logo
renders an HTML Image element and applies the provided style to it. buttonAria
applies to the wrapper HTML Div element . imageAria
applies to the Image element. src
can be URL
or Base64
.
config.headerConfig.typography
renders the HTML Span element on the right hand side of logo
(if any) , with text as the body and style
applied directly to element.
config.headerConfig.actionsBoxStyle
applies to the HTML Div element that wraps the minimize and close icons. actionsBox
renders on the right hand side of header.
config.headerConfig.close
and config.headerConfig.minimize
render an icon button. Clicking on either will close the popup panel. src
can be URL
or Base64
. buttonStyle
and buttonAria
apply to the wrapping HTML Div element (the icon button). imageStyle
and imageAria
apply to the HTML Image element inside the icon button. hoverColor
defines the icon button background color for the mouse-over effect.
Render Configuration
config.url
This is the SDK_API_URL
. It is created as part of configuring an Airkit app to be displayed in an existing web page, though a default scaffold is provided. By default, the SDK will make a POST
request to this URL to get the appURL
and sessionId
. To load an app successfully, either the url
or appURL
must be provided.
For more on how to create and locate the SDK_API_URL
, see the SDK Quickstart.
Type | Required | Default |
---|---|---|
| NO | - |
config.appURL
This is the SDK_API_URL
. It is created as part of configuring an Airkit app to be displayed in an existing web page, though a default scaffold is provided. This is the Launch trigger
, the value of which is used to load the app. To load an app successfully, either the url
or appURL
must be provided
For more on how to create and locate the SDK_API_URL
, see the SDK Quickstart.
Type | Required | Default |
---|---|---|
| NO | - |
config.container
In inline
mode, this is the container where the SDK will render the iFrame
. If a String
is passed, getElementById
is used to locate the element in HTML page. If an HTMLElement
is passed, that will be used directly..
Type | Required | Default |
---|---|---|
| No |
|
config.sessionId
This is used to set the url
and sessionId
. If these are set here, the SDK won't need to call the API in order to find them.
Type | Required | Default |
---|---|---|
| No | - |
config.options
This allows initial values to passed into the Airkit app by passing the data into Fetch
.
Type | Required | Default |
---|---|---|
| No | - |
This property has a few possible attributes:
Attribute | Description | Type | Example | Default |
---|---|---|---|---|
| The HTTP Request Headers |
|
|
|
| The HTTP Request Body |
|
|
|
| Information about the app container |
|
|
|
config.track
This allows for the tracking of SDK behavior by the following events:
{ type: "error", text: "URL is required"}
{ type: "error", text: "Development on http is unsupported" }
{ type: "error", text: "Container ${container} does not exist. Please check the container value passed to render method"}
{ type: "error", text: "Fetch is not supported by your browser" }
{ type: "error", text: "URL ${url} didn't return sessionId and/or Application URL" }
{ type: "error", text: "Failed to load sessionId and application's url from ${url} with error: ${error}" }
{ type: "error", text: 'Neither "appURL" nor "url" was provided. SDK failed to load.' }
{ type: "warn", text: "No sessionId was found for instanceId: ${this.instanceId}" }
{ type: "warn", text: appURL "${appURL}" was provided without sessionId. }
{ type: "info", text: "Minimize button on popup panel clicked" }
{ type: "info", text: "Close button on popup panel clicked" }
{ type: "info", text: "Popup button clicked" }
Type | Required | Default |
---|---|---|
| No |
|
Mobile View in Popup Mode
In popup mode
, when window.innerWidth
is less than or equal to 700px
, the popup panel will render in full size.
Complete Configuration's Typescript
UI Layout for Inline Mode
An embedded Airkit application will be formatted according to Inline Mode when:
This creates a frame around the application that is formatted as follows:
The box labeled E is where the body of the application will be displayed. All other boxes are customizable formatting elements that frame the application.
A
The SDK expects element with id
attribute set to config.container
. The SDK appends generated UI to this element. If this element is not found, iframe
will not be rendered.
B
This is a HTML Div element. It contains the UI generated by SDK and gets appended to box A. config.renderConfig.containerStyle
controls the style of this box.
C
This is an optional header. config.headerConfig.headerStyle
controls the style of this box.
D
This is a trademarkBox
in header. It holds a logo
and/or text
. config.headerConfig.trademarkBoxStyle
controls the style of this box.
D.1 (logo)
Optional logo
will render here. config.headerConfig.logo
controls the style of this box.
D.2 (text)
Optional text
will render here. config.headerConfig.typography
controls the style of this box.
E
This is HTML iframe element which loads the App. config.iframeConfig
controls the style of this box.
UI Layout for Popup Mode
An embedded Airkit application will be formatted according to Popup Mode when:
This creates a frame around the application that is formatted as follows:
The box labeled F is where the body of the application will be displayed. All other boxes are customizable formatting elements that frame the application.
A
This HTML Div element is injected to DOM. The position must be set to fixed with appropriate z-index. The floating button and popup panel render inside this element. The position of the floating button is controlled by this box’s style. config.renderConfig.containerStyle
controls the style of this box.
B
This is an HTML Div element. It contains the UI generated by the SDK for popup panel. config.renderConfig.panel
controls the style of this box. The SDK will change height
and opacity
of this element when floating button or action icon buttons are clicked. Animation can be passed to these two properties as part of config.renderConfig.panel.style
.
C
This is an optional header. config.headerConfig.headerStyle
controls the style of this box.
D
This is a trademarkBox
in the header. It holds a logo
and/or text
. config.headerConfig.trademarkBoxStyle
controls the style of this box.
D.1 (logo)
Optional logo
will render here. config.headerConfig.logo
controls the style of this box.
D.2 (text)
Optional text
will render here. config.headerConfig.typography
controls the style of this box.
E
This is a actionsBox
in the header. It holds minimize
and/or close
icon buttons. config.headerConfig.trademarkStyle
controls the style of this box.
E.1 (minimize)
Optional minimize
icon button will render here. config.headerConfig.minimize
controls the style of this box.
E.2 (close)
Optional close
icon button will render here. config.headerConfig.close
controls the style of this box.
F
This is HTML iframe element which loads the App. config.iframeConfig
controls the style of this box.
G
This is an HTML Div element. It renders the floating button. config.renderConfig.button
controls the style of this box.
G.1
The image displayed in this box changes depending on if the popup panel is open or closed. config.renderConfig.button
controls the style of this box.
Last updated