tree 87dbfcf05d3ff2c87c13347c3366de4b12022ed7 parent 876f7e46a815a02f6fec7951ca2039a7aa617593 author Dante 1789685176 -0400 committer GitHub 1789685176 -0700 gpgsig -----BEGIN PGP SIGNATURE----- wsFcBAABCAAQBQJqrG24CRC1aQ7uu5UhlAAA5EIQAG8ftZgZPyl66wITtnWwOqpe y6hKsSvqoy0WVg7fxByxFymQYZFJ7SzTsd9QqrVeY64sLNssnbBmCDQ2KTLPZKuL 0zYzQdKzZcvPU9+JxzxNwqDtpCcnR4dUIG0yrUmogetQ5XtKDOXgT9aTRtYyGHha JdVfAkq8l7vYmB6yFEyF52vyY9ze8lohUXY0d99klRuj6UsJOa+xbWYZXU1XO32w etnKtEFHfuaI+gIqFKZPOdD3tmZawXhzYXGh1tT1Q1ZsgaIl+2DgCKTErg0h0P07 lAkEEnULuYBJQ3LTYNaEVfAyqIHkizxFzE7lDsBvncTaiYEUPdHHP4ohivBCCImr wU3cx+ADnUpdauXpVBmLcNJWGcyfhqrvQgZBpG019Ctl2CnA9g4LROi4JUS+x61N SMYsptb2QoWvVWm744du+hwJUtPk1Ak2sTPNZ+kun//iM+tr0GSkQ1vLFuumZ/ON vI6Ij+VqrMboWQAe+dv03FjUaumnw0QphkOnGJI0h/qI9CBt+35Jhnxki9jftQSe F2s9x5WygvHVLXvzcUVIX9xvol2YItjwR5iUmJ2d1OkdoL0iSjy0MOq+W3OqemY9 MVuPp7n07bLQWWPhEnfOA/4cBN7cpJUoYK+D9nvP5LyN2kcO42N1dRo9qoKjbo/p GnfjqC0snm+DclXyaMOo =h+Bg -----END PGP SIGNATURE----- [backport core/1.53] fix(billing): only one subscribe CTA at a time (#16721) (#17707) Backport of #16721 to `core/1.53`. The automation could not open this PR — the cherry-pick conflicted (`pr-backport.yaml` run [34923077263](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/34923077263)). ## Why A free-tier workspace that cannot run showed two subscribe CTAs at once: "Upgrade" in the top corner and "Subscribe to Run" in the Run slot. The coexistence was deliberate when built, but it reads as a glitch. ## Root cause `TopbarSubscribeButton` gated only on `isCloud && isFreeTier`, while `showsSubscribeToRunPrompt` is `isInitialized && !canRunWorkflows`. A free-tier workspace out of quota satisfies both, so both CTAs render. ## How `TopbarSubscribeButton` now yields while a Run-slot prompt is actually mounted. `SubscribeToRun` registers its presence through `useSubscribeCtaPresence`, so modes without the Run slot — builder, Linear without outputs, sales-managed, payment recovery — keep the Upgrade button and never drop to zero CTAs. The presence counter is read rather than the billing flag, because the flag over-reports: `CloudRunButtonWrapper` renders `ComfyQueueButton` instead of the prompt for sales-managed and payment-recovery states even while the flag is true. Also folds in the user-popover half: `showSubscribeAction` now requires `canTopUp`, so the popover no longer renders "Upgrade to add credits" and "Subscribe" side by side. ## AS IS / TO BE | State | AS IS | TO BE | | --- | --- | --- | | Free tier, free quota left | Upgrade | Upgrade | | Free tier, can't run | Upgrade + Subscribe to Run | Subscribe to Run | | Subscribed | neither | neither | | Sales-managed / payment recovery | queue-button treatments | unchanged | Behavioral evidence for the original change is on #16721; this backport is a cherry-pick of that reviewed commit with no production-code changes of its own. ## Conflict resolution Only the two test files conflicted; every production file applied cleanly. `main` rewrote both test files' mocks after this branch was cut — typed `vi.mock(import(...))` specifiers, `vi.mock('pinia')` dropped in favour of the global testing pinia, and `useDialogStore` asserted directly instead of through a hoisted stub. The cherry-pick dragged those rewrites onto a branch that does not have them. Resolution keeps this branch's existing mock style and layers only the PR's additions on top: the reactive `useBillingContext` mock, the `useSubscribeCtaPresence` mock, the presence-registering `SubscribeToRun` stub, and the "one subscribe CTA at a time" cases. The `BillingStatus` type import and `useDialogStore` assertions were left out — they belong to main-only changes, not to this PR. ## Verification `CloudRunButtonWrapper.test.ts`, `TopbarSubscribeButton.test.ts`, and `CurrentUserPopoverWorkspace.test.ts` on this branch: 59 tests, all passing. `oxlint` and `oxfmt --check` clean on both resolved files. Co-authored-by: comfydesigner