Bump matrix-js-sdk to latest (#2946)

Co-authored-by: Timo <toger5@hotmail.de>
This commit is contained in:
Hugh Nimmo-Smith
2025-01-16 15:31:05 +00:00
committed by GitHub
parent 0f2e67dd60
commit 723fa290ff
3 changed files with 21 additions and 13 deletions

View File

@@ -15,4 +15,12 @@ declare module "matrix-js-sdk/src/types" {
export interface TimelineEvents {
[ElementCallReactionEventType]: ECallReactionEventContent;
}
export interface AccountDataEvents {
// Analytics account data event
"im.vector.analytics": {
id: string;
pseudonymousAnalyticsOptIn?: boolean;
};
}
}

View File

@@ -91,7 +91,7 @@ export class PosthogAnalytics {
* 1. Declare a type for the event, extending IPosthogEvent.
*/
private static ANALYTICS_EVENT_TYPE = "im.vector.analytics";
private static ANALYTICS_EVENT_TYPE = "im.vector.analytics" as const;
// set true during the constructor if posthog config is present, otherwise false
private static internalInstance: PosthogAnalytics | null = null;
@@ -272,14 +272,14 @@ export class PosthogAnalytics {
private async getAnalyticsId(): Promise<string | null> {
const client: MatrixClient = window.matrixclient;
let accountAnalyticsId;
let accountAnalyticsId: string | null;
if (widget) {
accountAnalyticsId = getUrlParams().analyticsID;
} else {
const accountData = await client.getAccountDataFromServer(
PosthogAnalytics.ANALYTICS_EVENT_TYPE,
);
accountAnalyticsId = accountData?.id;
accountAnalyticsId = accountData?.id ?? null;
}
if (accountAnalyticsId) {
// we dont just use the element web analytics ID because that would allow to associate