Skip to content

Write HTML. Render video. Built for agents.

feat: post-render and Studio feedback collection via PostHog surveys (#1101)

Miguel Ángeld625dc850935
diff --git a/.fallowrc.jsonc b/.fallowrc.jsonc
index 94e3ef744b..b457623f5c 100644
--- a/.fallowrc.jsonc
+++ b/.fallowrc.jsonc
@@ -53,13 +53,13 @@
"file": "packages/producer/src/services/fileServer.ts",
"exports": ["isPathInside"],
},
- // Studio telemetry: `trackStudioRenderStart` is consumed by
- // useRenderQueue.ts (deep relative import) but fallow's static analyzer
- // doesn't trace it. `trackStudioSessionStart` from the same file resolves
- // fine via App.tsx, so this is a path-resolution quirk, not dead code.
+ // Studio telemetry: consumed by useRenderQueue.ts / StudioFeedbackBar.tsx
+ // (deep relative imports) but fallow's static analyzer doesn't trace
+ // them. Same path-resolution quirk — trackStudioSessionStart from the
+ // same file resolves fine.
{
"file": "packages/studio/src/telemetry/events.ts",
- "exports": ["trackStudioRenderStart"],
+ "exports": ["trackStudioRenderStart", "trackStudioFeedback"],
},
// domEditingLayers: these exports are consumed via the browser iframe
// runtime context (not traceable by static import analysis from the
diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts
index 8d5c95aa61..379fd9b46b 100644
--- a/packages/cli/src/cli.ts
+++ b/packages/cli/src/cli.ts
@@ -119,6 +119,7 @@ const subCommands = {
doctor: () => import("./commands/doctor.js").then((m) => m.default),
upgrade: () => import("./commands/upgrade.js").then((m) => m.default),
skills: () => import("./commands/skills.js").then((m) => m.default),
+ feedback: () => import("./commands/feedback.js").then((m) => m.default),
telemetry: () => import("./commands/telemetry.js").then((m) => m.default),
validate: () => import("./commands/validate.js").then((m) => m.default),
snapshot: () => import("./commands/snapshot.js").then((m) => m.default),
diff --git a/packages/cli/src/commands/feedback.ts b/packages/cli/src/commands/feedback.ts
new file mode 100644
index 0000000000..5b71b6fe95
--- /dev/null
+++ b/packages/cli/src/commands/feedback.ts
@@ -0,0 +1,55 @@
+import { defineCommand } from "citty";
+import type { Example } from "./_examples.js";
+import { trackRenderFeedback } from "../telemetry/events.js";
+import { shouldTrack, flush } from "../telemetry/client.js";
+import { getDoctorSummary } from "../telemetry/feedback.js";
+import { c } from "../ui/colors.js";
+
+export const examples: Example[] = [
+ ["Submit render feedback", 'hyperframes feedback --rating 4 --comment "fast but font missing"'],
+ ["Quick rating only", "hyperframes feedback --rating 5"],
+];
+
+function parseRating(raw: string): number | null {
+ const n = parseInt(raw, 10);
+ return n >= 1 && n <= 5 && Number.isFinite(n) ? n : null;
+}
+
+export default defineCommand({
+ meta: { name: "feedback", description: "Submit anonymous feedback about your experience" },
+ args: {
+ rating: {
+ type: "string",
+ description: "Satisfaction rating (1=poor, 5=great)",
+ required: true,
+ },
+ comment: {
+ type: "string",
+ description: "Optional details about your experience",
+ },
+ },
+ async run({ args }) {
+ const rating = parseRating(args.rating);
+ if (rating === null) {
+ console.error(c.error("Rating must be between 1 and 5"));
+ process.exit(1);
+ }
+
+ if (!shouldTrack()) {
+ console.log(c.dim("Telemetry is disabled. Feedback not sent."));
+ return;
+ }
+
+ const doctorSummary = await getDoctorSummary();
+
+ trackRenderFeedback({
+ rating,
+ renderDurationMs: 0,
+ comment: args.comment || undefined,
+ doctorSummary,
+ });
+
+ await flush();
+ console.log(c.dim("Thanks for the feedback!"));
+ },
+});
diff --git a/packages/cli/src/commands/render.ts b/packages/cli/src/commands/render.ts
index 0c093d12e4..86d0a7121f 100644
--- a/packages/cli/src/commands/render.ts
+++ b/packages/cli/src/commands/render.ts
@@ -45,6 +45,7 @@ import { c } from "../ui/colors.js";
import { formatBytes, formatDuration, errorBox } from "../ui/format.js";
import { renderProgress } from "../ui/progress.js";
import { trackRenderComplete, trackRenderError } from "../telemetry/events.js";
+import { maybePromptRenderFeedback } from "../telemetry/feedback.js";
import { bytesToMb } from "../telemetry/system.js";
import { VERSION } from "../version.js";
import { isDevMode } from "../utils/env.js";
@@ -827,6 +828,10 @@ export async function renderLocal(
const elapsed = Date.now() - startTime;
trackRenderMetrics(job, elapsed, options, false);
printRenderComplete(outputPath, elapsed, options.quiet);
+ await maybePromptRenderFeedback({
+ renderDurationMs: elapsed,
+ quiet: options.quiet,
+ });
if (options.exitAfterComplete) scheduleRenderProcessExit();
}
diff --git a/packages/cli/src/help.ts b/packages/cli/src/help.ts
index e4c1565282..c9e22450da 100644
--- a/packages/cli/src/help.ts
+++ b/packages/cli/src/help.ts
@@ -73,7 +73,10 @@ const GROUPS: Group[] = [
},
{
title: "Settings",
- commands: [["telemetry", "Manage anonymous usage telemetry"]],
+ commands: [
+ ["feedback", "Submit anonymous feedback about your experience"],
+ ["telemetry", "Manage anonymous usage telemetry"],
+ ],
},
];
diff --git a/packages/cli/src/telemetry/config.ts b/packages/cli/src/telemetry/config.ts
index 6031ce8863..b0a90cb9e7 100644
--- a/packages/cli/src/telemetry/config.ts
+++ b/packages/cli/src/telemetry/config.ts
@@ -19,6 +19,10 @@ export interface HyperframesConfig {
telemetryNoticeShown: boolean;
/** Total CLI command invocations (for engagement prompts) */
commandCount: number;
+ /** Total successful renders (for feedback prompt gating) */
+ renderSuccessCount: number;
+ /** The renderSuccessCount at which feedback was last shown */
+ lastFeedbackPromptAt: number;
/** ISO timestamp of the last npm registry version check */
lastUpdateCheck?: string;
/** Latest version found on npm */
@@ -58,6 +62,8 @@ const DEFAULT_CONFIG: HyperframesConfig = {
anonymousId: "",
telemetryNoticeShown: false,
commandCount: 0,
+ renderSuccessCount: 0,
+ lastFeedbackPromptAt: 0,
};
let cachedConfig: HyperframesConfig | null = null;
@@ -84,6 +90,8 @@ export function readConfig(): HyperframesConfig {
anonymousId: parsed.anonymousId || randomUUID(),
telemetryNoticeShown: parsed.telemetryNoticeShown ?? DEFAULT_CONFIG.telemetryNoticeShown,
commandCount: parsed.commandCount ?? DEFAULT_CONFIG.commandCount,
+ renderSuccessCount: parsed.renderSuccessCount ?? DEFAULT_CONFIG.renderSuccessCount,
+ lastFeedbackPromptAt: parsed.lastFeedbackPromptAt ?? DEFAULT_CONFIG.lastFeedbackPromptAt,
lastUpdateCheck: parsed.lastUpdateCheck,
latestVersion: parsed.latestVersion,
pendingUpdate: parsed.pendingUpdate,
diff --git a/packages/cli/src/telemetry/events.ts b/packages/cli/src/telemetry/events.ts
index 865bfa25de..260e98b548 100644
--- a/packages/cli/src/telemetry/events.ts
+++ b/packages/cli/src/telemetry/events.ts
@@ -135,6 +135,21 @@ export function trackCliError(props: {
});
}
+export function trackRenderFeedback(props: {
+ rating: number;
+ renderDurationMs: number;
+ comment?: string;
+ doctorSummary?: string;
+}): void {
+ trackEvent("survey sent", {
+ $survey_id: "render_satisfaction",
+ $survey_response: props.rating,
+ ...(props.comment ? { $survey_response_2: props.comment } : {}),
+ render_duration_ms: props.renderDurationMs,
+ ...(props.doctorSummary ? { doctor_summary: props.doctorSummary } : {}),
+ });
+}
+
export function trackCommandResult(props: {
command: string;
success: boolean;
diff --git a/packages/cli/src/telemetry/feedback.ts b/packages/cli/src/telemetry/feedback.ts
new file mode 100644
index 0000000000..4da1c23c37
--- /dev/null
+++ b/packages/cli/src/telemetry/feedback.ts
@@ -0,0 +1,130 @@
+import * as readline from "node:readline";
+import { readConfig, writeConfig } from "./config.js";
+import { shouldTrack } from "./client.js";
+import { trackRenderFeedback } from "./events.js";
+import { detectAgentRuntime } from "./agent_runtime.js";
+import { c } from "../ui/colors.js";
+
+const DEFAULT_FEEDBACK_INTERVAL = 15;
+
+function getFeedbackInterval(): number {
+ const env = process.env.HYPERFRAMES_FEEDBACK_INTERVAL;
+ if (env) {
+ const n = parseInt(env, 10);
+ if (Number.isFinite(n) && n > 0) return n;
+ }
+ return DEFAULT_FEEDBACK_INTERVAL;
+}
+
+let promptedThisSession = false;
+
+/**
+ * Increment the successful render counter and maybe prompt for feedback.
+ * Returns immediately if conditions aren't met.
+ */
+// fallow-ignore-next-line complexity
+export async function maybePromptRenderFeedback(opts: {
+ renderDurationMs: number;
+ quiet: boolean;
+}): Promise<void> {
+ if (promptedThisSession) return;
+ if (opts.quiet) return;
+ if (!shouldTrack()) return;
+ if (process.env.CI) return;
+
+ const config = readConfig();
+ config.renderSuccessCount = (config.renderSuccessCount ?? 0) + 1;
+
+ const lastAt = config.lastFeedbackPromptAt ?? 0;
+ const isFirstEverRender = lastAt === 0;
+ const sinceLastPrompt = config.renderSuccessCount - lastAt;
+ if (!isFirstEverRender && sinceLastPrompt < getFeedbackInterval()) {
+ writeConfig(config);
+ return;
+ }
+
+ if (detectAgentRuntime()) {
+ promptedThisSession = true;
+ config.lastFeedbackPromptAt = config.renderSuccessCount;
+ writeConfig(config);
+ console.log(
+ c.dim(" [hyperframes] ") +
+ c.dim("Agent feedback: ") +
+ c.accent('hyperframes feedback --rating <1-5> --comment "..."'),
+ );
+ return;
+ }
+
+ if (!process.stdin.isTTY) {
+ writeConfig(config);
+ return;
+ }
+
+ // Time to ask
+ promptedThisSession = true;
+ config.lastFeedbackPromptAt = config.renderSuccessCount;
+ writeConfig(config);
+
+ const answer = await askQuestion(
+ ` ${c.dim("How was this render?")} ${c.accent("[1=poor 5=great, enter to skip]")} `,
+ );
+
+ const rating = parseInt(answer.trim(), 10);
+ if (rating >= 1 && rating <= 5) {
+ // Ask for optional text feedback
+ const details = await askQuestion(` ${c.dim("Any details?")} ${c.accent("(enter to skip)")} `);
+ const trimmedDetails = details.trim();
+
+ trackRenderFeedback({
+ rating,
+ renderDurationMs: opts.renderDurationMs,
+ comment: trimmedDetails || undefined,
+ doctorSummary: await getDoctorSummary(),
+ });
+ console.log(c.dim(" Thanks for the feedback!"));
+ }
+}
+
+export async function getDoctorSummary(): Promise<string> {
+ try {
+ const [{ getSystemMeta }, { findFFmpeg }] = await Promise.all([
+ import("../telemetry/system.js"),
+ import("../browser/ffmpeg.js"),
+ ]);
+ const sys = getSystemMeta();
+ const parts = [
+ `os=${process.platform}/${process.arch}`,
+ `node=${process.version}`,
+ `cpu=${sys.cpu_count}cores`,
+ `mem=${(sys.memory_total_mb / 1024).toFixed(0)}GB`,
+ `ffmpeg=${findFFmpeg() ? "yes" : "no"}`,
+ ];
+ if (sys.is_docker) parts.push("docker");
+ if (sys.is_wsl) parts.push("wsl");
+ return parts.join(" ");
+ } catch {
+ return "";
+ }
+}
+
+function askQuestion(prompt: string): Promise<string> {
+ return new Promise((resolve) => {
+ const rl = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout,
+ });
+ rl.question(prompt, (answer) => {
+ rl.close();
+ resolve(answer);
+ });
+ // Auto-resolve after 10 seconds so the CLI never hangs
+ const timeout = setTimeout(() => {
+ rl.close();
+ resolve("");
+ }, 10_000);
+ // Don't keep the process alive just for the timeout
+ if (typeof timeout === "object" && timeout !== null && "unref" in timeout) {
+ (timeout as { unref: () => void }).unref();
+ }
+ });
+}
diff --git a/packages/studio/src/components/StudioFeedbackBar.tsx b/packages/studio/src/components/StudioFeedbackBar.tsx
new file mode 100644
index 0000000000..65543316d0
--- /dev/null
+++ b/packages/studio/src/components/StudioFeedbackBar.tsx
@@ -0,0 +1,199 @@
+import { memo, useState, useCallback, useRef, useEffect } from "react";
+import { trackStudioFeedback } from "../telemetry/events";
+
+const DEFAULT_FEEDBACK_INTERVAL = 10;
+const AUTO_DISMISS_MS = 20_000;
+
+// fallow-ignore-next-line complexity
+function getFeedbackInterval(): number {
+ try {
+ const v = import.meta.env.VITE_HYPERFRAMES_FEEDBACK_INTERVAL as string | undefined;
+ if (v) {
+ const n = parseInt(v, 10);
+ if (Number.isFinite(n) && n > 0) return n;
+ }
+ } catch {
+ // import.meta.env unavailable
+ }
+ return DEFAULT_FEEDBACK_INTERVAL;
+}
+
+const STORAGE_KEYS = {
+ sessionCount: "hyperframes-studio:feedbackSessionCount",
+ lastPromptedAt: "hyperframes-studio:feedbackLastPromptedAt",
+} as const;
+
+// fallow-ignore-next-line complexity
+function shouldShowFeedback(): boolean {
+ try {
+ const count = parseInt(localStorage.getItem(STORAGE_KEYS.sessionCount) || "0", 10) || 0;
+ const lastAt = parseInt(localStorage.getItem(STORAGE_KEYS.lastPromptedAt) || "0", 10) || 0;
+ return count - lastAt >= getFeedbackInterval();
+ } catch {
+ return false;
+ }
+}
+
+const SESSION_COUNTED_KEY = "hyperframes-studio:feedbackSessionCounted";
+
+// fallow-ignore-next-line complexity
+function incrementSessionCount(): void {
+ try {
+ if (sessionStorage.getItem(SESSION_COUNTED_KEY)) return;
+ sessionStorage.setItem(SESSION_COUNTED_KEY, "1");
+ const count = parseInt(localStorage.getItem(STORAGE_KEYS.sessionCount) || "0", 10) || 0;
+ localStorage.setItem(STORAGE_KEYS.sessionCount, String(count + 1));
+ } catch {
+ // storage unavailable
+ }
+}
+
+function markPrompted(): void {
+ try {
+ const count = localStorage.getItem(STORAGE_KEYS.sessionCount) || "0";
+ localStorage.setItem(STORAGE_KEYS.lastPromptedAt, count);
+ } catch {
+ // localStorage unavailable
+ }
+}
+
+// fallow-ignore-next-line complexity
+export const StudioFeedbackBar = memo(function StudioFeedbackBar() {
+ const [visible, setVisible] = useState(false);
+ const [rating, setRating] = useState<number | null>(null);
+ const [comment, setComment] = useState("");
+ const [submitted, setSubmitted] = useState(false);
+ const [exiting, setExiting] = useState(false);
+ const inputRef = useRef<HTMLInputElement>(null);
+ const dismissTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+
+ // On mount: increment session count, check if we should show
+ useEffect(() => {
+ incrementSessionCount();
+ // Small delay so the bar doesn't flash on page load
+ const showTimer = setTimeout(() => {
+ if (shouldShowFeedback()) {
+ setVisible(true);
+ }
+ }, 3000);
+ return () => clearTimeout(showTimer);
+ }, []);
+
+ // Auto-dismiss timer — reset when user interacts (sets rating)
+ useEffect(() => {
+ if (!visible || rating !== null || submitted) return;
+ dismissTimerRef.current = setTimeout(() => {
+ handleDismiss();
+ }, AUTO_DISMISS_MS);
+ return () => {
+ if (dismissTimerRef.current) clearTimeout(dismissTimerRef.current);
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [visible, rating, submitted]);
+
+ // Focus text input when rating is selected
+ useEffect(() => {
+ if (rating !== null && inputRef.current) {
+ inputRef.current.focus();
+ }
+ }, [rating]);
+
+ const handleDismiss = useCallback(() => {
+ setExiting(true);
+ markPrompted();
+ setTimeout(() => setVisible(false), 300);
+ }, []);
+
+ const handleSubmit = useCallback(() => {
+ if (rating === null) return;
+ trackStudioFeedback({
+ rating,
+ comment: comment.trim() || undefined,
+ });
+ setSubmitted(true);
+ markPrompted();
+ setTimeout(() => {
+ setExiting(true);
+ setTimeout(() => setVisible(false), 300);
+ }, 1500);
+ }, [rating, comment]);
+
+ const handleRating = useCallback((n: number) => {
+ setRating(n);
+ // Cancel auto-dismiss — user is engaged
+ if (dismissTimerRef.current) {
+ clearTimeout(dismissTimerRef.current);
+ dismissTimerRef.current = null;
+ }
+ }, []);
+
+ if (!visible) return null;
+
+ return (
+ <div
+ className={[
+ "flex items-center gap-3 px-4 h-8 border-t border-neutral-800/50 bg-neutral-900/80 text-[11px] transition-all duration-300",
+ exiting ? "opacity-0 translate-y-2" : "opacity-100 translate-y-0",
+ ].join(" ")}
+ >
+ {submitted ? (
+ <span className="text-neutral-500">Thanks for the feedback!</span>
+ ) : rating !== null ? (
+ <>
+ <input
+ ref={inputRef}
+ type="text"
+ value={comment}
+ onChange={(e) => setComment(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") handleSubmit();
+ if (e.key === "Escape") handleDismiss();
+ }}
+ placeholder="Any details? (enter to send, esc to close)"
+ className="flex-1 bg-transparent border-none text-[11px] text-neutral-300 placeholder-neutral-600 outline-none"
+ maxLength={500}
+ />
+ <button
+ onClick={handleSubmit}
+ className="text-[11px] text-neutral-500 hover:text-neutral-300 transition-colors flex-shrink-0"
+ >
+ send
+ </button>
+ </>
+ ) : (
+ <>
+ <span className="text-neutral-500 flex-shrink-0">How's the Studio experience?</span>
+ <div className="flex items-center gap-0.5">
+ {[1, 2, 3, 4, 5].map((n) => (
+ <button
+ key={n}
+ onClick={() => handleRating(n)}
+ className="w-6 h-6 rounded text-[11px] text-neutral-600 hover:text-neutral-200 hover:bg-neutral-700/50 transition-colors"
+ >
+ {n}
+ </button>
+ ))}
+ </div>
+ <div className="flex-1" />
+ <button
+ onClick={handleDismiss}
+ className="text-neutral-700 hover:text-neutral-400 transition-colors flex-shrink-0"
+ aria-label="Dismiss"
+ >
+ <svg
+ width="12"
+ height="12"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ >
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ </button>
+ </>
+ )}
+ </div>
+ );
+});
diff --git a/packages/studio/src/components/StudioPreviewArea.tsx b/packages/studio/src/components/StudioPreviewArea.tsx
index 1c14402bc5..63c161257b 100644
--- a/packages/studio/src/components/StudioPreviewArea.tsx
+++ b/packages/studio/src/components/StudioPreviewArea.tsx
@@ -3,6 +3,7 @@ import { NLELayout } from "./nle/NLELayout";
import { CaptionOverlay } from "../captions/components/CaptionOverlay";
import { CaptionTimeline } from "../captions/components/CaptionTimeline";
import { DomEditOverlay } from "./editor/DomEditOverlay";
+import { StudioFeedbackBar } from "./StudioFeedbackBar";
import type { TimelineElement } from "../player";
import type { BlockedTimelineEditIntent } from "../player/components/timelineEditing";
import {
@@ -53,6 +54,7 @@ export interface StudioPreviewAreaProps {
blockPreview?: BlockPreviewInfo | null;
}
+// fallow-ignore-next-line complexity
export function StudioPreviewArea({
timelineToolbar,
renderClipContent,
@@ -102,100 +104,103 @@ export function StudioPreviewArea({
} = useDomEditContext();
return (
- <div className="flex-1 relative min-w-0">
- <NLELayout
- projectId={projectId}
- refreshKey={refreshKey}
- activeCompositionPath={activeCompPath}
- timelineToolbar={timelineToolbar}
- renderClipContent={renderClipContent}
- onDeleteElement={handleTimelineElementDelete}
- onAssetDrop={handleTimelineAssetDrop}
- onBlockDrop={handleTimelineBlockDrop}
- onPreviewBlockDrop={handlePreviewBlockDrop}
- onFileDrop={handleTimelineFileDrop}
- onMoveElement={handleTimelineElementMove}
- onResizeElement={handleTimelineElementResize}
- onBlockedEditAttempt={handleBlockedTimelineEdit}
- onSelectTimelineElement={handleTimelineElementSelect}
- onCompIdToSrcChange={setCompIdToSrc}
- onCompositionLoadingChange={setCompositionLoading}
- onCompositionChange={(compPath) => {
- // Sync activeCompPath when user drills down via timeline double-click
- // or navigates back via breadcrumb — keeps sidebar + thumbnails in sync.
- // Guard against no-op updates to prevent circular refresh cascades
- // between activeCompPath → compositionStack → onCompositionChange.
- if (compPath !== activeCompPath) {
- setActiveCompPath(compPath);
- refreshPreviewDocumentVersion();
+ <div className="flex-1 flex flex-col relative min-w-0">
+ <div className="flex-1 min-h-0 relative">
+ <NLELayout
+ projectId={projectId}
+ refreshKey={refreshKey}
+ activeCompositionPath={activeCompPath}
+ timelineToolbar={timelineToolbar}
+ renderClipContent={renderClipContent}
+ onDeleteElement={handleTimelineElementDelete}
+ onAssetDrop={handleTimelineAssetDrop}
+ onBlockDrop={handleTimelineBlockDrop}
+ onPreviewBlockDrop={handlePreviewBlockDrop}
+ onFileDrop={handleTimelineFileDrop}
+ onMoveElement={handleTimelineElementMove}
+ onResizeElement={handleTimelineElementResize}
+ onBlockedEditAttempt={handleBlockedTimelineEdit}
+ onSelectTimelineElement={handleTimelineElementSelect}
+ onCompIdToSrcChange={setCompIdToSrc}
+ onCompositionLoadingChange={setCompositionLoading}
+ onCompositionChange={(compPath) => {
+ // Sync activeCompPath when user drills down via timeline double-click
+ // or navigates back via breadcrumb — keeps sidebar + thumbnails in sync.
+ // Guard against no-op updates to prevent circular refresh cascades
+ // between activeCompPath → compositionStack → onCompositionChange.
+ if (compPath !== activeCompPath) {
+ setActiveCompPath(compPath);
+ refreshPreviewDocumentVersion();
+ }
+ }}
+ onIframeRef={handlePreviewIframeRef}
+ previewOverlay={
+ blockPreview ? (
+ <div className="absolute inset-0 z-30 bg-black pointer-events-none">
+ {blockPreview.videoUrl ? (
+ <video
+ src={blockPreview.videoUrl}
+ autoPlay
+ muted
+ loop
+ playsInline
+ className="w-full h-full object-contain"
+ />
+ ) : blockPreview.posterUrl ? (
+ <img
+ src={blockPreview.posterUrl}
+ alt={blockPreview.title}
+ className="w-full h-full object-contain"
+ />
+ ) : null}
+ </div>
+ ) : captionEditMode ? (
+ <CaptionOverlay iframeRef={previewIframeRef} />
+ ) : STUDIO_INSPECTOR_PANELS_ENABLED ? (
+ <DomEditOverlay
+ iframeRef={previewIframeRef}
+ activeCompositionPath={activeCompPath}
+ hoverSelection={
+ STUDIO_PREVIEW_SELECTION_ENABLED &&
+ !captionEditMode &&
+ !compositionLoading &&
+ !isPlaying
+ ? domEditHoverSelection
+ : null
+ }
+ selection={shouldShowSelectedDomBounds ? domEditSelection : null}
+ groupSelections={shouldShowSelectedDomBounds ? domEditGroupSelections : []}
+ allowCanvasMovement={STUDIO_PREVIEW_MANUAL_EDITING_ENABLED}
+ onCanvasMouseDown={handlePreviewCanvasMouseDown}
+ onCanvasPointerMove={handlePreviewCanvasPointerMove}
+ onCanvasPointerLeave={handlePreviewCanvasPointerLeave}
+ onSelectionChange={applyDomSelection}
+ onBlockedMove={handleBlockedDomMove}
+ onManualDragStart={handleDomManualDragStart}
+ onPathOffsetCommit={handleDomPathOffsetCommit}
+ onGroupPathOffsetCommit={handleDomGroupPathOffsetCommit}
+ onBoxSizeCommit={handleDomBoxSizeCommit}
+ onRotationCommit={handleDomRotationCommit}
+ />
+ ) : null
}
- }}
- onIframeRef={handlePreviewIframeRef}
- previewOverlay={
- blockPreview ? (
- <div className="absolute inset-0 z-30 bg-black pointer-events-none">
- {blockPreview.videoUrl ? (
- <video
- src={blockPreview.videoUrl}
- autoPlay
- muted
- loop
- playsInline
- className="w-full h-full object-contain"
- />
- ) : blockPreview.posterUrl ? (
- <img
- src={blockPreview.posterUrl}
- alt={blockPreview.title}
- className="w-full h-full object-contain"
- />
- ) : null}
- </div>
- ) : captionEditMode ? (
- <CaptionOverlay iframeRef={previewIframeRef} />
- ) : STUDIO_INSPECTOR_PANELS_ENABLED ? (
- <DomEditOverlay
- iframeRef={previewIframeRef}
- activeCompositionPath={activeCompPath}
- hoverSelection={
- STUDIO_PREVIEW_SELECTION_ENABLED &&
- !captionEditMode &&
- !compositionLoading &&
- !isPlaying
- ? domEditHoverSelection
- : null
- }
- selection={shouldShowSelectedDomBounds ? domEditSelection : null}
- groupSelections={shouldShowSelectedDomBounds ? domEditGroupSelections : []}
- allowCanvasMovement={STUDIO_PREVIEW_MANUAL_EDITING_ENABLED}
- onCanvasMouseDown={handlePreviewCanvasMouseDown}
- onCanvasPointerMove={handlePreviewCanvasPointerMove}
- onCanvasPointerLeave={handlePreviewCanvasPointerLeave}
- onSelectionChange={applyDomSelection}
- onBlockedMove={handleBlockedDomMove}
- onManualDragStart={handleDomManualDragStart}
- onPathOffsetCommit={handleDomPathOffsetCommit}
- onGroupPathOffsetCommit={handleDomGroupPathOffsetCommit}
- onBoxSizeCommit={handleDomBoxSizeCommit}
- onRotationCommit={handleDomRotationCommit}
- />
- ) : null
- }
- timelineFooter={
- captionEditMode ? (
- <div className="border-t border-neutral-800/30 flex-shrink-0" style={{ height: 60 }}>
- <div className="flex items-center gap-1.5 px-2 py-0.5">
- <span className="text-[9px] font-medium text-neutral-500 uppercase tracking-wider">
- Captions
- </span>
+ timelineFooter={
+ captionEditMode ? (
+ <div className="border-t border-neutral-800/30 flex-shrink-0" style={{ height: 60 }}>
+ <div className="flex items-center gap-1.5 px-2 py-0.5">
+ <span className="text-[9px] font-medium text-neutral-500 uppercase tracking-wider">
+ Captions
+ </span>
+ </div>
+ <CaptionTimeline pixelsPerSecond={100} />
</div>
- <CaptionTimeline pixelsPerSecond={100} />
- </div>
- ) : undefined
- }
- timelineVisible={timelineVisible}
- onToggleTimeline={toggleTimelineVisibility}
- />
+ ) : undefined
+ }
+ timelineVisible={timelineVisible}
+ onToggleTimeline={toggleTimelineVisibility}
+ />
+ </div>
+ <StudioFeedbackBar />
</div>
);
}
diff --git a/packages/studio/src/telemetry/events.ts b/packages/studio/src/telemetry/events.ts
index 2696851747..2772a5a7d1 100644
--- a/packages/studio/src/telemetry/events.ts
+++ b/packages/studio/src/telemetry/events.ts
@@ -25,3 +25,35 @@ export function trackStudioRenderStart(props: {
composition: props.composition,
});
}
+
+function getBrowserDoctorSummary(): string {
+ try {
+ const nav = navigator as Navigator & {
+ deviceMemory?: number;
+ connection?: { effectiveType?: string };
+ userAgentData?: { platform?: string };
+ };
+ const platform = nav.userAgentData?.platform ?? navigator.platform ?? "unknown";
+ const parts = [
+ `ua=${platform}`,
+ `screen=${screen.width}x${screen.height}@${devicePixelRatio}x`,
+ `lang=${navigator.language}`,
+ ];
+ if (nav.deviceMemory) parts.push(`mem=${nav.deviceMemory}GB`);
+ if (nav.connection?.effectiveType) parts.push(`net=${nav.connection.effectiveType}`);
+ if (navigator.hardwareConcurrency) parts.push(`cpu=${navigator.hardwareConcurrency}cores`);
+ return parts.join(" ");
+ } catch {
+ return "";
+ }
+}
+
+export function trackStudioFeedback(props: { rating: number; comment?: string }): void {
+ trackEvent("survey sent", {
+ $survey_id: "studio_experience",
+ $survey_response: props.rating,
+ ...(props.comment ? { $survey_response_2: props.comment } : {}),
+ doctor_summary: getBrowserDoctorSummary(),
+ source: "studio",
+ });
+}