Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developer.dromo.io/llms.txt

Use this file to discover all available pages before exploring further.

Overview

onUserEvent is a callback you can register on a DromoUploader instance to receive real-time notifications when a user interacts with specific UI controls inside the importer. It gives your host application observability into what the user is doing — useful for analytics, audit logging, conditional UI reactions, or debugging.

Registration

const importer = new DromoUploader(licenseKey, fields, settings, user);

importer.onUserEvent((event) => {
  console.log(event.eventType, event.payload);
});
The method accepts a single callback function. It can be registered at any point before the user triggers the relevant interaction.
Only one callback can be registered per instance. Calling onUserEvent a second time replaces the first.

Callback Signature

onUserEvent(callback: (event: IUserEvent) => void): void
The callback receives one argument, an IUserEvent object:
interface IUserEvent<T extends EUserEventType = EUserEventType> {
  eventType: T;
  payload: IUserEventPayloadMap[T];
}

Event Types

Currently one event type is emitted:
eventTypeDescription
"BUTTON_CLICK"Fired whenever the user clicks a tracked button in the importer

BUTTON_CLICK Payload

When eventType is "BUTTON_CLICK", the payload is:
interface IButtonClickPayload {
  buttonName: string; // see button name reference below
  step: string;       // the active step when the click occurred
}
step values
ValueStep
"UPLOAD"File upload / manual data entry screen
"HEADER_SELECT"Header row selection screen
"COLUMN_MATCH"Column mapping screen
"SELECT_MATCH"Value / select matching screen
"REVIEW"Data review and validation screen

Button Name Reference

The full set of buttonName values, grouped by step:
ValueDescription
CONTINUEPrimary continue action
NEXTNext step
GO_BACKBack navigation
FINISHFinal submit / finish

Upload step

ValueDescription
UPLOAD_DATAUpload a file
ENTER_DATAOpen manual data entry
DOWNLOAD_TEMPLATEDownload the CSV template
CONFIRM_SHEETConfirm sheet selection (multi-sheet files)

Header select step

ValueDescription
HEADER_SELECT_CONTINUEContinue with selected header row
NO_HEADER_ROWMark file as having no header row

Column match step

ValueDescription
COLUMN_MATCH_IGNOREIgnore an unmatched column
COLUMN_MATCH_REMOVERemove an unmatched column

Select / value match step

ValueDescription
DATE_FIX_ACCEPTAccept suggested date format fix
DATE_FIX_UNDOUndo date format fix
SELECT_MATCH_CLEARClear a single-select match
MULTI_SELECT_MATCH_CLEARClear a multi-select match

Review step

ValueDescription
FIND_AND_REPLACE_OPENOpen find & replace panel
FIND_AND_REPLACE_CONFIRMConfirm a find & replace operation
FIND_AND_REPLACE_CANCELCancel find & replace
SHOW_ROWS_WITH_ERRORSFilter to rows with errors
CLEAR_ROWS_WITH_ERRORS_FILTERClear the error filter
TRANSFORM_DATA_OPENOpen AI transform panel
TRANSFORM_DATA_PREVIEWPreview AI transform results
TRANSFORM_DATA_REGENERATERegenerate AI transform
TRANSFORM_DATA_CONFIRMConfirm AI transform
TRANSFORM_DATA_CANCELCancel AI transform
EXPORT_ALLExport all rows
EXPORT_ERRORS_ONLYExport only rows with errors
DOWNLOAD_XLSXDownload data as XLSX
TOGGLE_SEARCHToggle search bar

Exit confirmation modal

ValueDescription
EXIT_CONFIRMConfirm exit / cancel import
EXIT_CANCELStay in the importer

Generic alert / modal actions

ValueDescription
ALERT_PRIMARYPrimary action on a generic alert
ALERT_SECONDARYSecondary action on a generic alert

Error Handling

Errors thrown inside your onUserEvent callback are caught by Dromo and logged as a warning — they will not crash the importer or interrupt the user’s flow:
[Dromo-External-Error] There was an error in your onUserEvent callback.

Example

importer.onUserEvent((event) => {
  if (event.eventType === "BUTTON_CLICK") {
    const { buttonName, step } = event.payload;

    analytics.track("dromo_button_click", {
      button: buttonName,
      step: step,
      userId: currentUser.id,
    });
  }
});

Notes

  • The callback is fire-and-forget from Dromo’s perspective — the return value is ignored and the importer does not await it.
  • The callback is registered on the importer instance, so each importer instance can have its own independent onUserEvent handler.
  • The callback is not invoked in headless mode (server-side Lambda execution), only during interactive browser sessions.