Files
hyperframes/packages/cli/src/server/sharePresentation.test.ts
T
terencechoandClaude Opus 5.5 2a70733c15 fix: track local Studio sharing CTA interactions (#7566)
* fix: track local Studio sharing CTA intent

* fix: tag local Studio and CLI share upgrade links with where they came from

The local Studio share modal's Upgrade to Pro link opens
/pricing?from=cli&entry=local_studio_share, and hyperframes share's source-files
notice links /pricing?from=cli&entry=cli_share, so the pricing page can tell
which link a visit came from and return the visitor to their terminal. The
modal accepts its own pricing page with any query, still only on
hyperframes.dev's two origins. share_upgrade_clicked carries
cta=share_modal_upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor: name the local Studio upgrade CTA and drop the explaining comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep the local Studio upgrade link's return page unchanged

Only entry=local_studio_share is added to the local Studio share window's
Upgrade to Pro link. from=cli would have told these buyers to go back to their
terminal after checkout, but they return to a browser tab. hyperframes share's
link keeps from=cli, as the CLI's other upgrade links do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 21:15:38 +00:00

25 lines
880 B
TypeScript

import { expect, it, vi } from "vitest";
import { presentSpaces } from "./sharePresentation.js";
vi.mock("../share/auth.js", () => ({ shareSite: () => "https://hyperframes.dev" }));
it.each(["free", "subscribed", undefined] as const)(
"preserves authoritative plan %s for the upgrade offer",
(plan) => {
const space = {
space_id: "space",
name: "Workspace",
kind: "personal",
bound: true,
can_create_review: true,
review_entitlements: plan
? { plan, project_limit: plan === "free" ? 5 : null, projects_used_up_to_limit: 2 }
: null,
} as Parameters<typeof presentSpaces>[0][number];
const [result] = presentSpaces([space]);
expect(result?.plan).toBe(plan ?? null);
expect(result?.upgradeUrl).toBe(
plan === "free" ? "https://hyperframes.dev/pricing?entry=local_studio_share" : null,
);
},
);