Migrate to Vue 3 and Vite
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -73,7 +73,7 @@ function insertLocalAnonymousParticipation(
|
||||
}
|
||||
|
||||
function buildExpiration(event: IEvent): Date {
|
||||
const expiration = event.endsOn || event.beginsOn;
|
||||
const expiration = new Date(event.endsOn ?? event.beginsOn);
|
||||
expiration.setMonth(expiration.getMonth() + 1);
|
||||
return expiration;
|
||||
}
|
||||
|
||||
@@ -6,63 +6,61 @@ import {
|
||||
import { IEventMetadataDescription } from "@/types/event-metadata";
|
||||
import { i18n } from "@/utils/i18n";
|
||||
|
||||
const t = i18n.global.t;
|
||||
|
||||
export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "wheelchair-accessibility",
|
||||
key: "mz:accessibility:wheelchairAccessible",
|
||||
label: i18n.t("Wheelchair accessibility") as string,
|
||||
description: i18n.t(
|
||||
label: t("Wheelchair accessibility") as string,
|
||||
description: t(
|
||||
"Whether the event is accessible with a wheelchair"
|
||||
) as string,
|
||||
value: "no",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.CHOICE,
|
||||
choices: {
|
||||
no: i18n.t("Not accessible with a wheelchair") as string,
|
||||
partially: i18n.t("Partially accessible with a wheelchair") as string,
|
||||
fully: i18n.t("Fully accessible with a wheelchair") as string,
|
||||
no: t("Not accessible with a wheelchair") as string,
|
||||
partially: t("Partially accessible with a wheelchair") as string,
|
||||
fully: t("Fully accessible with a wheelchair") as string,
|
||||
},
|
||||
category: EventMetadataCategories.ACCESSIBILITY,
|
||||
},
|
||||
{
|
||||
icon: "subtitles",
|
||||
key: "mz:accessibility:live:subtitle",
|
||||
label: i18n.t("Subtitles") as string,
|
||||
description: i18n.t("Whether the event live video is subtitled") as string,
|
||||
label: t("Subtitles") as string,
|
||||
description: t("Whether the event live video is subtitled") as string,
|
||||
value: "false",
|
||||
type: EventMetadataType.BOOLEAN,
|
||||
keyType: EventMetadataKeyType.PLAIN,
|
||||
choices: {
|
||||
true: i18n.t("The event live video contains subtitles") as string,
|
||||
false: i18n.t(
|
||||
"The event live video does not contain subtitles"
|
||||
) as string,
|
||||
true: t("The event live video contains subtitles") as string,
|
||||
false: t("The event live video does not contain subtitles") as string,
|
||||
},
|
||||
category: EventMetadataCategories.ACCESSIBILITY,
|
||||
},
|
||||
{
|
||||
icon: "mz:icon:sign_language",
|
||||
key: "mz:accessibility:live:sign_language",
|
||||
label: i18n.t("Sign Language") as string,
|
||||
description: i18n.t(
|
||||
label: t("Sign Language") as string,
|
||||
description: t(
|
||||
"Whether the event is interpreted in sign language"
|
||||
) as string,
|
||||
value: "false",
|
||||
type: EventMetadataType.BOOLEAN,
|
||||
keyType: EventMetadataKeyType.PLAIN,
|
||||
choices: {
|
||||
true: i18n.t("The event has a sign language interpreter") as string,
|
||||
false: i18n.t(
|
||||
"The event hasn't got a sign language interpreter"
|
||||
) as string,
|
||||
true: t("The event has a sign language interpreter") as string,
|
||||
false: t("The event hasn't got a sign language interpreter") as string,
|
||||
},
|
||||
category: EventMetadataCategories.ACCESSIBILITY,
|
||||
},
|
||||
{
|
||||
icon: "youtube",
|
||||
key: "mz:replay:youtube:url",
|
||||
label: i18n.t("YouTube replay") as string,
|
||||
description: i18n.t(
|
||||
label: t("YouTube replay") as string,
|
||||
description: t(
|
||||
"The URL where the event live can be watched again after it has ended"
|
||||
) as string,
|
||||
value: "",
|
||||
@@ -75,8 +73,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
// {
|
||||
// icon: "twitch",
|
||||
// key: "mz:replay:twitch:url",
|
||||
// label: i18n.t("Twitch replay") as string,
|
||||
// description: i18n.t(
|
||||
// label: t("Twitch replay") as string,
|
||||
// description: t(
|
||||
// "The URL where the event live can be watched again after it has ended"
|
||||
// ) as string,
|
||||
// value: "",
|
||||
@@ -85,8 +83,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "mz:icon:peertube",
|
||||
key: "mz:replay:peertube:url",
|
||||
label: i18n.t("PeerTube replay") as string,
|
||||
description: i18n.t(
|
||||
label: t("PeerTube replay") as string,
|
||||
description: t(
|
||||
"The URL where the event live can be watched again after it has ended"
|
||||
) as string,
|
||||
value: "",
|
||||
@@ -98,10 +96,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "mz:icon:peertube",
|
||||
key: "mz:live:peertube:url",
|
||||
label: i18n.t("PeerTube live") as string,
|
||||
description: i18n.t(
|
||||
"The URL where the event can be watched live"
|
||||
) as string,
|
||||
label: t("PeerTube live") as string,
|
||||
description: t("The URL where the event can be watched live") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -111,10 +107,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "twitch",
|
||||
key: "mz:live:twitch:url",
|
||||
label: i18n.t("Twitch live") as string,
|
||||
description: i18n.t(
|
||||
"The URL where the event can be watched live"
|
||||
) as string,
|
||||
label: t("Twitch live") as string,
|
||||
description: t("The URL where the event can be watched live") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -125,10 +119,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "youtube",
|
||||
key: "mz:live:youtube:url",
|
||||
label: i18n.t("YouTube live") as string,
|
||||
description: i18n.t(
|
||||
"The URL where the event can be watched live"
|
||||
) as string,
|
||||
label: t("YouTube live") as string,
|
||||
description: t("The URL where the event can be watched live") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -139,10 +131,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "mz:icon:owncast",
|
||||
key: "mz:live:owncast:url",
|
||||
label: i18n.t("Owncast") as string,
|
||||
description: i18n.t(
|
||||
"The URL where the event can be watched live"
|
||||
) as string,
|
||||
label: t("Owncast") as string,
|
||||
description: t("The URL where the event can be watched live") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -152,8 +142,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "calendar-check",
|
||||
key: "mz:poll:framadate:url",
|
||||
label: i18n.t("Framadate poll") as string,
|
||||
description: i18n.t(
|
||||
label: t("Framadate poll") as string,
|
||||
description: t(
|
||||
"The URL of a poll where the choice for the event date is happening"
|
||||
) as string,
|
||||
value: "",
|
||||
@@ -165,12 +155,12 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "file-document-edit",
|
||||
key: "mz:notes:etherpad:url",
|
||||
label: i18n.t("Etherpad notes") as string,
|
||||
description: i18n.t(
|
||||
label: t("Etherpad notes") as string,
|
||||
description: t(
|
||||
"The URL of a pad where notes are being taken collaboratively"
|
||||
) as string,
|
||||
value: "",
|
||||
placeholder: i18n.t(
|
||||
placeholder: t(
|
||||
"https://mensuel.framapad.org/p/some-secret-token"
|
||||
) as string,
|
||||
type: EventMetadataType.STRING,
|
||||
@@ -180,8 +170,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "twitter",
|
||||
key: "mz:social:twitter:account",
|
||||
label: i18n.t("Twitter account") as string,
|
||||
description: i18n.t(
|
||||
label: t("Twitter account") as string,
|
||||
description: t(
|
||||
"A twitter account handle to follow for event updates"
|
||||
) as string,
|
||||
value: "",
|
||||
@@ -193,8 +183,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "mz:icon:fediverse",
|
||||
key: "mz:social:fediverse:account_url",
|
||||
label: i18n.t("Fediverse account") as string,
|
||||
description: i18n.t(
|
||||
label: t("Fediverse account") as string,
|
||||
description: t(
|
||||
"A fediverse account URL to follow for event updates"
|
||||
) as string,
|
||||
value: "",
|
||||
@@ -206,8 +196,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "ticket-confirmation",
|
||||
key: "mz:ticket:external_url",
|
||||
label: i18n.t("Online ticketing") as string,
|
||||
description: i18n.t("An URL to an external ticketing platform") as string,
|
||||
label: t("Online ticketing") as string,
|
||||
description: t("An URL to an external ticketing platform") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -216,10 +206,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "cash",
|
||||
key: "mz:ticket:price_url",
|
||||
label: i18n.t("Price sheet") as string,
|
||||
description: i18n.t(
|
||||
"A link to a page presenting the price options"
|
||||
) as string,
|
||||
label: t("Price sheet") as string,
|
||||
description: t("A link to a page presenting the price options") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -228,10 +216,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "calendar-text",
|
||||
key: "mz:schedule_url",
|
||||
label: i18n.t("Schedule") as string,
|
||||
description: i18n.t(
|
||||
"A link to a page presenting the event schedule"
|
||||
) as string,
|
||||
label: t("Schedule") as string,
|
||||
description: t("A link to a page presenting the event schedule") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -240,8 +226,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "webcam",
|
||||
key: "mz:visio:jitsi_meet",
|
||||
label: i18n.t("Jitsi Meet") as string,
|
||||
description: i18n.t("The Jitsi Meet video teleconference URL") as string,
|
||||
label: t("Jitsi Meet") as string,
|
||||
description: t("The Jitsi Meet video teleconference URL") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -251,8 +237,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "webcam",
|
||||
key: "mz:visio:zoom",
|
||||
label: i18n.t("Zoom") as string,
|
||||
description: i18n.t("The Zoom video teleconference URL") as string,
|
||||
label: t("Zoom") as string,
|
||||
description: t("The Zoom video teleconference URL") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -262,10 +248,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "microsoft-teams",
|
||||
key: "mz:visio:microsoft_teams",
|
||||
label: i18n.t("Microsoft Teams") as string,
|
||||
description: i18n.t(
|
||||
"The Microsoft Teams video teleconference URL"
|
||||
) as string,
|
||||
label: t("Microsoft Teams") as string,
|
||||
description: t("The Microsoft Teams video teleconference URL") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -275,8 +259,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "google-hangouts",
|
||||
key: "mz:visio:google_meet",
|
||||
label: i18n.t("Google Meet") as string,
|
||||
description: i18n.t("The Google Meet video teleconference URL") as string,
|
||||
label: t("Google Meet") as string,
|
||||
description: t("The Google Meet video teleconference URL") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
@@ -286,10 +270,8 @@ export const eventMetaDataList: IEventMetadataDescription[] = [
|
||||
{
|
||||
icon: "webcam",
|
||||
key: "mz:visio:big_blue_button",
|
||||
label: i18n.t("Big Blue Button") as string,
|
||||
description: i18n.t(
|
||||
"The Big Blue Button video teleconference URL"
|
||||
) as string,
|
||||
label: t("Big Blue Button") as string,
|
||||
description: t("The Big Blue Button video teleconference URL") as string,
|
||||
value: "",
|
||||
type: EventMetadataType.STRING,
|
||||
keyType: EventMetadataKeyType.URL,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import apolloProvider from "@/vue-apollo";
|
||||
import { apolloClient } from "@/vue-apollo";
|
||||
import { NormalizedCacheObject } from "@apollo/client/cache/inmemory/types";
|
||||
import { ApolloClient } from "@apollo/client/core/ApolloClient";
|
||||
import { provideApolloClient, useQuery } from "@vue/apollo-composable";
|
||||
import { WEB_PUSH } from "../graphql/config";
|
||||
import { IConfig } from "../types/config.model";
|
||||
|
||||
@@ -18,32 +19,33 @@ function urlBase64ToUint8Array(base64String: string): Uint8Array {
|
||||
}
|
||||
|
||||
export async function subscribeUserToPush(): Promise<PushSubscription | null> {
|
||||
const client =
|
||||
apolloProvider.defaultClient as ApolloClient<NormalizedCacheObject>;
|
||||
const { onResult } = provideApolloClient(apolloClient)(() =>
|
||||
useQuery<{ config: IConfig }>(WEB_PUSH)
|
||||
);
|
||||
|
||||
const registration = await navigator.serviceWorker.ready;
|
||||
const { data } = await client.query<{ config: IConfig }>({
|
||||
query: WEB_PUSH,
|
||||
return new Promise((resolve, reject) => {
|
||||
onResult(async ({ data }) => {
|
||||
if (data?.config?.webPush?.enabled && data?.config?.webPush?.publicKey) {
|
||||
const subscribeOptions = {
|
||||
userVisibleOnly: true,
|
||||
applicationServerKey: urlBase64ToUint8Array(
|
||||
data?.config?.webPush?.publicKey
|
||||
),
|
||||
};
|
||||
const registration = await navigator.serviceWorker.ready;
|
||||
try {
|
||||
const pushSubscription = await registration.pushManager.subscribe(
|
||||
subscribeOptions
|
||||
);
|
||||
console.debug("Received PushSubscription: ", pushSubscription);
|
||||
resolve(pushSubscription);
|
||||
} catch (e) {
|
||||
console.error("Error while subscribing to push notifications", e);
|
||||
}
|
||||
}
|
||||
reject(null);
|
||||
});
|
||||
});
|
||||
|
||||
if (data?.config?.webPush?.enabled && data?.config?.webPush?.publicKey) {
|
||||
const subscribeOptions = {
|
||||
userVisibleOnly: true,
|
||||
applicationServerKey: urlBase64ToUint8Array(
|
||||
data?.config?.webPush?.publicKey
|
||||
),
|
||||
};
|
||||
try {
|
||||
const pushSubscription = await registration.pushManager.subscribe(
|
||||
subscribeOptions
|
||||
);
|
||||
console.debug("Received PushSubscription: ", pushSubscription);
|
||||
return pushSubscription;
|
||||
} catch (e) {
|
||||
console.error("Error while subscribing to push notifications", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function unsubscribeUserToPush(): Promise<string | undefined> {
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
import {
|
||||
IAnalyticsConfig,
|
||||
IConfig,
|
||||
IKeyValueConfig,
|
||||
} from "@/types/config.model";
|
||||
import { IAnalyticsConfig, IKeyValueConfig } from "@/types/config.model";
|
||||
|
||||
export const statistics = async (config: IConfig, environement: any) => {
|
||||
console.debug("Loading statistics", config.analytics);
|
||||
const matomoConfig = checkProviderConfig(config, "matomo");
|
||||
let app: any = null;
|
||||
|
||||
export const setAppForAnalytics = (newApp: any) => {
|
||||
app = newApp;
|
||||
};
|
||||
|
||||
export const statistics = async (
|
||||
configAnalytics: IAnalyticsConfig[],
|
||||
environement: any
|
||||
) => {
|
||||
console.debug("Loading statistics", configAnalytics);
|
||||
const matomoConfig = checkProviderConfig(configAnalytics, "matomo");
|
||||
if (matomoConfig?.enabled === true) {
|
||||
const { matomo } = (await import("./matomo")) as any;
|
||||
matomo(environement, convertConfig(matomoConfig.configuration));
|
||||
}
|
||||
|
||||
const sentryConfig = checkProviderConfig(config, "sentry");
|
||||
const sentryConfig = checkProviderConfig(configAnalytics, "sentry");
|
||||
if (sentryConfig?.enabled === true) {
|
||||
const { sentry } = (await import("./sentry")) as any;
|
||||
sentry(environement, convertConfig(sentryConfig.configuration));
|
||||
@@ -20,10 +25,10 @@ export const statistics = async (config: IConfig, environement: any) => {
|
||||
};
|
||||
|
||||
export const checkProviderConfig = (
|
||||
config: IConfig,
|
||||
configAnalytics: IAnalyticsConfig[],
|
||||
providerName: string
|
||||
): IAnalyticsConfig | undefined => {
|
||||
return config?.analytics?.find((provider) => provider.id === providerName);
|
||||
return configAnalytics?.find((provider) => provider.id === providerName);
|
||||
};
|
||||
|
||||
export const convertConfig = (
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import Vue from "vue";
|
||||
import VueMatomo from "vue-matomo";
|
||||
|
||||
export const matomo = (environment: any, matomoConfiguration: any) => {
|
||||
@@ -7,7 +6,7 @@ export const matomo = (environment: any, matomoConfiguration: any) => {
|
||||
"Calling VueMatomo with the following configuration",
|
||||
matomoConfiguration
|
||||
);
|
||||
Vue.use(VueMatomo, {
|
||||
environment.app.use(VueMatomo, {
|
||||
...matomoConfiguration,
|
||||
router: environment.router,
|
||||
});
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import VueRouter from "vue-router";
|
||||
import Vue from "vue";
|
||||
import { VuePlausible } from "vue-plausible";
|
||||
export default (router: VueRouter, plausibleConfiguration: any) => {
|
||||
export default (environment: any, plausibleConfiguration: any) => {
|
||||
console.debug("Loading Plausible statistics");
|
||||
|
||||
Vue.use(VuePlausible, {
|
||||
environment.app.use(VuePlausible, {
|
||||
// see configuration section
|
||||
...plausibleConfiguration,
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Vue from "vue";
|
||||
|
||||
import * as Sentry from "@sentry/vue";
|
||||
import { Integrations } from "@sentry/tracing";
|
||||
|
||||
const app: any = null;
|
||||
|
||||
export const sentry = (environment: any, sentryConfiguration: any) => {
|
||||
console.debug("Loading Sentry statistics");
|
||||
console.debug(
|
||||
@@ -12,7 +12,7 @@ export const sentry = (environment: any, sentryConfiguration: any) => {
|
||||
// Don't attach errors to previous events
|
||||
window.sessionStorage.removeItem("lastEventId");
|
||||
Sentry.init({
|
||||
Vue,
|
||||
app: environment.app,
|
||||
dsn: sentryConfiguration.dsn,
|
||||
integrations: [
|
||||
new Integrations.BrowserTracing({
|
||||
|
||||
Reference in New Issue
Block a user