@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
43 lines • 2.72 kB
TypeScript
import type { LiveAppManifest } from "./types";
/**
* This signature is to be compatible with track method of `segment.js` file in LLM and LLD
* `track(event: string, properties: ?Object, mandatory: ?boolean)` in jsflow
* {@link @ledger-desktop/renderer/analytics/segment#track}
*/
type TrackPlatform = (event: string, properties: Record<string, any> | null, mandatory: boolean | null) => void;
/**
* Wrap call to underlying trackCall function.
* @param trackCall
* @returns a dictionary of event to trigger.
*/
export default function trackingWrapper(trackCall: TrackPlatform): {
readonly platformLoad: (manifest: LiveAppManifest) => void;
readonly platformReload: (manifest: LiveAppManifest) => void;
readonly platformLoadFail: (manifest: LiveAppManifest) => void;
readonly platformLoadSuccess: (manifest: LiveAppManifest) => void;
readonly platformSignTransactionRequested: (manifest: LiveAppManifest) => void;
readonly platformSignTransactionFail: (manifest: LiveAppManifest) => void;
readonly platformSignTransactionSuccess: (manifest: LiveAppManifest) => void;
readonly platformRequestAccountRequested: (manifest: LiveAppManifest) => void;
readonly platformRequestAccountFail: (manifest: LiveAppManifest) => void;
readonly platformRequestAccountSuccess: (manifest: LiveAppManifest) => void;
readonly platformReceiveRequested: (manifest: LiveAppManifest) => void;
readonly platformReceiveFail: (manifest: LiveAppManifest) => void;
readonly platformReceiveSuccess: (manifest: LiveAppManifest) => void;
readonly platformBroadcastFail: (manifest: LiveAppManifest) => void;
readonly platformBroadcastSuccess: (manifest: LiveAppManifest) => void;
readonly platformBroadcastOperationDetailsClick: (manifest: LiveAppManifest) => void;
readonly platformStartExchangeRequested: (manifest: LiveAppManifest) => void;
readonly platformStartExchangeSuccess: (manifest: LiveAppManifest) => void;
readonly platformStartExchangeFail: (manifest: LiveAppManifest) => void;
readonly platformCompleteExchangeRequested: (manifest: LiveAppManifest) => void;
readonly platformCompleteExchangeSuccess: (manifest: LiveAppManifest) => void;
readonly platformCompleteExchangeFail: (manifest: LiveAppManifest) => void;
readonly platformSignMessageRequested: (manifest: LiveAppManifest) => void;
readonly platformSignMessageSuccess: (manifest: LiveAppManifest) => void;
readonly platformSignMessageFail: (manifest: LiveAppManifest) => void;
readonly platformSignMessageUserRefused: (manifest: LiveAppManifest) => void;
};
export type TrackingAPI = ReturnType<typeof trackingWrapper>;
export {};
//# sourceMappingURL=tracking.d.ts.map