Merge origin/staging into feat/supabase-auth

Resolve conflicts: keep login_success alongside the new play_error /
play_visibility_lost analytics events; fold auth retry into the play-page
catch blocks so 401s open the login modal and are NOT tracked as play_error.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
yuanzonghao
2026-06-13 23:44:23 +08:00
3 changed files with 183 additions and 11 deletions
+14
View File
@@ -55,6 +55,20 @@ type AnalyticsEventData = {
play_heartbeat: never;
gallery_export: { scene_count: number; audio_count: number };
login_success: { provider: "google" | "github" | "email" };
play_error: {
source: "scene" | "start" | "vision" | "insert_beat" | "freeform" | "prefetch";
kind: "network" | "timeout" | "http_5xx" | "http_4xx" | "abort" | "unknown";
http_status: number;
orientation: "portrait" | "landscape";
connection: "4g" | "3g" | "2g" | "slow-2g" | "unknown";
was_hidden: boolean;
scene_index: number;
elapsed_bucket: "<5s" | "5-30s" | "30-60s" | "60-120s" | "120s+";
};
play_visibility_lost: {
phase: "loading-first" | "ready" | "transitioning" | "vision-thinking" | "inserting-beat";
had_pending_fetch: boolean;
};
};
export type AnalyticsEvent = keyof AnalyticsEventData;