2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/src/telemetry/types.ts

49 lines
977 B
TypeScript
Raw Normal View History

import { DoctypeName } from 'models/types';
2022-03-09 11:19:26 +00:00
export type AppVersion = string;
export type UniqueId = string;
export type Timestamp = number;
export interface InteractionEvent {
time: Timestamp;
verb: Verb;
noun: Noun;
more?: Record<string, unknown>;
}
export type Count = Partial<{
[key in DoctypeName]: number;
}>;
2022-03-18 09:21:12 +00:00
export type Platform = 'Windows' | 'Mac' | 'Linux';
export interface Telemetry {
deviceId: UniqueId;
instanceId: UniqueId;
openTime: Timestamp;
2022-03-18 09:21:12 +00:00
platform?: Platform;
closeTime: Timestamp;
timeline?: InteractionEvent[];
counts?: Count;
2022-03-09 11:20:48 +00:00
errors: Record<string, number>;
country: string;
language: string;
2022-03-09 11:19:26 +00:00
version: AppVersion;
}
export enum Verb {
2022-03-09 11:19:26 +00:00
Created = 'created',
Deleted = 'deleted',
Navigated = 'navigated',
2022-03-09 11:19:26 +00:00
Imported = 'imported',
Exported = 'exported',
Stopped = 'stopped',
Started = 'stopped',
}
2022-03-09 11:19:26 +00:00
export enum NounEnum {
Route = 'route',
Telemetry = 'telemetry',
2022-03-09 11:19:26 +00:00
}
export type Noun = string | NounEnum;