Dictation Bar Component


Dictation Bar Component

This component is available in the dist/libs/integrations/invox-bar folder of the npm package.

Dictation Bar is a high-level component designed to be integrated quickly and easily in your web application.

Getting started

1. Import resources

Install the SDK via npm:

npm install @invox-medical-npm/invox-dictation

Then import BarComponent as a named export:

import INVOX, { BarComponent } from "@invox-medical-npm/invox-dictation";

Component styles are auto-injected at runtime — no separate CSS import needed.

2. Initialize the component

  1. Create a container in the DOM with a unique identifier:
    <div id="invox-bar"></div>
    
  2. Create and show the component:
    const invoxbar = BarComponent.create("invox-bar");
    invoxbar.show();
    

3. Login

The following code connects directly to the Remote Dictation Service:

const credentials = {
    user: "provided_username",
    password: "provided_password"
}

const connectToRemote = {
    host: "invox-sd-v2.invoxmedical.com",
    port: "443",
    useDictationService: true
}

try {
    await invoxbar.login(credentials, connectToRemote);
    INVOX.LogInfo("Remote Dictation Service connected successfully.");
} catch (error) {
    INVOX.LogError("Remote Dictation Service not found.");
}

4. Logout

invoxbar.logout()
    .then((result) => console.log("Successful logout!"))
    .catch((e) => console.error(e));

Public methods

create

FunctionDescriptionParametersReturns
createCreates the element in the DOM. Not visible by default.Stringvoid
const invoxbar = BarComponent.create("invox-bar");

show

FunctionDescriptionParametersReturns
showDisplays component in the user interface.—void
invoxbar.show();

hide

FunctionDescriptionParametersReturns
hideHides Dictation Bar Component to user.—void
invoxbar.hide();

remove

FunctionDescriptionParametersReturns
removeRemoves the element from the DOM.—void
invoxbar.remove();

login

FunctionDescriptionParametersReturns
loginConnect to Invox Dictation service.Object, ObjectPromise<void>

Parameters:

  • credentials: Object
    • user: String
    • password: String
  • connectionConfig: Object
    • host: String
    • port: String
    • useDictationService: Boolean — true for Remote. ::
invoxbar.login(credentials, connectionConfig)
    .then(() => console.log("Successful login!"))
    .catch((e) => console.error(e));

logout

FunctionDescriptionParametersReturns
logoutDisconnect from Invox Dictation service.—Promise<boolean>
invoxbar.logout()
    .then((result) => console.log("Successful logout!"))
    .catch((e) => console.error(e));

Customize design

The bar component includes CSS variables in the auto-injected stylesheet for easy customization:

VariableDescriptionDefault
--invox-bar-size__widthWidth100%
--invox-bar-size__heightHeight30px
--invox-bar-color__primaryPrimary color#52619f
--invox-bar-color__secondarySecondary color#6d7cba
--invox-bar-color__errorError color#ff9191
--invox-bar-color__microphoneMicrophone button colorred
--invox-bar-color__vumeter-bars--activeVUMeter active color#3adf3a
--invox-bar-font__colorFont colorwhite
--invox-bar-font__sizeFont size0.9rem

How to use

Dictation Bar Component elements

  1. Loading progress percentage — Displays the load percentage at login.
  2. Actions menu — Display a list of the current user actions like templates / dictionary.
  3. AI menu — Opens the AI options menu, like intelligent formatting or auto fill templates.
  4. Dictation button (Recognizer) — Start or stop voice recognition.
  5. Audio level indicator — Displays the audio level activity during the session.
  6. Status bar & Hypothesis viewer — Displays session status messages and recognized hypothesis during dictation.
  7. Profile button — Opens the user profile.
  8. User name — Displays the name of the current logged user.
  9. About menu — Opens the About menu.

How to dictate

Dictation Bar microphone tutorial

  1. Click the Dictation button to start recognizer.
  2. Dictate your medical report.
  3. Click again on the Dictation button to stop recognizer.

Reset component at runtime

For single-page applications (SPA) where you need to regenerate the Dictation Bar without reloading the page:

function resetComponent(credentials, connectionConfig) {
    // Step 1. Logout is absolutely necessary even if an error has occurred.
    invoxbar.logout()
        .catch((e) => console.error(e))
        .finally(() => {
            // Step 2. Remove from the DOM.
            invoxbar.remove();

            // Step 3. Create the dictation bar again.
            invoxbar = BarComponent.create("invox-bar");

            // Step 4. Connect to Invox Dictation service again.
            invoxbar.login(credentials, connectionConfig)
                .then(() => console.log("Successful login!"))
                .catch((e) => console.error(e));
        })
}