All promises are now handled

This commit is contained in:
David Négrier 2022-01-04 16:48:47 +01:00
parent 6e27ffb2d5
commit 24baf5664c
21 changed files with 262 additions and 208 deletions

View file

@ -18,64 +18,84 @@ class AnalyticsClient {
}
identifyUser(uuid: string, email: string | null) {
this.posthogPromise?.then((posthog) => {
posthog.identify(uuid, { uuid, email, wa: true });
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.identify(uuid, { uuid, email, wa: true });
})
.catch((e) => console.error(e));
}
loggedWithSso() {
this.posthogPromise?.then((posthog) => {
posthog.capture("wa-logged-sso");
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.capture("wa-logged-sso");
})
.catch((e) => console.error(e));
}
loggedWithToken() {
this.posthogPromise?.then((posthog) => {
posthog.capture("wa-logged-token");
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.capture("wa-logged-token");
})
.catch((e) => console.error(e));
}
enteredRoom(roomId: string, roomGroup: string | null) {
this.posthogPromise?.then((posthog) => {
posthog.capture("$pageView", { roomId, roomGroup });
posthog.capture("enteredRoom");
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.capture("$pageView", { roomId, roomGroup });
posthog.capture("enteredRoom");
})
.catch((e) => console.error(e));
}
openedMenu() {
this.posthogPromise?.then((posthog) => {
posthog.capture("wa-opened-menu");
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.capture("wa-opened-menu");
})
.catch((e) => console.error(e));
}
launchEmote(emote: string) {
this.posthogPromise?.then((posthog) => {
posthog.capture("wa-emote-launch", { emote });
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.capture("wa-emote-launch", { emote });
})
.catch((e) => console.error(e));
}
enteredJitsi(roomName: string, roomId: string) {
this.posthogPromise?.then((posthog) => {
posthog.capture("wa-entered-jitsi", { roomName, roomId });
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.capture("wa-entered-jitsi", { roomName, roomId });
})
.catch((e) => console.error(e));
}
validationName() {
this.posthogPromise?.then((posthog) => {
posthog.capture("wa-name-validation");
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.capture("wa-name-validation");
})
.catch((e) => console.error(e));
}
validationWoka(scene: string) {
this.posthogPromise?.then((posthog) => {
posthog.capture("wa-woka-validation", { scene });
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.capture("wa-woka-validation", { scene });
})
.catch((e) => console.error(e));
}
validationVideo() {
this.posthogPromise?.then((posthog) => {
posthog.capture("wa-video-validation");
}).catch(e => console.error(e));
this.posthogPromise
?.then((posthog) => {
posthog.capture("wa-video-validation");
})
.catch((e) => console.error(e));
}
}
export const analyticsClient = new AnalyticsClient();