feat: certificates, landing pages, ai tutor, website update, compliance
This commit is contained in:
@@ -1,16 +1,42 @@
|
||||
<script lang="ts">
|
||||
import { PageRestricted } from '$features/ui';
|
||||
import { currentOrg } from '$lib/utils/store/org';
|
||||
import { onMount } from 'svelte';
|
||||
import { afterNavigate } from '$app/navigation';
|
||||
import { env } from '$env/dynamic/public';
|
||||
import { analytics } from '@cio/analytics/client';
|
||||
import type { Snippet } from 'svelte';
|
||||
import type { AccountOrg } from '$features/app/types';
|
||||
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet;
|
||||
children?: Snippet;
|
||||
data: {
|
||||
isOrgSite: boolean;
|
||||
org: import('$features/app/types').AccountOrg | null;
|
||||
org: AccountOrg | null;
|
||||
};
|
||||
}
|
||||
|
||||
let { children, data }: Props = $props();
|
||||
|
||||
onMount(() => {
|
||||
if (!env.PUBLIC_SERVER_URL) return;
|
||||
|
||||
analytics.init({
|
||||
endpoint: `${env.PUBLIC_SERVER_URL.replace(/\/$/, '')}/dash/track`,
|
||||
orgId: data.org?.id ?? undefined
|
||||
});
|
||||
analytics.pageView({ kind: 'landing' });
|
||||
});
|
||||
|
||||
afterNavigate(({ to }) => {
|
||||
if (!to) return;
|
||||
|
||||
const isCoursePage = /\/course\//.test(to.url.pathname);
|
||||
analytics.pageView({
|
||||
kind: isCoursePage ? 'course' : 'landing',
|
||||
path: to.url.pathname
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if data.org?.isRestricted || $currentOrg.isRestricted}
|
||||
|
||||
Reference in New Issue
Block a user