Skip to Content
AuraConfiguration

Configuration

Aura Widget supports a multi level configuration architecture.

Sandbox Configuration

The package exposes a configure function to set the sandbox configuration. The widget by default is configured to point to the production sandbox https://anywhere.insighthealth.ai, this allows you to test the widget against any beta environment for testing and development purposes.

import { configure } from '@insight-health/aura'; configure({ insightBaseUrl: 'https://anywhere.lumi.build', });

Or via the InsightAura.configure method for CDN usage.

InsightAura.configure({ insightBaseUrl: 'https://anywhere.lumi.build', });

Make sure the configured insightBaseUrl or the default url https://anywhere.insighthealth.ai is allowed in your frame-src directive in your Content Security Policy.

Configuration Options

PropertyTypeDescription
insightBaseUrl
stringThe Insight base URL to point to a custom instance of the Aura Widget. Default: https://anywhere.insighthealth.ai.
* Required field

Widget Configuration and Initialization

The widget configuration is set using the init method, thats also responsible to for the initial authentication and embedding of the widget. It returns a promise that resolves when the widget is authenticated and ready to use.

import { AuraWidget } from '@insight-health/aura'; AuraWidget.init({ partnerKey: '<partner-key-shared-by-insight-health>', tenantId: 'tenant-id', tenantName?: 'tenant-name', // Optional themeConfig: { primary: '#2563eb', // Optional secondary: '#7c3aed', // Optional }, user: { id: '13', email: 'user@example.com', firstName: 'John', lastName: 'Doe', }, });

Or via the AuraWidget.init method for CDN usage.

InsightAura.AuraWidget.init({ partnerKey: '<partner-key-shared-by-insight-health>', // ... similar options as above });

Configuration Options

PropertyTypeDescription
partnerKey*
stringThe partner key to initialize the Aura Widget under the specific partner scope. (Generated by Insight Health)
tenantId*
stringThe unique identifier for the tenant within the partner scope. The user would be authenticated under this tenant id.
user*
UserThe user object defines the user's identity. See User Properties.
tenantName
stringThe tenant name for the tenant with the given tenant id.
language
stringThe language of the widget. Default: en-US.
themeConfig
ThemeConfigTheme colors for the in-frame widget (hex strings). See Custom Theme for more details.
container
string | HTMLElementThe container to embed the widget in. Default: body.
widgetId
stringThe id of the widget element. Default: aura-widget.
widgetStyles
objectThe styles to apply to the widget. Default: { width: '350px', height: '600px' }.
onAuthenticated
(response: AuthenticationResponse) => voidCallback function invoked when the widget is authenticated and ready. Receives the authentication response object.
* Required field

To authenticate the user under the parent tenant for development purposes, pass parent tenantId provided by Insight Health Team as tenantId.

User

The user object defines the user’s identity and is used for authentication. This object is used in both init and setUser methods.

PropertyTypeDescription
id*
stringA unique identifier for the user in your system.
email*
stringThe user's email address.
firstName
stringThe user's first name.
lastName
stringThe user's last name.
* Required field

Authentication Success

When the widget is successfully authenticated, you can handle this via either a callback or promise-based approach.

Using onAuthenticated callback

AuraWidget.init({ // ...init options onAuthenticated: (response) => { console.log('Widget authenticated:', response); }, });

Using Promise

const response = await AuraWidget.init({ // ...init options }); console.log('Widget authenticated:', response);

Response Payload

Both approaches return the same response payload containing all the options passed to init, plus additional properties:

PropertyTypeDescription
...initOptions
-All the Configuration Options passed to init are returned back.
registeredTemplateIds*
string[]Array of template identifiers registered for the current user session. You can use this to check and register new templates for the user.
* Required field

Show widget

The widget automatically shows itself when a command is sent to the widget after initialization. But you can also show the widget manually using the show method.

AuraWidget.show();

Hide widget

Use the hide method to toggle the widget visibility. This is ideal when navigating between routes or when you want to temporarily hide the widget without destroying it.

AuraWidget.hide();

The widget state is preserved when hidden and can be shown again by sending a command to the widget or by calling the show method.

Reset widget

Use the reset method when you want to completely reset the widget to its initial state.

The reset method removes the widget iframe completely from the DOM. You will need to call AuraWidget.init() again before reusing the widget. For simple visibility toggling, use hide and show instead.

AuraWidget.reset();

Dynamic User Switching

After the widget is initialized, you can dynamically switch to a different user or tenant using the setUser method. This is useful for scenarios where the authenticated user changes without requiring a full page reload, such as multi-user dashboards or session handoffs.

AuraWidget.setUser({ tenantId: 'new-tenant-id', tenantName: 'New Tenant Name', // Optional user: { email: 'newuser@example.com', firstName: 'Jane', lastName: 'Smith', }, language: 'en-US', // Optional });

Or via the InsightAura.AuraWidget.setUser method for CDN usage.

InsightAura.AuraWidget.setUser({ tenantId: 'new-tenant-id', // ... similar options as above });

setUser Options

PropertyTypeDescription
tenantId*
stringThe new tenant identifier.
tenantName
stringThe name of the new tenant.
user*
UserThe new user object. See User Properties.
language
stringThe language for the widget. Default: en-US.
* Required field

Calling setUser triggers a re-authentication flow within the widget. The widget will authenticate the new user and update its state accordingly.

Once the widget is initialized, you can start communicating with the widget through events.

Last updated on