Merge branch 'develop' of github.com:thecodingmachine/workadventure
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
import {POSTHOG_API_KEY, POSTHOG_URL} from "../Enum/EnvironmentVariable";
|
import { POSTHOG_API_KEY, POSTHOG_URL } from "../Enum/EnvironmentVariable";
|
||||||
|
|
||||||
class AnalyticsClient {
|
class AnalyticsClient {
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
private posthogPromise: Promise<any>;
|
private posthogPromise: Promise<any>;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (POSTHOG_API_KEY && POSTHOG_URL) {
|
if (POSTHOG_API_KEY && POSTHOG_URL) {
|
||||||
this.posthogPromise = import('posthog-js').then(({default: posthog}) => {
|
this.posthogPromise = import("posthog-js").then(({ default: posthog }) => {
|
||||||
posthog.init(POSTHOG_API_KEY, { api_host: POSTHOG_URL, disable_cookie: true });
|
posthog.init(POSTHOG_API_KEY, { api_host: POSTHOG_URL, disable_cookie: true });
|
||||||
return posthog;
|
return posthog;
|
||||||
});
|
});
|
||||||
@@ -17,45 +16,59 @@ class AnalyticsClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
identifyUser(uuid: string) {
|
identifyUser(uuid: string) {
|
||||||
this.posthogPromise.then(posthog => {
|
this.posthogPromise
|
||||||
posthog.identify(uuid, { uuid, wa: true });
|
.then((posthog) => {
|
||||||
}).catch();
|
posthog.identify(uuid, { uuid, wa: true });
|
||||||
|
})
|
||||||
|
.catch();
|
||||||
}
|
}
|
||||||
|
|
||||||
loggedWithSso() {
|
loggedWithSso() {
|
||||||
this.posthogPromise.then(posthog => {
|
this.posthogPromise
|
||||||
posthog.capture('wa-logged-sso');
|
.then((posthog) => {
|
||||||
}).catch();
|
posthog.capture("wa-logged-sso");
|
||||||
|
})
|
||||||
|
.catch();
|
||||||
}
|
}
|
||||||
|
|
||||||
loggedWithToken() {
|
loggedWithToken() {
|
||||||
this.posthogPromise.then(posthog => {
|
this.posthogPromise
|
||||||
posthog.capture('wa-logged-token');
|
.then((posthog) => {
|
||||||
}).catch();
|
posthog.capture("wa-logged-token");
|
||||||
|
})
|
||||||
|
.catch();
|
||||||
}
|
}
|
||||||
|
|
||||||
enteredRoom(roomId: string) {
|
enteredRoom(roomId: string) {
|
||||||
this.posthogPromise.then(posthog => {
|
this.posthogPromise
|
||||||
posthog.capture('$pageView', {roomId});
|
.then((posthog) => {
|
||||||
}).catch();
|
posthog.capture("$pageView", { roomId });
|
||||||
|
})
|
||||||
|
.catch();
|
||||||
}
|
}
|
||||||
|
|
||||||
openedMenu() {
|
openedMenu() {
|
||||||
this.posthogPromise.then(posthog => {
|
this.posthogPromise
|
||||||
posthog.capture('wa-opened-menu');
|
.then((posthog) => {
|
||||||
}).catch();
|
posthog.capture("wa-opened-menu");
|
||||||
|
})
|
||||||
|
.catch();
|
||||||
}
|
}
|
||||||
|
|
||||||
launchEmote(emote: string) {
|
launchEmote(emote: string) {
|
||||||
this.posthogPromise.then(posthog => {
|
this.posthogPromise
|
||||||
posthog.capture('wa-emote-launch', {emote});
|
.then((posthog) => {
|
||||||
}).catch();
|
posthog.capture("wa-emote-launch", { emote });
|
||||||
|
})
|
||||||
|
.catch();
|
||||||
}
|
}
|
||||||
|
|
||||||
enteredJitsi(roomName: string, roomId: string) {
|
enteredJitsi(roomName: string, roomId: string) {
|
||||||
this.posthogPromise.then(posthog => {
|
this.posthogPromise
|
||||||
posthog.capture('wa-entered-jitsi', {roomName, roomId});
|
.then((posthog) => {
|
||||||
}).catch();
|
posthog.capture("wa-entered-jitsi", { roomName, roomId });
|
||||||
|
})
|
||||||
|
.catch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const analyticsClient = new AnalyticsClient();
|
export const analyticsClient = new AnalyticsClient();
|
||||||
|
|||||||
@@ -68,9 +68,9 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.emote-menu {
|
.emote-menu {
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -9,7 +9,6 @@ class EmoteEventStream {
|
|||||||
private _stream: Subject<EmoteEvent> = new Subject();
|
private _stream: Subject<EmoteEvent> = new Subject();
|
||||||
public stream = this._stream.asObservable();
|
public stream = this._stream.asObservable();
|
||||||
|
|
||||||
|
|
||||||
fire(userId: number, emote: string) {
|
fire(userId: number, emote: string) {
|
||||||
this._stream.next({ userId, emote });
|
this._stream.next({ userId, emote });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const DISPLAY_TERMS_OF_USE = process.env.DISPLAY_TERMS_OF_USE == "true";
|
|||||||
export const NODE_ENV = process.env.NODE_ENV || "development";
|
export const NODE_ENV = process.env.NODE_ENV || "development";
|
||||||
export const CONTACT_URL = process.env.CONTACT_URL || undefined;
|
export const CONTACT_URL = process.env.CONTACT_URL || undefined;
|
||||||
export const PROFILE_URL = process.env.PROFILE_URL || undefined;
|
export const PROFILE_URL = process.env.PROFILE_URL || undefined;
|
||||||
export const POSTHOG_API_KEY: string = process.env.POSTHOG_API_KEY as string || '';
|
export const POSTHOG_API_KEY: string = (process.env.POSTHOG_API_KEY as string) || "";
|
||||||
export const POSTHOG_URL = process.env.POSTHOG_URL || undefined;
|
export const POSTHOG_URL = process.env.POSTHOG_URL || undefined;
|
||||||
|
|
||||||
export const isMobile = (): boolean => window.innerWidth <= 800 || window.innerHeight <= 600;
|
export const isMobile = (): boolean => window.innerWidth <= 800 || window.innerHeight <= 600;
|
||||||
|
|||||||
@@ -300,20 +300,18 @@ export abstract class Character extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createStartTransition(emoteY: number) {
|
private createStartTransition(emoteY: number) {
|
||||||
if (this.emote) {
|
this.emoteTween = this.scene?.tweens.add({
|
||||||
this.emoteTween = this.scene?.tweens.add({
|
targets: this.emote,
|
||||||
targets: this.emote,
|
props: {
|
||||||
props: {
|
alpha: 1,
|
||||||
alpha: 1,
|
y: emoteY,
|
||||||
y: emoteY,
|
},
|
||||||
},
|
ease: "Power2",
|
||||||
ease: "Power2",
|
duration: 500,
|
||||||
duration: 500,
|
onComplete: () => {
|
||||||
onComplete: () => {
|
this.startPulseTransition(emoteY);
|
||||||
this.startPulseTransition(emoteY);
|
},
|
||||||
},
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private startPulseTransition(emoteY: number) {
|
private startPulseTransition(emoteY: number) {
|
||||||
|
|||||||
@@ -644,9 +644,9 @@ export class GameScene extends DirtyScene {
|
|||||||
} else {
|
} else {
|
||||||
this.userInputManager.restoreControls();
|
this.userInputManager.restoreControls();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
Promise.all([ this.connectionAnswerPromise as Promise<unknown>, ...scriptPromises ]).then(() => {
|
Promise.all([this.connectionAnswerPromise as Promise<unknown>, ...scriptPromises]).then(() => {
|
||||||
this.scene.wake();
|
this.scene.wake();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1511,7 +1511,7 @@ export class GameScene extends DirtyScene {
|
|||||||
} else {
|
} else {
|
||||||
emoteMenuStore.openEmoteMenu();
|
emoteMenuStore.openEmoteMenu();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.CurrentPlayer.on(requestEmoteEventName, (emoteKey: string) => {
|
this.CurrentPlayer.on(requestEmoteEventName, (emoteKey: string) => {
|
||||||
this.connection?.emitEmoteEvent(emoteKey);
|
this.connection?.emitEmoteEvent(emoteKey);
|
||||||
analyticsClient.launchEmote(emoteKey);
|
analyticsClient.launchEmote(emoteKey);
|
||||||
|
|||||||
@@ -84,5 +84,4 @@ export class Player extends Character {
|
|||||||
public isMoving(): boolean {
|
public isMoving(): boolean {
|
||||||
return this.wasMoving;
|
return this.wasMoving;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import { get, writable } from "svelte/store";
|
|||||||
import Timeout = NodeJS.Timeout;
|
import Timeout = NodeJS.Timeout;
|
||||||
import { userIsAdminStore } from "./GameStore";
|
import { userIsAdminStore } from "./GameStore";
|
||||||
import { CONTACT_URL } from "../Enum/EnvironmentVariable";
|
import { CONTACT_URL } from "../Enum/EnvironmentVariable";
|
||||||
import {analyticsClient} from "../Administration/AnalyticsClient";
|
import { analyticsClient } from "../Administration/AnalyticsClient";
|
||||||
|
|
||||||
export const menuIconVisiblilityStore = writable(false);
|
export const menuIconVisiblilityStore = writable(false);
|
||||||
export const menuVisiblilityStore = writable(false);
|
export const menuVisiblilityStore = writable(false);
|
||||||
menuVisiblilityStore.subscribe((value) => {
|
menuVisiblilityStore.subscribe((value) => {
|
||||||
if (value) analyticsClient.openedMenu();
|
if (value) analyticsClient.openedMenu();
|
||||||
})
|
});
|
||||||
export const menuInputFocusStore = writable(false);
|
export const menuInputFocusStore = writable(false);
|
||||||
export const userIsConnected = writable(false);
|
export const userIsConnected = writable(false);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ import { Game } from "./Phaser/Game/Game";
|
|||||||
import App from "./Components/App.svelte";
|
import App from "./Components/App.svelte";
|
||||||
import { HtmlUtils } from "./WebRtc/HtmlUtils";
|
import { HtmlUtils } from "./WebRtc/HtmlUtils";
|
||||||
import WebGLRenderer = Phaser.Renderer.WebGL.WebGLRenderer;
|
import WebGLRenderer = Phaser.Renderer.WebGL.WebGLRenderer;
|
||||||
import {analyticsClient} from "./Administration/AnalyticsClient";
|
import { analyticsClient } from "./Administration/AnalyticsClient";
|
||||||
|
|
||||||
const { width, height } = coWebsiteManager.getGameSize();
|
const { width, height } = coWebsiteManager.getGameSize();
|
||||||
const valueGameQuality = localUserStore.getGameQualityValue();
|
const valueGameQuality = localUserStore.getGameQualityValue();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|||||||
import sveltePreprocess from "svelte-preprocess";
|
import sveltePreprocess from "svelte-preprocess";
|
||||||
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
||||||
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
|
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
|
||||||
import {POSTHOG_API_KEY, PROFILE_URL} from "./src/Enum/EnvironmentVariable";
|
import { POSTHOG_API_KEY, PROFILE_URL } from "./src/Enum/EnvironmentVariable";
|
||||||
|
|
||||||
const mode = process.env.NODE_ENV ?? "development";
|
const mode = process.env.NODE_ENV ?? "development";
|
||||||
const buildNpmTypingsForApi = !!process.env.BUILD_TYPINGS;
|
const buildNpmTypingsForApi = !!process.env.BUILD_TYPINGS;
|
||||||
|
|||||||
Reference in New Issue
Block a user