0351d front end linting (#377)
* feat: disable custom script for trial users * after lint fix * frontend linting --------- Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
17
client/plugins/amplitude.js
vendored
17
client/plugins/amplitude.js
vendored
@@ -1,24 +1,25 @@
|
||||
|
||||
// Hook function used by event listener
|
||||
function hookLogEvent (binding) {
|
||||
function hookLogEvent(binding) {
|
||||
const modifiers = Object.keys(binding.modifiers)
|
||||
if (modifiers.length !== 1) {
|
||||
throw new Error('Amplitude directive takes only one modifier which is the event name.')
|
||||
throw new Error(
|
||||
"Amplitude directive takes only one modifier which is the event name.",
|
||||
)
|
||||
}
|
||||
const eventName = modifiers[0]
|
||||
|
||||
useAmplitude().logEvent(eventName, binding.value)
|
||||
}
|
||||
|
||||
export default defineNuxtPlugin(nuxtApp => {
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
// Doing something with nuxtApp
|
||||
const registeredListeners = {}
|
||||
nuxtApp.vueApp.directive('track', {
|
||||
beforeMount (el, binding, vnode) {
|
||||
nuxtApp.vueApp.directive("track", {
|
||||
beforeMount(el, binding) {
|
||||
registeredListeners[el] = () => {
|
||||
hookLogEvent(binding)
|
||||
}
|
||||
el.addEventListener('click', registeredListeners[el])
|
||||
}
|
||||
el.addEventListener("click", registeredListeners[el])
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
7
client/plugins/crisp.client.js
vendored
7
client/plugins/crisp.client.js
vendored
@@ -1,11 +1,10 @@
|
||||
import {Crisp} from "crisp-sdk-web"
|
||||
import config from "~/opnform.config.js";
|
||||
import { Crisp } from "crisp-sdk-web"
|
||||
|
||||
export default defineNuxtPlugin(nuxtApp => {
|
||||
export default defineNuxtPlugin(() => {
|
||||
const isIframe = useIsIframe()
|
||||
const crispWebsiteId = useRuntimeConfig().public.crispWebsiteId
|
||||
if (crispWebsiteId && !isIframe) {
|
||||
Crisp.configure(crispWebsiteId)
|
||||
window.Crisp = Crisp
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
29
client/plugins/sentry.js
vendored
29
client/plugins/sentry.js
vendored
@@ -1,25 +1,24 @@
|
||||
import * as Sentry from "@sentry/vue";
|
||||
import * as Sentry from "@sentry/vue"
|
||||
|
||||
function getSentryIntegrations() {
|
||||
// don't load on server
|
||||
if (!import.meta.client) return [];
|
||||
if (!import.meta.client) return []
|
||||
|
||||
const router = useRouter();
|
||||
const router = useRouter()
|
||||
const browserTracing = new Sentry.BrowserTracing({
|
||||
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
|
||||
});
|
||||
})
|
||||
|
||||
return [browserTracing];
|
||||
return [browserTracing]
|
||||
}
|
||||
|
||||
|
||||
export default defineNuxtPlugin({
|
||||
name: 'sentry',
|
||||
name: "sentry",
|
||||
parallel: true,
|
||||
async setup(nuxtApp) {
|
||||
const vueApp = nuxtApp.vueApp;
|
||||
const vueApp = nuxtApp.vueApp
|
||||
|
||||
const config = useRuntimeConfig();
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
Sentry.init({
|
||||
app: vueApp,
|
||||
@@ -45,14 +44,16 @@ export default defineNuxtPlugin({
|
||||
beforeSend(event) {
|
||||
if (event.exception.values.length) {
|
||||
// Don't send validation exceptions to Sentry
|
||||
if (event.exception.values[0].type === 'FetchError' &&
|
||||
(event.exception.values[0].value.includes('422') || event.exception.values[0].value.includes('401'))
|
||||
if (
|
||||
event.exception.values[0].type === "FetchError" &&
|
||||
(event.exception.values[0].value.includes("422") ||
|
||||
event.exception.values[0].value.includes("401"))
|
||||
) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
return event;
|
||||
return event
|
||||
},
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
})
|
||||
|
||||
6
client/plugins/vue-confetti.client.js
vendored
6
client/plugins/vue-confetti.client.js
vendored
@@ -1,5 +1,5 @@
|
||||
import VueConfetti from 'vue-confetti'
|
||||
import VueConfetti from "vue-confetti"
|
||||
|
||||
export default defineNuxtPlugin(nuxtApp => {
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
nuxtApp.vueApp.use(VueConfetti)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user