Files
openmotion/studio
huihui-crypto add7f1ef98 feat(studio): after a paid-path sign-in, open the plans dialog directly (stacked on #1187 + #1194) (#1197)
* feat(studio): resume the upgrade step after a guest signs in from an upgrade surface

A guest who meets an upgrade surface (blocked generation modal, Agent media
gate, header Pricing, Black Friday banner) must sign in first, and the
upgrade step was dropped once they came back signed in.

Save a short-lived upgrade intent (hook id + gate attribution, 30 min TTL)
when the guest starts signing in; when the account comes back on Free or
Go, EntitlementModalHost reopens the upgrade modal once for the same
surface with a fresh entry id. Plus and above drop it. One Tap's own
Free/Go Pricing redirect clears it to avoid a double prompt. Storage is
the source of truth across windows; the in-memory copy is used only when
the latest save could not reach storage.

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

* fix(studio): resume the upgrade step only from upgrade surfaces

- Keep an upgrade intent only for upgrade surfaces (blocked generation and
  plan gates, Agent media gate, header Pricing, Black Friday entries). A plain
  guest sign-in (header/settings sign-in, template use, MCP, assets) now
  replaces any saved intent instead of reopening an upgrade modal.
- Forget the intent when sign-in is cancelled (auth_cancelled), on sign-out,
  and when the account is signed in but the plan cannot be known, so the modal
  never appears later out of context.
- Report the resumed modal with gate_reason=resumed_after_signin instead of
  plan_locked, so it is not counted as a real plan gate or a guest prompt.

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

* fix(studio): keep the Agent media sign-in from model settings as an upgrade surface

The Agent media gate opens /settings/models?entry_from=agent_media_*; its sign-in
guide opened the settings_signin guest modal, which no longer keeps an upgrade
intent. Open it as agent_media_gate (guest_signin) instead, and save the intent on
the direct login path too.

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

* fix(studio): forget the upgrade intent on a plain direct sign-in from model settings

The direct-login branch of the model-settings sign-in guide (desktop, or no
guest modal / account page) kept an earlier upgrade intent when the entry was
not an Agent media gate. Clear it there, as the other plain sign-ins do, and
cover the branch in the test.

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

* feat(studio): send signed-in upgrade clicks straight to the plans dialog

A signed-in account that clicks header Pricing, the Black Friday banner, the
Explore Black Friday hero, the model hub promo or the upgrade modal now opens
the console plans dialog (/dashboard?billing=plan) instead of public Pricing,
where it had to pick a plan and press subscribe again before reaching the same
dialog. The link keeps the same od_entry_* and utm fields, so attribution is
unchanged. Browser cloud mode goes through /auth/upgrade-handoff bound to the
expected account; desktop and handoff-disabled builds open the console
directly. Guests, dev auth mode and an unknown account keep public Pricing.

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

* feat(studio): open the plans dialog when a guest signs in from an upgrade surface

A guest who signs in from a paid path (blocked generation, Agent media gate,
header Pricing, Black Friday banner/hero/hub) and comes back on Free or Go
now goes straight to the OpenDesign plans dialog (/dashboard?billing=plan)
with the original od_entry_id, utm_source and interval=monthly, instead of
reopening the in-app upgrade modal. The modal stays as the fallback when the
dialog cannot open (popup blocked inside an iframe). Plain sign-ins and paid
plans still show nothing. New event upgrade_resume_open measures it.

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

* fix(studio): report an unsupported plans dialog as unavailable, not popup_blocked

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

* fix(studio): fall back to the upgrade modal when the desktop browser cannot open; allow upgrade_resume_open in cloud tracking

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

* fix(studio): report whether an external page actually opened so the resume can fall back

openExternalUrl now resolves false when neither the desktop host nor the
browser opened the page, and openBillingAndRefreshOnFocus returns that as
opened; the sign-in resume shows the in-app upgrade modal in that case.

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

* fix(studio): open the browser fallback without window features so a successful open is detected

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

* feat(studio): open the plans dialog from model hub View plans and report destination on upgrade clicks

- Model hub availability "View plans": a signed-in (non-dev) account now opens the
  console plans dialog directly (utm_medium=model_hub_plans) instead of Settings ›
  Subscription first. Guests still go to sign-in.
- Every upgrade click reports destination=amr_plans|landing_pricing, derived from the
  address it opens: header Pricing, Black Friday banner/hero/hub pill, MAGI-2 modal,
  upgrade modal, settings subscription links, empty-catalog Upgrade to Plus.

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

* fix(studio): clear the upgrade intent on every plain sign-in and mark checkout only after the plans dialog opens

Plain sign-in starts (header menu, template use, assets, history, session recovery) now build the login
address with plainSignInUrl, which forgets an upgrade intent saved by an earlier upgrade click; a guard
test keeps buildLoginUrl to upgrade surfaces that save their intent. The resumed upgrade sets the
checkout-return marker only when the plans dialog actually opened, so a blocked or unavailable open no
longer reports a checkout refresh on the next focus.

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

* refactor(studio): build every console plans address with one shared builder

campaignPlansHref, campaignPricingHref, buildSubscriptionUrl and the Magi2
modal now share consolePlansUrl / upgradeHandoffHref / consolePlansHref, so the
/auth/upgrade-handoff contract and the console path normalization live in one
place. A consoleUrl ending in /dashboard no longer becomes /dashboard/dashboard,
and a missing consoleUrl falls back to /cloud/dashboard.

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

* fix(studio): keep configured console bases as given when building the plans address

Only the bare production host falls back to /cloud/dashboard; a configured
console such as https://console.example.test keeps /dashboard, as before.

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

* fix(studio): mark the model hub checkout return only after the plans page opened

A blocked window no longer leaves a pending checkout that reports a false
entitlement_refresh_result on the next focus.

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

* test(cloud): raise the allowlist budget to 47 for upgrade_resume_open

main's OpenGame Stage 1 (#1198) filled the 46-event budget; this PR adds
upgrade_resume_open, so the budget moves to 47.

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

---------

Co-authored-by: zhanghuihua <zhanghuihua@huihuideMacBook-Pro.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: zhanghuihua <zhanghuihua@Mac.lan>
2026-12-01 20:57:06 +08:00
..
…

OpenDesign Motion editor

This directory contains the complete editable Hyperframes Studio frontend from 0.9.7, commit 3baf81f9a92615507f76fe8de33e489034ee77ec: src, public, and its test fixtures. The upstream Apache-2.0 license is in LICENSE; original package metadata is in upstream-package.json.

The native editor owns the dock, panels, timeline, canvas, source editing, media previews, keyframes, variables, history, WebMCP tools and render queue. src/motion/MotionStudioHost.tsx supplies the brand, project switcher, template library and MCP connection dialog through small header slots. Our theme is a separate CSS entry; it does not replace editor components or editing behavior. The top bar is one row on desktop, with host actions beside native Studio actions. It also exposes native Undo/Redo, an always available Preview recovery button, and a Layout menu with panel visibility, presets and reset. Dock recovery places a closed preview between the side columns instead of adding another full row. The dockable history panel uses the native history API for checkpoints, pins and restores. Restoring creates a new undoable entry and retains the later edits. The history tab is an OpenDesign addition; its operations use Hyperframes' existing history service, not a separate version store.

src/i18n/ provides live Simplified Chinese / English switching from the top bar. The product defaults to Chinese and persists the choice in motion.studio.locale. English source messages are the keys and fallback; Chinese lives in zh-CN.json. Use useI18n().t(message, values) for UI copy, and formatDate / formatNumber for locale-sensitive display. Add plural forms in I18n.tsx when needed. Translate labels at display boundaries; keep property values, panel IDs, file names, project names, and authored video content intact. Native dock titles update in place, so switching languages does not reset layout, selection, playback, or preview frames. Standalone upstream components retain English unless wrapped in I18nProvider.

The parser, player, SDK, CLI server and renderer are pinned upstream packages. The local server streams /api/ to the native Hyperframes service. Product project/template/background-export endpoints live under /motion-api/. The header's Export button uses the native render queue and format settings; agent background exports remain available through MCP.

Run from the repository root:

npm ci
npm run dev
npm run typecheck:studio
npm run test:studio
npm test

build/ is generated and included in the plugin ZIP. After frontend edits, run npm run build:studio and refresh. The token source is ../packages/design-system/tokens.json; src/motion/theme.css adapts it to Studio's native theme preferences. UI styles never enter composition files or renders.

test:studio runs all unit/DOM suites. Test-only adaptations cover the moved package paths, installed SDK exports, Happy DOM 21 iframe behavior, and CSS properties that require jsdom. Real Chrome *.browser.test.ts benches and the upstream tests/ harness are retained separately and excluded from this unit command. npm test exercises native APIs, MCP, project switching, shared files and real video rendering when Chrome and FFmpeg are available.

See ../docs/editor-fork.md for the integration boundaries.

Acknowledgements

Timeline placement and drag snapping come from OpenReel Video at 367d7e90b61b5181f9861b852bb8b9d7a7d2954a. Copyright © 2024–2026 Augustus Otu and Contributors, MIT License. The complete upstream notice is retained in src/player/components/openreel/timelinePlacement.ts, src/player/components/openreel/calculateSnap.ts, and the compiled Studio bundle. Motion keeps its composition, linked-edit and persistence contracts.