@dragon-speech-sdk/types package

Classes

EhrAuthenticationClient

Enables the exchange a partner issued access token for one that is usable by the SDK.

Example

const ehrAuthClient = new dragon.authentication.ehr.EhrAuthenticationClient();

async function acquireToken() {
  const accessToken = await ehrAuthClient.acquireToken({
    accessToken: "partner-issued-access-token",
  });
 return accessToken;
}

dragon.initialize({
  // Other initialization options...
  services: "us",
  authentication: {
    acquireAccessToken: acquireToken,
  },
});
EhrAuthenticationError

This error is thrown in cases where an error occurs during EHR token exchange. For detailed error codes refer to <xref:EhrAuthenticationErrorCodes>.

IntegrationError

This error is thrown in cases where an API is called improperly. For detailed error codes refer to IntegrationErrorCodes.

InternalError

This error is thrown when something internal to the SDK fails.

SdkError

Base error class for all SDK errors.

Type Aliases

ApplicationCommandsEvents

Application command events.

Command

A command that can be triggered by an end user by dictating one of the CommandVariants. Commands belong to a CommandSet.

CommandPlaceholder

A command placeholder with a list of possible spoken forms and values.

Example

const placeholder: CommandPlaceholder = {
  id: "patientId",
  label: "name of the patient",
  placeholderValues: [
    { value: "PTN.48389488", spokenForm: "mister Pink" },
    { value: "PTN.48323466", spokenForm: "mister Orange" },
  ]
};
CommandPlaceholderDetail

Details for a CommandPlaceholder within a CommandRecognizedDetail.

CommandPlaceholderValue

A specific value that can be used in a CommandPlaceholder and that values associated spokenForm.

Example

const placeholderValue: CommandPlaceholderValue = {
  value: "PTN.48389488",
  spokenForm: "mister Pink"
};
CommandRecognizedDetail

Event detail for a commandRecognized event. Raised when a Command is recognized.

CommandSet

A grouping for related Commands that can be enabled or disabled together.

CommandType

Application command type.

CommandVariant

A spokenForm and associated displayString for a Command. Must contain only alphabetic characters and spaces, with the exception of placeholders. Commands can have multiple command variants to allow for different ways of saying the same command.

AccessToken

Public AccessToken type used across the SDK.

AuthenticationOptions

Options for configuring authentication.

AcquireTokenRequest

Request parameters for acquiring an EHR token.

AcquireTokenResult

The result of acquiring an EHR access token.

EhrAuthenticationConfiguration

Configuration options for EHR authentication.

ScopeBehavior

Union type representing the available scope behaviors.

ButtonDetail

Represents the details of a supported button device, for example Nuance PowerMic, Philips SpeechMike.

ButtonDeviceEvents

Button device events.

ButtonDevicePermissionRequiredDetail

The event detail indicating if button device permission is required.

HotkeyPressAction

The type definition of a HotkeyPressAction object.

IntegratorActionRequiredOnButtonPressDetail

Event details emitted when an action is required from the integrator when the user presses a button.

The action property can have one of the following values:

  • "transferText": Text transfer is required.
  • "anchorReleaseSpeechFocus": The speech focus should be released from the anchor.
  • "toggleMinimizeRestore": The UI should be toggled between minimized and restored states.
  • "toggleDictationClipboard": The dictation clipboard should be toggled.
  • "executeHotKeyPress": A hotkey press should be executed.

The arguments property can contain an array of strings or KeyboardKey values, depending on the action.

KeyboardKey

Describes a keyboard key and its associated properties. For more information, see KeyboardEvent.

MicrophoneButtonAction

The type definition of a MicrophoneButtonAction which can be either a MicrophoneButtonPressAction, HotkeyPressAction, or StepByStepAction.

MicrophoneButtonPreferences

The type definition of a MicrophoneButtonPreferences object which is part of UserPreferences type.

Correction

A possible correction to the selected text, which can be displayed to users in the correction menu.

CorrectionEvents

Correction events.

ShowCorrectionMenuDetail

Event detail for the showCorrectionMenu event.

CustomControlOptions

Configuration options for custom controls integration with Dragon speech functionality. Defines settings for how custom controls should be detected and handled by the SDK.

ExternalCustomControl

Represents an external custom control that can be integrated with Dragon speech functionality. This type defines the initial structure and properties needed to speech-enable an external text control.

NoDictateDirection

Union type representing the available dictation blocking directions.

ProtectedRange

Represents a protected range within text where dictation behavior is controlled. Used to mark specific areas (like SSN, phone numbers) where dictation should be blocked.

ProtectedSection

Represents a protected section containing multiple protected ranges. Sections group related protected ranges together.

ProtectedTextLayout

Represents the complete protected text layout metadata structure. This is the top-level structure passed to the SDK to define protected areas.

