@snap/camera-kit
Version:
Camera Kit Web
40 lines • 2.3 kB
TypeScript
import * as blizzard from "../generated-proto/blizzard/cameraKitEvents";
import type { MetricsClient } from "../clients/metricsClient";
import type { CameraKitConfiguration } from "../configuration";
import type { RemoteConfiguration } from "../remote-configuration/remoteConfiguration";
import type { MetricsEventTarget } from "./metricsEventTarget";
/**
* Translate between an external metric name, which is exposed to SDK users, and an internal Blizzard event name,
* property name, and constructor.
*
* It is very important that we do this, since the naming of these internal business events are unintuitive and will
* not make sense to SDK users.
*
* For a full list of business events (using their internal names), see:
* https://docs.google.com/document/d/1-kSzFWCWw9Qo3D08FR1_cqeHTsUtk9p3p3uOptzWDTY/
*/
type CameraKitBusinessEventMap = {
assetDownload: MakeBusinessEvent<blizzard.CameraKitAssetDownload>;
assetValidationFailed: MakeBusinessEvent<blizzard.CameraKitAssetValidationFailed>;
benchmarkComplete: MakeBusinessEvent<blizzard.CameraKitWebBenchmarkComplete>;
exception: MakeBusinessEvent<blizzard.CameraKitException>;
legalPrompt: MakeBusinessEvent<blizzard.CameraKitLegalPrompt>;
lensDownload: MakeBusinessEvent<blizzard.CameraKitLensDownload>;
lensView: MakeBusinessEvent<blizzard.CameraKitWebLensSwipe>;
lensWait: MakeBusinessEvent<blizzard.CameraKitLensSpin>;
lensContentValidationFailed: MakeBusinessEvent<blizzard.CameraKitLensContentValidationFailed>;
session: MakeBusinessEvent<blizzard.CameraKitSession>;
};
export type MakeBusinessEvent<E> = Omit<{
[K in keyof E]: Exclude<E[K], undefined> extends Record<keyof any, any> ? MakeBusinessEvent<Exclude<E[K], undefined>> : E[K];
}, "cameraKitEventBase">;
export type MakeTaggedBusinessEvent<K extends keyof CameraKitBusinessEventMap> = {
name: K;
} & CameraKitBusinessEventMap[K];
export declare const businessEventsReporterFactory: {
(args_0: MetricsEventTarget, args_1: MetricsClient, args_2: CameraKitConfiguration, args_3: RemoteConfiguration): void;
token: "businessEventsReporter";
dependencies: readonly ["metricsEventTarget", "metricsClient", "configuration", "remoteConfiguration"];
};
export {};
//# sourceMappingURL=businessEventsReporter.d.ts.map