diff --git a/tracker/tracker/CHANGELOG.md b/tracker/tracker/CHANGELOG.md index 7479afc00..1a4f997fa 100644 --- a/tracker/tracker/CHANGELOG.md +++ b/tracker/tracker/CHANGELOG.md @@ -3,6 +3,7 @@ - Option to disable string dictionary `{disableStringDict: true` in Tracker constructor - Introduced Feature flags api - Fixed input durations recorded on programmable autofill +- change InputMode from enum to const Object # 8.1.2 diff --git a/tracker/tracker/src/main/modules/input.ts b/tracker/tracker/src/main/modules/input.ts index b3c86d3f7..375dcb9b6 100644 --- a/tracker/tracker/src/main/modules/input.ts +++ b/tracker/tracker/src/main/modules/input.ts @@ -82,16 +82,18 @@ export function getInputLabel(node: TextFieldElement): string { return normSpaces(label).slice(0, 100) } -export declare const enum InputMode { - Plain = 0, - Obscured = 1, - Hidden = 2, -} +export const InputMode = { + Plain: 0, + Obscured: 1, + Hidden: 2, +} as const + +export type InputModeT = (typeof InputMode)[keyof typeof InputMode] export interface Options { obscureInputNumbers: boolean obscureInputEmails: boolean - defaultInputMode: InputMode + defaultInputMode: InputModeT obscureInputDates: boolean } @@ -108,7 +110,7 @@ export default function (app: App, opts: Partial): void { function getInputValue(id: number, node: TextFieldElement | HTMLSelectElement) { let value = node.value - let inputMode: InputMode = options.defaultInputMode + let inputMode: InputModeT = options.defaultInputMode if (node.type === 'password' || app.sanitizer.isHidden(id)) { inputMode = InputMode.Hidden