Expose single trackCallReconnecting() entry point on PosthogAnalytics

This commit is contained in:
fkwp
2026-05-07 15:10:54 +02:00
parent 533c4fea09
commit 7cedc308ca
3 changed files with 17 additions and 14 deletions

View File

@@ -696,12 +696,8 @@ describe("LocalMembership", () => {
it("fires CallReconnecting with the homeserver reason when homeserver disconnects", async () => {
const scope = new ObservableScope();
const trackSpy = vi.spyOn(
PosthogAnalytics.instance.eventCallReconnecting,
"track",
);
const cacheSpy = vi.spyOn(
PosthogAnalytics.instance.eventCallEnded,
"cacheReconnecting",
PosthogAnalytics.instance,
"trackCallReconnecting",
);
const hsConnected$ = new BehaviorSubject<boolean>(true);
@@ -738,7 +734,6 @@ describe("LocalMembership", () => {
defaultCreateLocalMemberValues.callId,
"syncing",
);
expect(cacheSpy).toHaveBeenCalledWith("syncing");
scope.end();
});
@@ -746,8 +741,8 @@ describe("LocalMembership", () => {
it("reports livekit reason when livekit disconnects but homeserver is fine", async () => {
const scope = new ObservableScope();
const trackSpy = vi.spyOn(
PosthogAnalytics.instance.eventCallReconnecting,
"track",
PosthogAnalytics.instance,
"trackCallReconnecting",
);
const connectionState$ = new BehaviorSubject<ConnectionState>(
@@ -795,8 +790,8 @@ describe("LocalMembership", () => {
it("fires one event per reconnection, not once per condition change", async () => {
const scope = new ObservableScope();
const trackSpy = vi.spyOn(
PosthogAnalytics.instance.eventCallReconnecting,
"track",
PosthogAnalytics.instance,
"trackCallReconnecting",
);
const hsConnected$ = new BehaviorSubject<boolean>(true);

View File

@@ -536,8 +536,7 @@ export const createLocalMembership$ = ({
)
.subscribe(([_, homeserverReason]) => {
const reason = homeserverReason !== null ? homeserverReason : "livekit";
PosthogAnalytics.instance.eventCallReconnecting.track(callId, reason);
PosthogAnalytics.instance.eventCallEnded.cacheReconnecting(reason);
PosthogAnalytics.instance.trackCallReconnecting(callId, reason);
});
// inform the widget about the connect and disconnect intent from the user.