Implement creator studio and upload updates

This commit is contained in:
2026-04-04 10:12:02 +02:00
parent 1da7d3bf88
commit 0b216b7ecd
15107 changed files with 31206 additions and 626514 deletions

View File

@@ -0,0 +1,39 @@
function csrfToken() {
return document.querySelector('meta[name="csrf-token"]')?.getAttribute('content') || ''
}
export function studioSurface(pathname = window.location.pathname) {
return String(pathname || '/studio').split('?')[0] || '/studio'
}
export function studioModule(pathname = window.location.pathname) {
const segments = studioSurface(pathname).split('/').filter(Boolean)
if (segments[0] !== 'studio') {
return null
}
return segments[1] || 'overview'
}
export async function trackStudioEvent(eventType, payload = {}) {
try {
await fetch('/api/studio/events', {
method: 'POST',
credentials: 'same-origin',
keepalive: true,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-CSRF-TOKEN': csrfToken(),
'X-Requested-With': 'XMLHttpRequest',
},
body: JSON.stringify({
event_type: eventType,
...payload,
}),
})
} catch {
// Studio analytics hooks should never block the UI.
}
}