@hyperframes/studio 0.6.39 → 0.6.41
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.
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>HyperFrames Studio</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DmiO2Ufp.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-SKRp8mGz.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/studio",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@codemirror/view": "6.40.0",
|
|
32
32
|
"@phosphor-icons/react": "^2.1.10",
|
|
33
33
|
"mediabunny": "^1.45.3",
|
|
34
|
-
"@hyperframes/core": "0.6.
|
|
35
|
-
"@hyperframes/player": "0.6.
|
|
34
|
+
"@hyperframes/core": "0.6.41",
|
|
35
|
+
"@hyperframes/player": "0.6.41"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/react": "19",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"vite": "^6.4.2",
|
|
47
47
|
"vitest": "^3.2.4",
|
|
48
48
|
"zustand": "^5.0.0",
|
|
49
|
-
"@hyperframes/producer": "0.6.
|
|
49
|
+
"@hyperframes/producer": "0.6.41"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "19",
|
|
@@ -2,20 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { describe, expect, it, vi, beforeEach } from "vitest";
|
|
4
4
|
|
|
5
|
-
// `shouldTrack()` reads
|
|
6
|
-
//
|
|
7
|
-
// has no effect on the key. Each test resets module cache and re-imports.
|
|
5
|
+
// `shouldTrack()` reads module-level constants evaluated at module load time,
|
|
6
|
+
// so changing env after import has no effect. Each test resets module cache.
|
|
8
7
|
|
|
9
8
|
const OPT_OUT_KEY = "hyperframes-studio:telemetryDisabled";
|
|
10
9
|
|
|
11
|
-
function setKey(value: string | undefined): void {
|
|
12
|
-
if (value === undefined) {
|
|
13
|
-
delete (import.meta.env as Record<string, unknown>).VITE_HYPERFRAMES_POSTHOG_KEY;
|
|
14
|
-
} else {
|
|
15
|
-
(import.meta.env as Record<string, unknown>).VITE_HYPERFRAMES_POSTHOG_KEY = value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
10
|
function setNoTelemetry(value: string | undefined): void {
|
|
20
11
|
if (value === undefined) {
|
|
21
12
|
delete (import.meta.env as Record<string, unknown>).VITE_HYPERFRAMES_NO_TELEMETRY;
|
|
@@ -37,29 +28,16 @@ async function loadShouldTrack(): Promise<() => boolean> {
|
|
|
37
28
|
describe("studio client shouldTrack", () => {
|
|
38
29
|
beforeEach(() => {
|
|
39
30
|
setDev(false);
|
|
40
|
-
setKey("phc_test_key");
|
|
41
31
|
setNoTelemetry(undefined);
|
|
42
32
|
localStorage.clear();
|
|
43
33
|
vi.unstubAllGlobals();
|
|
44
34
|
});
|
|
45
35
|
|
|
46
|
-
it("returns true when
|
|
36
|
+
it("returns true when not in dev mode and no opt-outs", async () => {
|
|
47
37
|
const shouldTrack = await loadShouldTrack();
|
|
48
38
|
expect(shouldTrack()).toBe(true);
|
|
49
39
|
});
|
|
50
40
|
|
|
51
|
-
it("returns false when API key does not start with phc_", async () => {
|
|
52
|
-
setKey("not_a_real_key");
|
|
53
|
-
const shouldTrack = await loadShouldTrack();
|
|
54
|
-
expect(shouldTrack()).toBe(false);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("returns false when API key is empty string", async () => {
|
|
58
|
-
setKey("");
|
|
59
|
-
const shouldTrack = await loadShouldTrack();
|
|
60
|
-
expect(shouldTrack()).toBe(false);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
41
|
it("returns false when user has opted out via localStorage", async () => {
|
|
64
42
|
localStorage.setItem(OPT_OUT_KEY, "1");
|
|
65
43
|
const shouldTrack = await loadShouldTrack();
|
|
@@ -93,7 +71,6 @@ describe("studio client shouldTrack", () => {
|
|
|
93
71
|
it("memoizes its decision after the first call", async () => {
|
|
94
72
|
const shouldTrack = await loadShouldTrack();
|
|
95
73
|
const first = shouldTrack();
|
|
96
|
-
// Flip an underlying input — memoized return must not change.
|
|
97
74
|
localStorage.setItem(OPT_OUT_KEY, "1");
|
|
98
75
|
expect(shouldTrack()).toBe(first);
|
|
99
76
|
});
|
package/src/telemetry/client.ts
CHANGED
|
@@ -7,15 +7,9 @@
|
|
|
7
7
|
import { getAnonymousId, hasShownNotice, isOptedOut, markNoticeShown } from "./config";
|
|
8
8
|
import { getBrowserSystemMeta } from "./system";
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const POSTHOG_API_KEY =
|
|
14
|
-
(import.meta.env.VITE_HYPERFRAMES_POSTHOG_KEY as string | undefined) ??
|
|
15
|
-
"phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx";
|
|
16
|
-
const POSTHOG_HOST =
|
|
17
|
-
(import.meta.env.VITE_HYPERFRAMES_POSTHOG_HOST as string | undefined) ??
|
|
18
|
-
"https://us.i.posthog.com";
|
|
10
|
+
// Write-only PostHog project key, safe to embed in client code.
|
|
11
|
+
const POSTHOG_API_KEY = "phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx";
|
|
12
|
+
const POSTHOG_HOST = "https://us.i.posthog.com";
|
|
19
13
|
const FLUSH_INTERVAL_MS = 1_000;
|
|
20
14
|
|
|
21
15
|
type EventProperties = Record<string, string | number | boolean | undefined>;
|
|
@@ -41,15 +35,24 @@ function isApiKeyConfigured(): boolean {
|
|
|
41
35
|
// VITE_HYPERFRAMES_NO_TELEMETRY mirrors the CLI's HYPERFRAMES_NO_TELEMETRY=1
|
|
42
36
|
// opt-out so HeyGen's own dev/CI builds can suppress telemetry from the studio
|
|
43
37
|
// bundle the same way. Vite injects it at build time. Accepts "1" or "true".
|
|
38
|
+
// `import.meta.env` may be undefined in non-Vite bundlers (Next.js Turbopack).
|
|
44
39
|
function isBuildTimeOptOut(): boolean {
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
try {
|
|
41
|
+
const v = import.meta.env.VITE_HYPERFRAMES_NO_TELEMETRY as string | undefined;
|
|
42
|
+
return v === "1" || v === "true";
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
// `import.meta.env.DEV` is true under `vite dev` / `vite preview`. Auto-suppress
|
|
50
49
|
// so developers running `hyperframes preview` don't pollute production telemetry.
|
|
51
50
|
function isViteDevMode(): boolean {
|
|
52
|
-
|
|
51
|
+
try {
|
|
52
|
+
return import.meta.env.DEV === true;
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
export function shouldTrack(): boolean {
|