Files
speckle-connectors-dui/app.vue
Oğuzhan Koral 3b4aa93858 Feat: mocked bindings and logging to seq (#39)
* mocked bindings and logging to seq

* test deploy

* test deploy

* test deploy

* connectorless state

* remove logs

* remove more logs

* add flags to globalThus

* log with /api/events/raw

* log error link on prod over local account

* handle test query to distinguish self hosters

* throw again

* log again...

* sa and ra

* error policy non none

* attach server url to logs

* Add host app version

* rename name to slug

* remove useless re throw

* fix confusion on versions
2025-07-23 15:51:09 +01:00

65 lines
2.3 KiB
Vue

<template>
<div id="speckle" class="bg-foundation-page text-foreground overflow-auto">
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<!-- Teleport is fixing the non-clickable toast notifications if any dialog is active. It was marking div as inert and causing the issue -->
<Teleport to="body">
<SingletonToastManager />
</Teleport>
</div>
</template>
<script setup lang="ts">
import { useMixpanel } from '~/lib/core/composables/mixpanel'
import { useConfigStore } from '~/store/config'
import { useAccountStore } from '~/store/accounts'
import { useHostAppStore } from '~/store/hostApp'
import { storeToRefs } from 'pinia'
import { logToSeq } from '~/lib/logger/composables/useLogger'
const uiConfigStore = useConfigStore()
const { isDarkTheme } = storeToRefs(uiConfigStore)
const hostAppStore = useHostAppStore()
const { connectorVersion, hostAppName, hostAppVersion } = storeToRefs(hostAppStore)
useHead({
title: computed(
() =>
`CNX: (hostApp: ${hostAppName.value}:v${hostAppVersion.value}),(version: ${connectorVersion.value})`
),
htmlAttrs: {
lang: 'en',
class: computed(() => (isDarkTheme.value ? `dark` : ``))
},
bodyAttrs: {
class: 'simple-scrollbar bg-foundation-page text-foreground '
},
// For standalone vue devtools see: https://devtools.vuejs.org/guide/installation.html#standalone
script: import.meta.dev ? ['http://localhost:8098'] : []
})
onMounted(() => {
const { trackEvent, addConnectorToProfile, identifyProfile } = useMixpanel()
// TODO: some host apps can open DUI3 automatically, with this case we shouldn't mark track event as `"type": "action"`,
// we need to get this info from source app. (TBD which apps: Rhino opens automatically, not sure acad, sketchup and revit needs trigger button to init)
trackEvent('DUI3 Action', { name: 'Launch' })
const { accounts } = useAccountStore()
const uniqueEmails = new Set<string>()
accounts.forEach((account) => {
const email = account?.accountInfo.userInfo.email
if (email && !uniqueEmails.has(email)) {
addConnectorToProfile(email)
identifyProfile(email)
uniqueEmails.add(email)
}
})
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { $intercom } = useNuxtApp() // needed her for initialisation
logToSeq('Information', 'DUI3 initialized')
})
</script>