UNPKG

@scandit/web-barcode-link

Version:

The Scandit Web Barcode Link package

50 lines (49 loc) 1.63 kB
export declare enum METRIC_EVENT_NAME { REQUEST_COUNTER = "requests_count_total", STARTED_COUNTER = "started_count_total", COMPLETED_COUNTER = "completed_count_total", WEBSOCKET_CONNECTION_ATTEMPTS_COUNTER = "websocket_connection_attempts_total", WEBSOCKET_CONNECTION_SUCCESSFUL_COUNTER = "websocket_connection_successful_total", COMPLETION_TIME_SECONDS = "completion_time_seconds" } /** * The "local" context is Barcode Link loaded as an iframe from the customer's website. * * The "remote" context is everything happening on the remote device which loaded Barcode Link * by scanning the QR code. This device is usually a smartphone or a tablet. */ export type Context = "local" | "remote"; export type MetricEvent = { name: METRIC_EVENT_NAME.REQUEST_COUNTER; context: Context; } | { name: METRIC_EVENT_NAME.STARTED_COUNTER; context: Context; browser: string; browserVersion: string; } | { name: METRIC_EVENT_NAME.COMPLETED_COUNTER; context: Context; browser: string; browserVersion: string; } | { name: METRIC_EVENT_NAME.WEBSOCKET_CONNECTION_ATTEMPTS_COUNTER; context: Context; browser: string; browserVersion: string; } | { name: METRIC_EVENT_NAME.WEBSOCKET_CONNECTION_SUCCESSFUL_COUNTER; context: Context; browser: string; browserVersion: string; } | { name: METRIC_EVENT_NAME.COMPLETION_TIME_SECONDS; timeSeconds: number; }; type Prettify<T> = { [K in keyof T]: T[K]; } & {}; export type MetricPayload<E extends METRIC_EVENT_NAME> = Prettify<Omit<Extract<MetricEvent, { name: E; }>, "name">>; export {};