Bundle Element Call with Element Web packages (#29309)
* Embed Element Call into Element Web packages Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Pass rageshakeSubmitUrl & posthogApiHost to EC widget Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update snapshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Use @vector-im/element-call-embedded * Only pass posthog params to EC if Analytics is enabled Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix test mock Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update EC params to match https://github.com/element-hq/element-call/pull/3089 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update to latest element-call package Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * yarn.lock Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update to element-call-embedded@ v0.9.0-rc.1 * Gate Sentry params behind analytics consent Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update to element-call-embedded v0.9.0-rc.4 * Update Element Call embedded to 0.9.0 release Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: Hugh Nimmo-Smith <hughns@element.io>
This commit is contained in:
committed by
GitHub
parent
209ab59978
commit
8bb4d44532
@@ -49,8 +49,9 @@ import { WidgetMessagingStore } from "../../../src/stores/widgets/WidgetMessagin
|
||||
import ActiveWidgetStore, { ActiveWidgetStoreEvent } from "../../../src/stores/ActiveWidgetStore";
|
||||
import { ElementWidgetActions } from "../../../src/stores/widgets/ElementWidgetActions";
|
||||
import SettingsStore from "../../../src/settings/SettingsStore";
|
||||
import { PosthogAnalytics } from "../../../src/PosthogAnalytics";
|
||||
import { Anonymity, PosthogAnalytics } from "../../../src/PosthogAnalytics";
|
||||
import { type SettingKey } from "../../../src/settings/Settings.tsx";
|
||||
import SdkConfig from "../../../src/SdkConfig.ts";
|
||||
|
||||
jest.spyOn(MediaDeviceHandler, "getDevices").mockResolvedValue({
|
||||
[MediaDeviceKindEnum.AudioInput]: [
|
||||
@@ -664,6 +665,7 @@ describe("ElementCall", () => {
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
({ client, room, alice } = setUpClientRoomAndStores());
|
||||
SdkConfig.reset();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -683,6 +685,23 @@ describe("ElementCall", () => {
|
||||
Call.get(room)?.destroy();
|
||||
});
|
||||
|
||||
it("should use element call URL from developer settings if present", async () => {
|
||||
const originalGetValue = SettingsStore.getValue;
|
||||
SettingsStore.getValue = (name: SettingKey, roomId: string | null = null, excludeDefault = false): any => {
|
||||
if (name === "Developer.elementCallUrl") {
|
||||
return "https://call.element.dev";
|
||||
}
|
||||
return excludeDefault
|
||||
? originalGetValue(name, roomId, excludeDefault)
|
||||
: originalGetValue(name, roomId, excludeDefault);
|
||||
};
|
||||
await ElementCall.create(room);
|
||||
const call = ElementCall.get(room);
|
||||
expect(call?.widget.url.startsWith("https://call.element.dev/")).toBeTruthy();
|
||||
SettingsStore.getValue = originalGetValue;
|
||||
call?.destroy();
|
||||
});
|
||||
|
||||
it("finds ongoing calls that are created by the session manager", async () => {
|
||||
// There is an existing session created by another user in this room.
|
||||
client.matrixRTC.getRoomSession.mockReturnValue({
|
||||
@@ -758,7 +777,14 @@ describe("ElementCall", () => {
|
||||
SettingsStore.getValue = originalGetValue;
|
||||
});
|
||||
|
||||
it("passes analyticsID through widget URL", async () => {
|
||||
it("passes analyticsID and posthog params through widget URL", async () => {
|
||||
SdkConfig.put({
|
||||
posthog: {
|
||||
api_host: "https://posthog",
|
||||
project_api_key: "DEADBEEF",
|
||||
},
|
||||
});
|
||||
jest.spyOn(PosthogAnalytics.instance, "getAnonymity").mockReturnValue(Anonymity.Pseudonymous);
|
||||
client.getAccountData.mockImplementation((eventType: string) => {
|
||||
if (eventType === PosthogAnalytics.ANALYTICS_EVENT_TYPE) {
|
||||
return new MatrixEvent({ content: { id: "123456789987654321", pseudonymousAnalyticsOptIn: true } });
|
||||
@@ -771,6 +797,9 @@ describe("ElementCall", () => {
|
||||
|
||||
const urlParams = new URLSearchParams(new URL(call.widget.url).hash.slice(1));
|
||||
expect(urlParams.get("analyticsID")).toBe("123456789987654321");
|
||||
expect(urlParams.get("posthogUserId")).toBe("123456789987654321");
|
||||
expect(urlParams.get("posthogApiHost")).toBe("https://posthog");
|
||||
expect(urlParams.get("posthogApiKey")).toBe("DEADBEEF");
|
||||
call.destroy();
|
||||
});
|
||||
|
||||
@@ -788,7 +817,7 @@ describe("ElementCall", () => {
|
||||
if (!(call instanceof ElementCall)) throw new Error("Failed to create call");
|
||||
|
||||
const urlParams = new URLSearchParams(new URL(call.widget.url).hash.slice(1));
|
||||
expect(urlParams.get("analyticsID")).toBe("");
|
||||
expect(urlParams.get("analyticsID")).toBeFalsy();
|
||||
call.destroy();
|
||||
});
|
||||
|
||||
@@ -827,7 +856,7 @@ describe("ElementCall", () => {
|
||||
if (!(call instanceof ElementCall)) throw new Error("Failed to create call");
|
||||
|
||||
const urlParams = new URLSearchParams(new URL(call.widget.url).hash.slice(1));
|
||||
expect(urlParams.get("analyticsID")).toBe("");
|
||||
expect(urlParams.get("analyticsID")).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user