ProcessingStatus

Represents the processing state of a custom control. Indicates whether speech is being processed for a particular control.

ErrorEvents

Error events.

ErrorOccurredDetail

Event detail of an error that occurred within the SDK.

NonSupportedBrowserDetectedDetail

Event detail for when a non-supported browser is detected. Reuses BrowserCompatibilityStatus but omits the isSupported field.

ChangeType
  • preferredMicConnectedNotRecording - While not recording, the preferred mic is plugged in. The preferred mic is used when recording starts.
  • preferredMicConnectedWhileRecording - While recording, the preferred mic is plugged in. Recording will stop if they choose to switch.
  • preferredMicChangedWhileRecording - While recording, the preferred mic is changed. Recording will stop. The new preferred mic is used when recording starts.
  • currentMicDisconnectedNotRecording - While not recording, the current mic is unplugged. The preferred mic or default mic is used when recording starts.
  • currentMicDisconnectedWhileRecording - While recording, the current mic is unplugged. Recording will stop. The preferred mic or default mic is used when recording starts.
Microphone

Info on an available microphone.

MicrophoneEvents

Microphone events.

MicrophoneListChangedDetail

Info on microphones that are currently connected.

MobileMicEvents

Mobile mic events.

PairingStatusChangedDetail

Pairing status changed event.

RemoteButtonKeyName

Represents the valid key name for remote button action. The key sent by the mobile microphone app to trigger action.

RemoteClientEventOccurredDetail

Remote client event. The content is what was received from the remote client.

SeparatedClientPairingEventMap

Client microphone pairing event map.

SeparatedClientPairingEventType

Client microphone pairing event type

PreferredMicrophone

Info about the user's preferred microphone.

FieldDelimiterPreferences

The type definition of a FieldDelimiterPreferences object which is part of UserPreferences type.

NavigationOptions

The navigation options.

AmbientEvents

Ambient recording events.

AmbientRecording

Represents a single ambient recording.

AmbientRecordingUploadStatus

Defines the possible upload statuses for a stopped ambient recording.

  • "uploading": Audio data is currently being uploaded to the server.
  • "uploadCompleted": All audio data has been successfully uploaded and acknowledged by the server.
  • "uploadFailed": Audio upload failed and could not reach the server.

See AmbientRecordingUploadStatusChangedDetail for the event details containing this status.

AmbientRecordingUploadStatusChangedDetail

Event details for when ambient recording is completed.

AmbientSessionData

Data to be used for ambient recording sessions.

AmbientSessionIdChangedDetail

Event detail for the ambientSessionIdChanged event.

DataOrigin

Data origin value for patient and EHR data.

EhrData

EHR specific identifiers.

Gender

Gender value for patient information.

LocaleInfo

Defines the language information for an encounter.

Patient

Patient identifiers.

PronounPreference

Patient's pronoun preferences.

CommonRecordingOptions

Common options for recording-related functionality.

DictationEvents

Dictation events.

DictationProcessingFinishedForElementDetail

The event detail for when processing stops for a specific element.

DictationProcessingStartedForElementDetail

The event detail for when processing starts for a specific element.

DisableRecordingOptions

Options for disabling recording.

EnableRecordingOptions

Options for enabling recording.

RecordingEvents

Recording events.

RecordingMode

Recording modes.

RecordingStartedDetail

The event detail for when recording starts.

RecordingStoppedDetail

The event detail for when recording stops.

RecordingVolumeChangedDetail

The event detail for recording volume.

StartRecordingOptions

Options for starting recording.

StopRecordingOptions

Options for stopping recording.

ToggleRecordingOptions

Options for toggling recording.

SettingViewNavigationRequestedDetail

Event detail for the settingViewsNavigated event.

SettingViewsEvents

Setting views events.

SettingViewsUrls

Setting views URLs.

SpeechOptions

Speech recognition settings.

SpeechTopic

Speech recognition topic (specialty). Can be one of the predefined topics or any custom string.

See <xref:Topics> for predefined medical domain topics.

AdditionalSystemCommandSpokenForms

A mapping from built-in SystemCommand names to arrays of additional spoken forms. Allows custom spoken forms to be added that trigger the same system commands, while preserving their original built-in spoken form.

Example

const additionalForms: AdditionalSystemCommandSpokenForms = {
  scratchThat: ["erase that", "remove that"],
  goToNextField: ["next section", "next element"]
};
BrowserCompatibilityStatus

Contains information about browser support status, version details, and any compatibility issues.

ClientType

Defines the available modes for mobile microphone applications.

  • "VuiForm": Application uses a speech form and requires mobile microphone input.
  • "Audio": Application provides microphone capabilities only.
ConsoleLoggerOptions

Configuration options for the SDK's console logger.

DragonEventTarget

An EventTarget that only allows adding and removing event listeners. It does not provide a way to dispatch events.

