@hyperframes/studio 0.8.18 → 0.8.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,8 @@
1
1
  import { describe, expect, it, vi } from "vitest";
2
+
3
+ const trackStudioEvent = vi.hoisted(() => vi.fn());
4
+ vi.mock("./studioTelemetry", () => ({ trackStudioEvent }));
5
+
2
6
  import {
3
7
  StudioFileConflictError,
4
8
  StudioSaveHttpError,
@@ -6,6 +10,7 @@ import {
6
10
  buildStudioSaveFailureProperties,
7
11
  getStudioSaveStatusCode,
8
12
  retryStudioSave,
13
+ trackStudioEditBlocked,
9
14
  } from "./studioSaveDiagnostics";
10
15
 
11
16
  describe("studio save diagnostics", () => {
@@ -51,6 +56,30 @@ describe("studio save diagnostics", () => {
51
56
  });
52
57
  });
53
58
 
59
+ it("emits expected direct-edit refusals on edit_blocked", () => {
60
+ const error = new Error("This animation is computed at runtime");
61
+
62
+ trackStudioEditBlocked({
63
+ source: "gsap_commit",
64
+ error,
65
+ filePath: "index.html",
66
+ mutationType: "drag",
67
+ });
68
+
69
+ expect(trackStudioEvent).toHaveBeenCalledWith("edit_blocked", {
70
+ source: "gsap_commit",
71
+ error_message: error.message,
72
+ status_code: null,
73
+ file_path: "index.html",
74
+ mutation_type: "drag",
75
+ attempt: undefined,
76
+ label: undefined,
77
+ target_id: undefined,
78
+ target_selector: undefined,
79
+ target_source_file: undefined,
80
+ });
81
+ });
82
+
54
83
  it("reads nested status codes from error causes", () => {
55
84
  const cause = new StudioSaveHttpError("Too many requests", 429);
56
85
  const error = new Error("retry wrapper") as Error & { cause?: unknown };
@@ -172,6 +172,10 @@ export function trackStudioSaveFailure(input: StudioSaveFailureInput): void {
172
172
  trackStudioEvent("save_failure", buildStudioSaveFailureProperties(input));
173
173
  }
174
174
 
175
+ export function trackStudioEditBlocked(input: StudioSaveFailureInput): void {
176
+ trackStudioEvent("edit_blocked", buildStudioSaveFailureProperties(input));
177
+ }
178
+
175
179
  export async function createStudioSaveHttpError(
176
180
  response: Response,
177
181
  fallbackMessage: string,