mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-10 22:20:14 +00:00
fix(cli): make telemetry opt-out durable (#2852)
* fix(cli): make telemetry opt-out durable * fix(cli): make telemetry status trustworthy
This commit is contained in:
@@ -56,10 +56,19 @@ describe("studio client shouldTrack", () => {
|
||||
expect(shouldTrack()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false when VITE_HYPERFRAMES_NO_TELEMETRY='true'", async () => {
|
||||
setNoTelemetry("true");
|
||||
it.each(["true", "TRUE", " yes ", "on"])(
|
||||
"returns false when VITE_HYPERFRAMES_NO_TELEMETRY=%j",
|
||||
async (value) => {
|
||||
setNoTelemetry(value);
|
||||
const shouldTrack = await loadShouldTrack();
|
||||
expect(shouldTrack()).toBe(false);
|
||||
},
|
||||
);
|
||||
|
||||
it("does not opt out for an explicit false value", async () => {
|
||||
setNoTelemetry("false");
|
||||
const shouldTrack = await loadShouldTrack();
|
||||
expect(shouldTrack()).toBe(false);
|
||||
expect(shouldTrack()).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false in vite dev mode", async () => {
|
||||
|
||||
@@ -34,12 +34,13 @@ function isApiKeyConfigured(): boolean {
|
||||
|
||||
// VITE_HYPERFRAMES_NO_TELEMETRY mirrors the CLI's HYPERFRAMES_NO_TELEMETRY=1
|
||||
// opt-out so HeyGen's own dev/CI builds can suppress telemetry from the studio
|
||||
// bundle the same way. Vite injects it at build time. Accepts "1" or "true".
|
||||
// bundle the same way. Vite injects it at build time. Match the CLI's
|
||||
// affirmative privacy-control spellings.
|
||||
// `import.meta.env` may be undefined in non-Vite bundlers (Next.js Turbopack).
|
||||
function isBuildTimeOptOut(): boolean {
|
||||
try {
|
||||
const v = import.meta.env.VITE_HYPERFRAMES_NO_TELEMETRY as string | undefined;
|
||||
return v === "1" || v === "true";
|
||||
return v !== undefined && ["1", "true", "yes", "on"].includes(v.trim().toLowerCase());
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user