ElementDetail

Contains information used to identify the element or external control.

Events

Events at the top level of the SDK.

InitializationOptions

Options for initializing the SDK.

LogLevel

Union type representing the available log levels.

ServiceConfig

Configuration for backend services used by the SDK. Each service requires a URL and OAuth scope for authentication.

SystemCommand

A system command

Functions

destroy()

Asynchronously cleans up resources used by the Dragon Copilot SDK.

This function releases any resources and performs the necessary cleanup. It logs a debug message on successful destruction, and logs an error if an exception occurs.

initialize(InitializationOptions)

Initializes Dragon Copilot SDK for JavaScript with the provided options.

isBrowserSupported()

Checks if the browser type and version are supported.

removeInjectedMarkup(null | Document | Element | Element[])

Removes any injected elements or attributes added to a container by the Dragon Copilot SDK.

setControlFocusContext(FocusContext, number)

Updates the current speech-focus context for the SDK.

This function notifies the SDK about changes in the speech-focus context, allowing it to properly handle speech input and commands based on whether the focus is in a web control or in an external control.

Variables

ClientTypes

The type definition of ClientTypes.

FocusContexts

Speech focus context values. Indicates whether speech-focus is within a web context or an external control context.

LogLevels

Available log levels for console logging. Used to control the verbosity of the SDK's logging.

SystemCommands

The available system commands.

events

The listener only EventTarget for top level events.

Function Details

destroy()

Asynchronously cleans up resources used by the Dragon Copilot SDK.

This function releases any resources and performs the necessary cleanup. It logs a debug message on successful destruction, and logs an error if an exception occurs.

function destroy(): Promise<void>

Returns

Promise<void>

initialize(InitializationOptions)

Initializes Dragon Copilot SDK for JavaScript with the provided options.

function initialize(options: InitializationOptions): Promise<void>

Parameters

options
InitializationOptions

Initialization options.

Returns

Promise<void>

isBrowserSupported()

Checks if the browser type and version are supported.

function isBrowserSupported(): boolean

Returns

boolean

True if the current browser type and version are supported.

removeInjectedMarkup(null | Document | Element | Element[])

Removes any injected elements or attributes added to a container by the Dragon Copilot SDK.

function removeInjectedMarkup(container: null | Document | Element | Element[]): Document | Element | Element[] | null

Parameters

container

null | Document | Element | Element[]

Either a cloned document, an array of disconnected(cloned) html elements or a disconnected(cloned) html element.

Returns

Document | Element | Element[] | null

The container with all SDK-added elements and attributes removed, or null if cleanup fails.

setControlFocusContext(FocusContext, number)

Updates the current speech-focus context for the SDK.

This function notifies the SDK about changes in the speech-focus context, allowing it to properly handle speech input and commands based on whether the focus is in a web control or in an external control.

function setControlFocusContext(focusContext: FocusContext, timestamp: number)

Parameters

focusContext

FocusContext

The current focus context (Web or External)

timestamp

number

The timestamp when the focus context changed, in milliseconds

Variable Details

ClientTypes

The type definition of ClientTypes.

ClientTypes: Readonly<{ Audio: "Audio", VuiForm: "VuiForm" }>

Type

Readonly<{ Audio: "Audio", VuiForm: "VuiForm" }>

FocusContexts

Speech focus context values. Indicates whether speech-focus is within a web context or an external control context.

FocusContexts: Readonly<{ External: "external", Web: "web" }>

Type

Readonly<{ External: "external", Web: "web" }>

LogLevels

Available log levels for console logging. Used to control the verbosity of the SDK's logging.

LogLevels: Readonly<{ Debug: "debug", Error: "error", Exclusive: "exclusive", Info: "info", Trace: "trace", Warning: "warning" }>

Type

Readonly<{ Debug: "debug", Error: "error", Exclusive: "exclusive", Info: "info", Trace: "trace", Warning: "warning" }>

SystemCommands

The available system commands.

SystemCommands: Readonly<{ BeginningOfField: "beginningOfField", CompoundThat: "compoundThat", EndOfField: "endOfField", GoToFirstField: "goToFirstField", GoToLastField: "goToLastField", GoToNextField: "goToNextField", GoToPreviousField: "goToPreviousField", Redo: "redo", ScratchThat: "scratchThat", Undo: "undo" }>

Type

Readonly<{ BeginningOfField: "beginningOfField", CompoundThat: "compoundThat", EndOfField: "endOfField", GoToFirstField: "goToFirstField", GoToLastField: "goToLastField", GoToNextField: "goToNextField", GoToPreviousField: "goToPreviousField", Redo: "redo", ScratchThat: "scratchThat", Undo: "undo" }>

events

The listener only EventTarget for top level events.

events: DragonEventTarget<Events>

Type