(event: string, properties: EventProperties = {})
| 49 | declare const __STUDIO_VERSION__: string; |
| 50 | |
| 51 | export function trackStudioEvent(event: string, properties: EventProperties = {}): void { |
| 52 | if (!isEnabled()) return; |
| 53 | |
| 54 | queue.push({ |
| 55 | event: `studio:${event}`, |
| 56 | properties: { ...getSessionProperties(), ...properties }, |
| 57 | timestamp: new Date().toISOString(), |
| 58 | }); |
| 59 | |
| 60 | if (!flushTimer) { |
| 61 | flushTimer = setInterval(flushEvents, FLUSH_INTERVAL_MS); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | async function flushEvents(): Promise<void> { |
| 66 | if (queue.length === 0) return; |
no test coverage detected