chore: marketing updates and video player improvement
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { PUBLIC_IS_SELFHOSTED } from '$env/static/public';
|
||||
import { initPosthog, type PosthogBootstrapUser } from '$lib/utils/services/posthog';
|
||||
import { initUmami } from '$lib/utils/services/umami';
|
||||
import { initUserJot } from '$lib/utils/services/userjot';
|
||||
import { licenseApi } from '$features/license/api/license.svelte';
|
||||
|
||||
let isInitialized = false;
|
||||
@@ -11,6 +12,7 @@ export function setupAnalytics(user?: PosthogBootstrapUser) {
|
||||
|
||||
initPosthog(user);
|
||||
initUmami();
|
||||
initUserJot();
|
||||
}
|
||||
|
||||
/** Checks if this is cloud deployment and initializes analytics */
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import { dev } from '$app/environment';
|
||||
import { get } from 'svelte/store';
|
||||
import { globalStore } from '$lib/utils/store/app';
|
||||
import { licenseApi } from '$features/license/api/license.svelte';
|
||||
|
||||
const USERJOT_APP_ID = 'cm4a6vcmp00jpmdb5n66rmkzz';
|
||||
|
||||
let isInitialized = false;
|
||||
|
||||
function isWidgetAllowed(): boolean {
|
||||
if (dev) return false;
|
||||
if (licenseApi.hasAccess('no-tracking')) return false;
|
||||
if (get(globalStore).isOrgSite) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function ensureSdkLoaded(): void {
|
||||
if (window.uj) return;
|
||||
|
||||
window.$ujq = window.$ujq || [];
|
||||
window.uj =
|
||||
window.uj ||
|
||||
(new Proxy({} as Window['uj'], {
|
||||
get:
|
||||
(_, prop) =>
|
||||
(...args: unknown[]) =>
|
||||
window.$ujq.push([prop, ...args])
|
||||
}) as Window['uj']);
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.type = 'module';
|
||||
script.async = true;
|
||||
script.src = 'https://cdn.userjot.com/sdk/v2/uj.js';
|
||||
const nonce = document.querySelector('script[nonce]')?.getAttribute('nonce');
|
||||
if (nonce) script.setAttribute('nonce', nonce);
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
|
||||
export function initUserJot(): void {
|
||||
if (isInitialized) return;
|
||||
if (!isWidgetAllowed()) return;
|
||||
|
||||
ensureSdkLoaded();
|
||||
|
||||
window.uj.init(USERJOT_APP_ID, {
|
||||
widget: true,
|
||||
position: 'right',
|
||||
theme: 'auto'
|
||||
});
|
||||
|
||||
isInitialized = true;
|
||||
}
|
||||
|
||||
type UserJotIdentity = {
|
||||
id: string;
|
||||
email?: string;
|
||||
fullname?: string | null;
|
||||
avatarUrl?: string | null;
|
||||
};
|
||||
|
||||
export function identifyUserJotUser({ id, email, fullname, avatarUrl }: UserJotIdentity): void {
|
||||
if (!isWidgetAllowed()) return;
|
||||
|
||||
ensureSdkLoaded();
|
||||
|
||||
const [firstName, ...rest] = (fullname ?? '').trim().split(/\s+/);
|
||||
const lastName = rest.join(' ');
|
||||
|
||||
window.uj.identify({
|
||||
id,
|
||||
email,
|
||||
firstName: firstName || undefined,
|
||||
lastName: lastName || undefined,
|
||||
avatar: avatarUrl ?? undefined
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
$ujq: unknown[];
|
||||
uj: {
|
||||
init: (
|
||||
appId: string,
|
||||
options?: {
|
||||
widget?: boolean;
|
||||
position?: 'left' | 'right';
|
||||
theme?: 'auto' | 'light' | 'dark';
|
||||
}
|
||||
) => void;
|
||||
identify: (user: { id: string; email?: string; firstName?: string; lastName?: string; avatar?: string }) => void;
|
||||
[method: string]: (...args: unknown[]) => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@@ -1035,7 +1035,8 @@
|
||||
"actions": {
|
||||
"edit": "Edit",
|
||||
"where_used": "Where used",
|
||||
"download": "Download"
|
||||
"download": "Download",
|
||||
"manage_thumbnails": "Manage thumbnails"
|
||||
},
|
||||
"pagination": {
|
||||
"previous": "Previous",
|
||||
@@ -1061,6 +1062,21 @@
|
||||
"thumbnail_alt": "Asset thumbnail",
|
||||
"status": "Status"
|
||||
},
|
||||
"thumbnails": {
|
||||
"manage_title": "Manage thumbnails",
|
||||
"manage_description": "Preview the video, pick one of the auto-generated frames, or upload your own.",
|
||||
"preview_unavailable": "Preview unavailable",
|
||||
"generated": "Generated thumbnails",
|
||||
"slot_start": "Start",
|
||||
"slot_middle": "Middle",
|
||||
"slot_end": "End",
|
||||
"none_generated_warning": "No thumbnails generated yet. Try regenerating or upload a custom image.",
|
||||
"upload_custom": "Upload custom thumbnail",
|
||||
"custom_selected_hint": "Custom upload will be saved when you save your selection.",
|
||||
"custom_preview_alt": "Custom thumbnail preview",
|
||||
"regenerate": "Regenerate",
|
||||
"save_selection": "Save thumbnail"
|
||||
},
|
||||
"usage": {
|
||||
"title": "Where Used",
|
||||
"description": "Current usage references for",
|
||||
@@ -1597,6 +1613,7 @@
|
||||
"create_course": "Create Course",
|
||||
"view_site": "View Site",
|
||||
"visit_site": "Visit Website",
|
||||
"open_academy": "Open Academy",
|
||||
"current_lesson": "Currently Learning",
|
||||
"currently_learning": "Currently Learning",
|
||||
"learner": "Learner",
|
||||
@@ -2957,6 +2974,7 @@
|
||||
"no_active_cycle": "No active compliance cycle",
|
||||
"empty_history": "No compliance history has been recorded yet.",
|
||||
"empty_overview": "No learner compliance records are available yet.",
|
||||
"empty_overview_description": "Keep your employees compliant and track who is behind.",
|
||||
"not_available": "Not available",
|
||||
"tabs": {
|
||||
"overview": "Overview",
|
||||
@@ -3868,6 +3886,10 @@
|
||||
"thumbnail_upload_failed": "Failed to upload thumbnail",
|
||||
"thumbnail_too_large": "Thumbnail image is too large",
|
||||
"thumbnail_invalid": "Invalid thumbnail file",
|
||||
"thumbnail_updated": "Thumbnail updated",
|
||||
"thumbnail_update_failed": "Failed to update thumbnail",
|
||||
"thumbnail_regen_started": "Regenerating thumbnails…",
|
||||
"thumbnail_regen_failed": "Failed to regenerate thumbnails",
|
||||
"transcription_started": "Transcription started",
|
||||
"transcription_start_failed": "Could not start transcription",
|
||||
"transcription_completed": "Transcription finished",
|
||||
|
||||
Reference in New Issue
Block a user