feat: pass target tier to billing portal for subscription updates#7692
feat: pass target tier to billing portal for subscription updates#7692christian-byrne merged 8 commits intomainfrom
Conversation
When user with active subscription clicks a tier in PricingTable, pass the target tier to accessBillingPortal for deep linking to Stripe's subscription update confirmation screen.
📝 WalkthroughWalkthroughAdds an optional target_tier parameter to billing-portal requests, exports a BillingPortalTargetTier type, threads the tier through the auth store and composable, updates PricingTable to call the billing portal with a computed tier for active subscribers, and adds/updates tests for these flows. Changes
Sequence DiagramsequenceDiagram
actor User
participant PricingTable as PricingTable
participant AuthActions as useFirebaseAuthActions
participant AuthStore as firebaseAuthStore
participant API as Billing Portal API
User->>PricingTable: Click "Subscribe"/upgrade
alt active subscription
PricingTable->>PricingTable: compute checkoutTier (e.g., "pro-yearly")
PricingTable->>AuthActions: accessBillingPortal(checkoutTier)
AuthActions->>AuthStore: accessBillingPortal(targetTier)
AuthStore->>AuthStore: requestBody = { target_tier: targetTier }
AuthStore->>API: POST /customers/billing with JSON body
API-->>AuthStore: { billing_portal_url }
AuthStore-->>AuthActions: return response
AuthActions-->>PricingTable: return URL
PricingTable->>User: open billing_portal_url (deep link)
else new subscriber
PricingTable->>API: POST /cloud-subscription-checkout
API-->>PricingTable: { checkout_url }
PricingTable->>User: open checkout_url
end
Possibly related PRs
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 12/22/2025, 06:32:39 PM UTC 🔗 Links🎉 Your Storybook is ready for review! |
🎭 Playwright Test Results✅ All tests passed! ⏰ Completed at: 12/22/2025, 06:42:14 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 3.19 MB (baseline 3.19 MB) • 🔴 +94 BMain entry bundles and manifests
Status: 3 added / 3 removed Graph Workspace — 996 kB (baseline 996 kB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 6.54 kB (baseline 6.54 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 1 added / 1 removed Panels & Settings — 295 kB (baseline 295 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 6 added / 6 removed UI Components — 186 kB (baseline 186 kB) • ⚪ 0 BReusable component library chunks
Status: 8 added / 8 removed Data & Services — 12.5 kB (baseline 12.5 kB) • ⚪ 0 BStores, services, APIs, and repositories
Status: 2 added / 2 removed Utilities & Hooks — 1.41 kB (baseline 1.41 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 1 added / 1 removed Vendor & Third-Party — 9.1 MB (baseline 9.1 MB) • ⚪ 0 BExternal libraries and shared vendor chunks
Other — 3.44 MB (baseline 3.44 MB) • 🔴 +21 BBundles that do not match a named category
Status: 20 added / 20 removed |
- Add accessBillingPortal tests with targetTier parameter to firebaseAuthStore.test.ts - Create PricingTable.test.ts for subscription tier change deep linking behavior
## Summary Fix: PricingTable showed "Current Plan" on the wrong billing cycle (e.g., showing it on Yearly when subscribed to Monthly) because we weren't checking subscription_duration. Now we check for ANNUAL | MONTHLY match. Fix: Subscribed users were being sent to billing portal instead of checkout. Now routes to checkout. Improved: Types now use openapi.yml as source of truth. Tier names in user popover and subscription panels now reflect the billing cycle (YEARLY/MONTHLY). Recommended to merge this before #7692 --------- Co-authored-by: bymyself <cbyrne@comfy.org>
## Summary Fix: PricingTable showed "Current Plan" on the wrong billing cycle (e.g., showing it on Yearly when subscribed to Monthly) because we weren't checking subscription_duration. Now we check for ANNUAL | MONTHLY match. Fix: Subscribed users were being sent to billing portal instead of checkout. Now routes to checkout. Improved: Types now use openapi.yml as source of truth. Tier names in user popover and subscription panels now reflect the billing cycle (YEARLY/MONTHLY). Recommended to merge this before #7692 --------- Co-authored-by: bymyself <cbyrne@comfy.org>
christian-byrne
left a comment
There was a problem hiding this comment.
LGTM, should be good after backend is deployed.
| const accessBillingPortal = wrapWithErrorHandlingAsync( | ||
| async ( | ||
| targetTier?: Parameters<typeof authStore.accessBillingPortal>[0] | ||
| ) => { |
There was a problem hiding this comment.
nit: Since wrapWithErrorHandlingAsync is generic, I believe the more idiomatic pattern would be to provide the tuple and return generics at the call site and let those flow through to the paramter.
I also wouldn't use Parameters<typeof authStore.accessBillingPortal>[0] because it hides which argument the wrapper expects because readers have to mentally index into the tuple. Spelling out [BillingPortalTargetTier | undefined] keeps the intent obvious, and we still fail fast the moment accessBillingPortal changes.
Suggestion:
const accessBillingPortal = wrapWithErrorHandlingAsync<
[BillingPortalTargetTier | undefined],
void
>(async (targetTier) => {
const response = await authStore.accessBillingPortal(targetTier)
// …
}, reportError)There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
packages/registry-types/src/comfyRegistryTypes.tssrc/composables/auth/useFirebaseAuthActions.tssrc/platform/cloud/subscription/components/PricingTable.vuesrc/stores/firebaseAuthStore.tstests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.ts
🧰 Additional context used
📓 Path-based instructions (17)
**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,vue}: Use TypeScript exclusively; do not write new JavaScript code
Use sorted and grouped imports organized by plugin/source
Enforce ESLint rules including Vue + TypeScript rules, disallow floating promises, disallow unused imports, and restrict i18n raw text in templates
Do not useanytype oras anytype assertions; fix the underlying type issue instead
Write code that is expressive and self-documenting; avoid redundant comments and clean as you go
Keep functions short and functional; minimize nesting and follow the arrow anti-pattern
Avoid mutable state; prefer immutability and assignment at point of declaration
Use function declarations instead of function expressions when possible
Use es-toolkit for utility functions
Implement proper error handling in code
Files:
packages/registry-types/src/comfyRegistryTypes.tssrc/stores/firebaseAuthStore.tstests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.tssrc/platform/cloud/subscription/components/PricingTable.vuesrc/composables/auth/useFirebaseAuthActions.ts
**/*.{ts,tsx,vue,js,jsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Apply Prettier formatting with 2-space indentation, single quotes, no trailing semicolons, and 80-character line width
Files:
packages/registry-types/src/comfyRegistryTypes.tssrc/stores/firebaseAuthStore.tstests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.tssrc/platform/cloud/subscription/components/PricingTable.vuesrc/composables/auth/useFirebaseAuthActions.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Minimize the surface area (exported values) of each module and composable
Files:
packages/registry-types/src/comfyRegistryTypes.tssrc/stores/firebaseAuthStore.tstests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.tssrc/composables/auth/useFirebaseAuthActions.ts
src/**/*.{vue,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{vue,ts}: Leverage VueUse functions for performance-enhancing styles
Implement proper error handling
Use vue-i18n in composition API for any string literals. Place new translation entries in src/locales/en/main.json
Files:
src/stores/firebaseAuthStore.tssrc/platform/cloud/subscription/components/PricingTable.vuesrc/composables/auth/useFirebaseAuthActions.ts
src/**/*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.ts: Use es-toolkit for utility functions
Use TypeScript for type safety
Files:
src/stores/firebaseAuthStore.tssrc/composables/auth/useFirebaseAuthActions.ts
src/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/*.{ts,tsx,vue}: Sanitize HTML with DOMPurify to prevent XSS attacks
Avoid using @ts-expect-error; use proper TypeScript types instead
Use es-toolkit for utility functions instead of other utility libraries
Implement proper TypeScript types throughout the codebase
Files:
src/stores/firebaseAuthStore.tssrc/platform/cloud/subscription/components/PricingTable.vuesrc/composables/auth/useFirebaseAuthActions.ts
src/**/stores/**/*.{ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/stores/**/*.{ts,tsx}: Maintain clear public interfaces and restrict extension access in stores
Use TypeScript for type safety in state management stores
Files:
src/stores/firebaseAuthStore.ts
src/**/*.{vue,ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Follow Vue 3 composition API style guide
Files:
src/stores/firebaseAuthStore.tssrc/platform/cloud/subscription/components/PricingTable.vuesrc/composables/auth/useFirebaseAuthActions.ts
**/*Store.ts
📄 CodeRabbit inference engine (AGENTS.md)
Name Pinia stores using the pattern
*Store.ts
Files:
src/stores/firebaseAuthStore.ts
tests-ui/**/*.test.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (tests-ui/CLAUDE.md)
tests-ui/**/*.test.{js,ts,jsx,tsx}: Write tests for new features
Follow existing test patterns in the codebase
Use existing test utilities rather than writing custom utilities
Mock external dependencies in tests
Always prefer vitest mock functions over writing verbose manual mocks
Files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.ts
**/*.test.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.test.ts: Use unit/component tests intests-ui/orsrc/**/*.test.tswith Vitest framework
For mocking in tests, leverage Vitest utilities; keep module mocks contained and avoid global mutable state within test files
Do not write change detector tests or tests dependent on non-behavioral features like utility classes or styles
Aim for behavioral coverage of critical and new features in unit tests
Files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.ts
src/**/*.vue
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.vue: Use the Vue 3 Composition API instead of the Options API when writing Vue components (exception: when overriding or extending PrimeVue components for compatibility)
Use setup() function for component logic
Utilize ref and reactive for reactive state
Implement computed properties with computed()
Use watch and watchEffect for side effects
Implement lifecycle hooks with onMounted, onUpdated, etc.
Utilize provide/inject for dependency injection
Use vue 3.5 style of default prop declaration
Use Tailwind CSS for styling
Implement proper props and emits definitions
Utilize Vue 3's Teleport component when needed
Use Suspense for async components
Follow Vue 3 style guide and naming conventions
Files:
src/platform/cloud/subscription/components/PricingTable.vue
src/**/{composables,components}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Clean up subscriptions in state management to prevent memory leaks
Files:
src/platform/cloud/subscription/components/PricingTable.vuesrc/composables/auth/useFirebaseAuthActions.ts
src/**/{components,composables}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Use vue-i18n for ALL user-facing strings by adding them to
src/locales/en/main.json
Files:
src/platform/cloud/subscription/components/PricingTable.vuesrc/composables/auth/useFirebaseAuthActions.ts
**/*.vue
📄 CodeRabbit inference engine (AGENTS.md)
**/*.vue: Use Vue 3.5+ with TypeScript in.vuefiles, exclusively using Composition API with<script setup lang="ts">syntax
Use Tailwind 4 for styling in Vue components; avoid<style>blocks
Name Vue components using PascalCase (e.g.,MenuHamburger.vue)
Use Vue 3.5 TypeScript-style default prop declaration with reactive props destructuring; do not usewithDefaultsor runtime props declaration
Prefercomputed()overrefwithwatchwhen deriving values
PreferuseModelover separately defining prop and emit for two-way binding
Usevue-i18nin composition API for string literals; place new translation entries insrc/locales/en/main.json
Usecn()utility function from@/utils/tailwindUtilfor merging Tailwind class names; do not use:class="[]"syntax
Do not use thedark:Tailwind variant; use semantic values from thestyle.csstheme instead (e.g.,bg-node-component-surface)
Do not use!importantor the!important prefix for Tailwind classes; find and correct interfering!importantclasses instead
Avoid new usage of PrimeVue components; use VueUse, shadcn/vue, or Reka UI instead
Leverage VueUse functions for performance-enhancing styles in Vue components
Implement proper props and emits definitions in Vue components
Utilize Vue 3's Teleport component when needed
Use Suspense for async components
Follow Vue 3 style guide and naming conventions
Files:
src/platform/cloud/subscription/components/PricingTable.vue
src/**/{services,composables}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/{services,composables}/**/*.{ts,tsx}: Useapi.apiURL()for backend endpoints instead of constructing URLs directly
Useapi.fileURL()for static file access instead of constructing URLs directly
Files:
src/composables/auth/useFirebaseAuthActions.ts
**/**/use[A-Z]*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Name composables using the pattern
useXyz.ts
Files:
src/composables/auth/useFirebaseAuthActions.ts
🧠 Learnings (17)
📚 Learning: 2025-12-09T03:39:54.501Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7169
File: src/platform/remote/comfyui/jobs/jobTypes.ts:1-107
Timestamp: 2025-12-09T03:39:54.501Z
Learning: In the ComfyUI_frontend project, Zod is on v3.x. Do not suggest Zod v4 standalone validators (z.uuid, z.ulid, z.cuid2, z.nanoid) until an upgrade to Zod 4 is performed. When reviewing TypeScript files (e.g., src/platform/remote/comfyui/jobs/jobTypes.ts) validate against Zod 3 capabilities and avoid introducing v4-specific features; flag any proposal to upgrade or incorporate v4-only validators and propose staying with compatible 3.x patterns.
Applied to files:
packages/registry-types/src/comfyRegistryTypes.tssrc/stores/firebaseAuthStore.tstests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.tssrc/composables/auth/useFirebaseAuthActions.ts
📚 Learning: 2025-12-13T11:03:11.264Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7416
File: src/stores/imagePreviewStore.ts:5-7
Timestamp: 2025-12-13T11:03:11.264Z
Learning: In the ComfyUI_frontend repository, lint rules require keeping 'import type' statements separate from non-type imports, even if importing from the same module. Do not suggest consolidating them into a single import statement. Ensure type imports remain on their own line (import type { ... } from 'module') and regular imports stay on separate lines.
Applied to files:
packages/registry-types/src/comfyRegistryTypes.tssrc/stores/firebaseAuthStore.tstests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.tssrc/composables/auth/useFirebaseAuthActions.ts
📚 Learning: 2025-12-17T00:40:09.635Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7537
File: src/components/ui/button/Button.stories.ts:45-55
Timestamp: 2025-12-17T00:40:09.635Z
Learning: Prefer pure function declarations over function expressions (e.g., use function foo() { ... } instead of const foo = () => { ... }) for pure functions in the repository. Function declarations are more functional-leaning, offer better hoisting clarity, and can improve readability and tooling consistency. Apply this guideline across TypeScript files in Comfy-Org/ComfyUI_frontend, including story and UI component code, except where a function expression is semantically required (e.g., callbacks, higher-order functions with closures).
Applied to files:
packages/registry-types/src/comfyRegistryTypes.tssrc/stores/firebaseAuthStore.tstests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.tssrc/composables/auth/useFirebaseAuthActions.ts
📚 Learning: 2025-12-11T12:25:15.470Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7358
File: src/components/dialog/content/signin/SignUpForm.vue:45-54
Timestamp: 2025-12-11T12:25:15.470Z
Learning: This repository uses CI automation to format code (pnpm format). Do not include manual formatting suggestions in code reviews for Comfy-Org/ComfyUI_frontend. If formatting issues are detected, rely on the CI formatter or re-run pnpm format. Focus reviews on correctness, readability, performance, accessibility, and maintainability rather than style formatting.
Applied to files:
packages/registry-types/src/comfyRegistryTypes.tssrc/stores/firebaseAuthStore.tstests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.tssrc/platform/cloud/subscription/components/PricingTable.vuesrc/composables/auth/useFirebaseAuthActions.ts
📚 Learning: 2025-11-24T19:47:34.324Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:34.324Z
Learning: Applies to src/**/stores/**/*.{ts,tsx} : Maintain clear public interfaces and restrict extension access in stores
Applied to files:
src/stores/firebaseAuthStore.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Write tests for new features
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : Use unit/component tests in `tests-ui/` or `src/**/*.test.ts` with Vitest framework
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Mock external dependencies in tests
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : For mocking in tests, leverage Vitest utilities; keep module mocks contained and avoid global mutable state within test files
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : Aim for behavioral coverage of critical and new features in unit tests
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-10T03:09:13.807Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7303
File: src/components/topbar/CurrentUserPopover.test.ts:199-205
Timestamp: 2025-12-10T03:09:13.807Z
Learning: In test files, prefer selecting or asserting on accessible properties (text content, aria-label, role, accessible name) over data-testid attributes. This ensures tests validate actual user-facing behavior and accessibility, reducing reliance on implementation details like test IDs.
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.tstests-ui/tests/store/firebaseAuthStore.test.ts
📚 Learning: 2025-12-09T03:49:52.828Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 6300
File: src/platform/updates/components/WhatsNewPopup.vue:5-13
Timestamp: 2025-12-09T03:49:52.828Z
Learning: In Vue files across the ComfyUI_frontend repo, when a button is needed, prefer the repo's common button components from src/components/button/ (IconButton.vue, TextButton.vue, IconTextButton.vue) over plain HTML <button> elements. These components wrap PrimeVue with the project’s design system styling. Use only the common button components for consistency and theming, and import them from src/components/button/ as needed.
Applied to files:
src/platform/cloud/subscription/components/PricingTable.vue
📚 Learning: 2025-12-09T21:40:12.361Z
Learnt from: benceruleanlu
Repo: Comfy-Org/ComfyUI_frontend PR: 7297
File: src/components/actionbar/ComfyActionbar.vue:33-43
Timestamp: 2025-12-09T21:40:12.361Z
Learning: In Vue single-file components, allow inline Tailwind CSS class strings for static classes and avoid extracting them into computed properties solely for readability. Prefer keeping static class names inline for simplicity and performance. For dynamic or conditional classes, use Vue bindings (e.g., :class) to compose classes.
Applies to all Vue files in the repository (e.g., src/**/*.vue) where Tailwind utilities are used for static styling.
Applied to files:
src/platform/cloud/subscription/components/PricingTable.vue
📚 Learning: 2025-12-16T22:26:49.463Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7537
File: src/components/ui/button/Button.vue:17-17
Timestamp: 2025-12-16T22:26:49.463Z
Learning: In Vue 3.5+ with <script setup>, when using defineProps<Props>() with partial destructuring (e.g., const { as = 'button', class: customClass = '' } = defineProps<Props>() ), props that are not destructured (e.g., variant, size) stay accessible by name in the template scope. This pattern is valid: you can destructure only a subset of props for convenience while referencing the remaining props directly in template expressions. Apply this guideline to Vue components across the codebase (all .vue files).
Applied to files:
src/platform/cloud/subscription/components/PricingTable.vue
📚 Learning: 2025-12-18T02:07:38.870Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7598
File: src/components/sidebar/tabs/AssetsSidebarTab.vue:131-131
Timestamp: 2025-12-18T02:07:38.870Z
Learning: Tailwind CSS v4 safe utilities (e.g., items-center-safe, justify-*-safe, place-*-safe) are allowed in Vue components under src/ and in story files. Do not flag these specific safe variants as invalid when reviewing code in src/**/*.vue or related stories.
Applied to files:
src/platform/cloud/subscription/components/PricingTable.vue
📚 Learning: 2025-12-18T21:15:46.862Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7603
File: src/components/queue/QueueOverlayHeader.vue:49-59
Timestamp: 2025-12-18T21:15:46.862Z
Learning: In the ComfyUI_frontend repository, for Vue components, do not add aria-label to buttons that have visible text content (e.g., buttons containing <span> text). The visible text provides the accessible name. Use aria-label only for elements without visible labels (e.g., icon-only buttons). If a button has no visible label, provide a clear aria-label or associate with an aria-labelledby describing its action.
Applied to files:
src/platform/cloud/subscription/components/PricingTable.vue
📚 Learning: 2025-12-21T01:06:02.786Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7649
File: src/components/graph/selectionToolbox/ColorPickerButton.vue:15-18
Timestamp: 2025-12-21T01:06:02.786Z
Learning: In Comfy-Org/ComfyUI_frontend, in Vue component files, when a filled icon is required (e.g., 'pi pi-circle-fill'), you may mix PrimeIcons with Lucide icons since Lucide lacks filled variants. This mixed usage is acceptable when one icon library does not provide an equivalent filled icon. Apply consistently across Vue components in the src directory where icons are used, and document the rationale when a mixed approach is chosen.
Applied to files:
src/platform/cloud/subscription/components/PricingTable.vue
🧬 Code graph analysis (1)
src/composables/auth/useFirebaseAuthActions.ts (1)
src/stores/firebaseAuthStore.ts (1)
BillingPortalTargetTier(45-49)
🪛 GitHub Actions: CI: Lint Format
src/platform/cloud/subscription/components/PricingTable.vue
[error] 449-449: ESLint: 'accessBillingPortal' is not defined. (no-undef)
🪛 GitHub Actions: CI: Size Data
src/platform/cloud/subscription/components/PricingTable.vue
[error] 449-449: TS2304: Cannot find name 'accessBillingPortal'. This occurred during typechecking (vue-tsc --noEmit).
🪛 GitHub Check: collect
src/platform/cloud/subscription/components/PricingTable.vue
[failure] 449-449:
Cannot find name 'accessBillingPortal'.
🪛 GitHub Check: lint-and-format
src/platform/cloud/subscription/components/PricingTable.vue
[failure] 449-449:
'accessBillingPortal' is not defined
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: setup
- GitHub Check: test
🔇 Additional comments (6)
packages/registry-types/src/comfyRegistryTypes.ts (1)
11913-11914: The target_tier union is correct and properly typed. Verification confirms it matches the BillingPortalTargetTier type in firebaseAuthStore.ts, as both derive from the same AccessBillingPortal OpenAPI schema definition in the registry types. No type inconsistencies found.src/stores/firebaseAuthStore.ts (2)
45-49: LGTM! Clean type extraction.The type extraction using
NonNullablecorrectly derives the target tier type from the OpenAPI-generated types, ensuring type safety and avoiding duplication.
416-447: LGTM! Clean API simplification.The refactored signature accepting an optional
targetTierparameter is cleaner than accepting the full request body. The conditional body construction correctly includes the tier only when provided.tests-ui/tests/store/firebaseAuthStore.test.ts (1)
548-617: LGTM! Comprehensive test coverage for billing portal flow.The new test suite thoroughly validates:
- API call without body when no
targetTieris provided- Request body structure when
targetTieris included- Multiple tier format variations (monthly and yearly)
- Error handling for failed responses
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts (1)
134-233: LGTM! Excellent test coverage for billing portal deep linking.The test suite provides comprehensive behavioral coverage:
- Validates correct tier suffixes for billing portal deep linking
- Ensures current plan doesn't trigger billing portal calls
- Verifies checkout flow still works for new subscribers
- Tests multiple subscription tiers correctly
Tests follow best practices by querying elements via accessible text content rather than test IDs.
src/composables/auth/useFirebaseAuthActions.ts (1)
106-119: LGTM! Clean generic type usage.The explicit generic types
[targetTier?: BillingPortalTargetTier], voidmake the wrapper's signature clear and maintainable. ThetargetTierparameter is correctly forwarded to the store method while preserving existing error handling.
|
Oops, made a mistake while fixing conflict in GitHub UI, fixing now. |
The accessBillingPortal import was accidentally removed during merge conflict resolution but is still used in handleSubscribe function.
🔧 Auto-fixes AppliedThis PR has been automatically updated to fix linting and formatting issues.
Changes made:
|
The test was failing because isYearlySubscription was missing from the useSubscription mock, causing undefined access errors.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
🧰 Additional context used
📓 Path-based instructions (5)
tests-ui/**/*.test.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (tests-ui/CLAUDE.md)
tests-ui/**/*.test.{js,ts,jsx,tsx}: Write tests for new features
Follow existing test patterns in the codebase
Use existing test utilities rather than writing custom utilities
Mock external dependencies in tests
Always prefer vitest mock functions over writing verbose manual mocks
Files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,vue}: Use TypeScript exclusively; do not write new JavaScript code
Use sorted and grouped imports organized by plugin/source
Enforce ESLint rules including Vue + TypeScript rules, disallow floating promises, disallow unused imports, and restrict i18n raw text in templates
Do not useanytype oras anytype assertions; fix the underlying type issue instead
Write code that is expressive and self-documenting; avoid redundant comments and clean as you go
Keep functions short and functional; minimize nesting and follow the arrow anti-pattern
Avoid mutable state; prefer immutability and assignment at point of declaration
Use function declarations instead of function expressions when possible
Use es-toolkit for utility functions
Implement proper error handling in code
Files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
**/*.{ts,tsx,vue,js,jsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Apply Prettier formatting with 2-space indentation, single quotes, no trailing semicolons, and 80-character line width
Files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
**/*.test.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.test.ts: Use unit/component tests intests-ui/orsrc/**/*.test.tswith Vitest framework
For mocking in tests, leverage Vitest utilities; keep module mocks contained and avoid global mutable state within test files
Do not write change detector tests or tests dependent on non-behavioral features like utility classes or styles
Aim for behavioral coverage of critical and new features in unit tests
Files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Minimize the surface area (exported values) of each module and composable
Files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
🧠 Learnings (10)
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Write tests for new features
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Mock external dependencies in tests
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : Aim for behavioral coverage of critical and new features in unit tests
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : Use unit/component tests in `tests-ui/` or `src/**/*.test.ts` with Vitest framework
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-21T06:04:12.548Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-21T06:04:12.548Z
Learning: Applies to **/*.test.ts : For mocking in tests, leverage Vitest utilities; keep module mocks contained and avoid global mutable state within test files
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-09T03:39:54.501Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7169
File: src/platform/remote/comfyui/jobs/jobTypes.ts:1-107
Timestamp: 2025-12-09T03:39:54.501Z
Learning: In the ComfyUI_frontend project, Zod is on v3.x. Do not suggest Zod v4 standalone validators (z.uuid, z.ulid, z.cuid2, z.nanoid) until an upgrade to Zod 4 is performed. When reviewing TypeScript files (e.g., src/platform/remote/comfyui/jobs/jobTypes.ts) validate against Zod 3 capabilities and avoid introducing v4-specific features; flag any proposal to upgrade or incorporate v4-only validators and propose staying with compatible 3.x patterns.
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-13T11:03:11.264Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7416
File: src/stores/imagePreviewStore.ts:5-7
Timestamp: 2025-12-13T11:03:11.264Z
Learning: In the ComfyUI_frontend repository, lint rules require keeping 'import type' statements separate from non-type imports, even if importing from the same module. Do not suggest consolidating them into a single import statement. Ensure type imports remain on their own line (import type { ... } from 'module') and regular imports stay on separate lines.
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-17T00:40:09.635Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7537
File: src/components/ui/button/Button.stories.ts:45-55
Timestamp: 2025-12-17T00:40:09.635Z
Learning: Prefer pure function declarations over function expressions (e.g., use function foo() { ... } instead of const foo = () => { ... }) for pure functions in the repository. Function declarations are more functional-leaning, offer better hoisting clarity, and can improve readability and tooling consistency. Apply this guideline across TypeScript files in Comfy-Org/ComfyUI_frontend, including story and UI component code, except where a function expression is semantically required (e.g., callbacks, higher-order functions with closures).
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-10T03:09:13.807Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7303
File: src/components/topbar/CurrentUserPopover.test.ts:199-205
Timestamp: 2025-12-10T03:09:13.807Z
Learning: In test files, prefer selecting or asserting on accessible properties (text content, aria-label, role, accessible name) over data-testid attributes. This ensures tests validate actual user-facing behavior and accessibility, reducing reliance on implementation details like test IDs.
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
📚 Learning: 2025-12-11T12:25:15.470Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7358
File: src/components/dialog/content/signin/SignUpForm.vue:45-54
Timestamp: 2025-12-11T12:25:15.470Z
Learning: This repository uses CI automation to format code (pnpm format). Do not include manual formatting suggestions in code reviews for Comfy-Org/ComfyUI_frontend. If formatting issues are detected, rely on the CI formatter or re-run pnpm format. Focus reviews on correctness, readability, performance, accessibility, and maintainability rather than style formatting.
Applied to files:
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: setup
- GitHub Check: lint-and-format
- GitHub Check: test
- GitHub Check: collect
🔇 Additional comments (3)
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts (3)
9-64: LGTM! Mock setup follows Vitest best practices.The mock setup is comprehensive and properly isolates external dependencies. The inclusion of
isYearlySubscriptionin theuseSubscriptionmock (line 24) addresses the test failure mentioned in the commit message. All mocks are contained and reset inbeforeEach.
66-123: LGTM! Test fixture setup is thorough.The i18n configuration and component stubs provide appropriate test fixtures. The
createWrapperhelper properly configures the testing environment with Pinia and stubs for UI components.
190-218: LGTM! New subscriber checkout flow is properly tested.This test correctly verifies that users without an active subscription follow the checkout flow instead of the billing portal deep-link. The test properly mocks
window.openand verifies all expected side effects.
| describe('PricingTable', () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks() | ||
| mockIsActiveSubscription.value = false | ||
| mockSubscriptionTier.value = null | ||
| mockIsYearlySubscription.value = false | ||
| vi.mocked(global.fetch).mockResolvedValue({ | ||
| ok: true, | ||
| json: async () => ({ checkout_url: 'https://checkout.stripe.com/test' }) | ||
| } as Response) | ||
| }) | ||
|
|
||
| describe('billing portal deep linking', () => { | ||
| it('should call accessBillingPortal with yearly tier suffix when billing cycle is yearly (default)', async () => { | ||
| mockIsActiveSubscription.value = true | ||
| mockSubscriptionTier.value = 'STANDARD' | ||
|
|
||
| const wrapper = createWrapper() | ||
| await flushPromises() | ||
|
|
||
| const creatorButton = wrapper | ||
| .findAll('button') | ||
| .find((btn) => btn.text().includes('Creator')) | ||
|
|
||
| expect(creatorButton).toBeDefined() | ||
| await creatorButton?.trigger('click') | ||
| await flushPromises() | ||
|
|
||
| expect(mockAccessBillingPortal).toHaveBeenCalledWith('creator-yearly') | ||
| }) | ||
|
|
||
| it('should call accessBillingPortal with different tiers correctly', async () => { | ||
| mockIsActiveSubscription.value = true | ||
| mockSubscriptionTier.value = 'STANDARD' | ||
|
|
||
| const wrapper = createWrapper() | ||
| await flushPromises() | ||
|
|
||
| const proButton = wrapper | ||
| .findAll('button') | ||
| .find((btn) => btn.text().includes('Pro')) | ||
|
|
||
| await proButton?.trigger('click') | ||
| await flushPromises() | ||
|
|
||
| expect(mockAccessBillingPortal).toHaveBeenCalledWith('pro-yearly') | ||
| }) | ||
|
|
||
| it('should not call accessBillingPortal when clicking current plan', async () => { | ||
| mockIsActiveSubscription.value = true | ||
| mockSubscriptionTier.value = 'CREATOR' | ||
|
|
||
| const wrapper = createWrapper() | ||
| await flushPromises() | ||
|
|
||
| const currentPlanButton = wrapper | ||
| .findAll('button') | ||
| .find((btn) => btn.text().includes('Current Plan')) | ||
|
|
||
| await currentPlanButton?.trigger('click') | ||
| await flushPromises() | ||
|
|
||
| expect(mockAccessBillingPortal).not.toHaveBeenCalled() | ||
| }) | ||
|
|
||
| it('should initiate checkout instead of billing portal for new subscribers', async () => { | ||
| mockIsActiveSubscription.value = false | ||
|
|
||
| const windowOpenSpy = vi | ||
| .spyOn(window, 'open') | ||
| .mockImplementation(() => null) | ||
|
|
||
| const wrapper = createWrapper() | ||
| await flushPromises() | ||
|
|
||
| const subscribeButton = wrapper | ||
| .findAll('button') | ||
| .find((btn) => btn.text().includes('Subscribe')) | ||
|
|
||
| await subscribeButton?.trigger('click') | ||
| await flushPromises() | ||
|
|
||
| expect(mockAccessBillingPortal).not.toHaveBeenCalled() | ||
| expect(global.fetch).toHaveBeenCalledWith( | ||
| expect.stringContaining('/customers/cloud-subscription-checkout/'), | ||
| expect.any(Object) | ||
| ) | ||
| expect(windowOpenSpy).toHaveBeenCalledWith( | ||
| 'https://checkout.stripe.com/test', | ||
| '_blank' | ||
| ) | ||
|
|
||
| windowOpenSpy.mockRestore() | ||
| }) | ||
|
|
||
| it('should pass correct tier for each subscription level', async () => { | ||
| mockIsActiveSubscription.value = true | ||
| mockSubscriptionTier.value = 'PRO' | ||
|
|
||
| const wrapper = createWrapper() | ||
| await flushPromises() | ||
|
|
||
| const standardButton = wrapper | ||
| .findAll('button') | ||
| .find((btn) => btn.text().includes('Standard')) | ||
|
|
||
| await standardButton?.trigger('click') | ||
| await flushPromises() | ||
|
|
||
| expect(mockAccessBillingPortal).toHaveBeenCalledWith('standard-yearly') | ||
| }) | ||
| }) | ||
| }) |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider adding error handling tests.
While the current test coverage is solid for happy paths, consider adding tests for error scenarios such as:
accessBillingPortalthrowing an errorfetchrequest failing for new subscriber checkout- Network errors during checkout initiation
These tests would verify that the reportError mock (line 15) is properly invoked during failure conditions.
Example error handling test
it('should handle billing portal errors gracefully', async () => {
mockIsActiveSubscription.value = true
mockSubscriptionTier.value = 'STANDARD'
mockAccessBillingPortal.mockRejectedValueOnce(new Error('Portal error'))
const wrapper = createWrapper()
await flushPromises()
const creatorButton = wrapper
.findAll('button')
.find((btn) => btn.text().includes('Creator'))
await creatorButton?.trigger('click')
await flushPromises()
expect(mockReportError).toHaveBeenCalled()
})| describe('billing portal deep linking', () => { | ||
| it('should call accessBillingPortal with yearly tier suffix when billing cycle is yearly (default)', async () => { | ||
| mockIsActiveSubscription.value = true | ||
| mockSubscriptionTier.value = 'STANDARD' | ||
|
|
||
| const wrapper = createWrapper() | ||
| await flushPromises() | ||
|
|
||
| const creatorButton = wrapper | ||
| .findAll('button') | ||
| .find((btn) => btn.text().includes('Creator')) | ||
|
|
||
| expect(creatorButton).toBeDefined() | ||
| await creatorButton?.trigger('click') | ||
| await flushPromises() | ||
|
|
||
| expect(mockAccessBillingPortal).toHaveBeenCalledWith('creator-yearly') | ||
| }) | ||
|
|
||
| it('should call accessBillingPortal with different tiers correctly', async () => { | ||
| mockIsActiveSubscription.value = true | ||
| mockSubscriptionTier.value = 'STANDARD' | ||
|
|
||
| const wrapper = createWrapper() | ||
| await flushPromises() | ||
|
|
||
| const proButton = wrapper | ||
| .findAll('button') | ||
| .find((btn) => btn.text().includes('Pro')) | ||
|
|
||
| await proButton?.trigger('click') | ||
| await flushPromises() | ||
|
|
||
| expect(mockAccessBillingPortal).toHaveBeenCalledWith('pro-yearly') | ||
| }) |
There was a problem hiding this comment.
Add test coverage for monthly billing cycle deep-linking.
The PR description states that billing cycle information (yearly vs monthly) is passed to the billing portal. However, all tests only verify the yearly suffix (-yearly). There are no tests verifying that monthly subscriptions pass the correct tier suffix (e.g., creator-monthly, pro-monthly).
Add tests that set mockIsYearlySubscription.value = true and verify the billing portal is called with monthly tier suffixes.
🔎 Suggested test for monthly billing cycle
+ it('should call accessBillingPortal with monthly tier suffix when billing cycle is monthly', async () => {
+ mockIsActiveSubscription.value = true
+ mockSubscriptionTier.value = 'STANDARD'
+ mockIsYearlySubscription.value = true
+
+ const wrapper = createWrapper()
+ await flushPromises()
+
+ const creatorButton = wrapper
+ .findAll('button')
+ .find((btn) => btn.text().includes('Creator'))
+
+ await creatorButton?.trigger('click')
+ await flushPromises()
+
+ expect(mockAccessBillingPortal).toHaveBeenCalledWith('creator-monthly')
+ })📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| describe('billing portal deep linking', () => { | |
| it('should call accessBillingPortal with yearly tier suffix when billing cycle is yearly (default)', async () => { | |
| mockIsActiveSubscription.value = true | |
| mockSubscriptionTier.value = 'STANDARD' | |
| const wrapper = createWrapper() | |
| await flushPromises() | |
| const creatorButton = wrapper | |
| .findAll('button') | |
| .find((btn) => btn.text().includes('Creator')) | |
| expect(creatorButton).toBeDefined() | |
| await creatorButton?.trigger('click') | |
| await flushPromises() | |
| expect(mockAccessBillingPortal).toHaveBeenCalledWith('creator-yearly') | |
| }) | |
| it('should call accessBillingPortal with different tiers correctly', async () => { | |
| mockIsActiveSubscription.value = true | |
| mockSubscriptionTier.value = 'STANDARD' | |
| const wrapper = createWrapper() | |
| await flushPromises() | |
| const proButton = wrapper | |
| .findAll('button') | |
| .find((btn) => btn.text().includes('Pro')) | |
| await proButton?.trigger('click') | |
| await flushPromises() | |
| expect(mockAccessBillingPortal).toHaveBeenCalledWith('pro-yearly') | |
| }) | |
| it('should call accessBillingPortal with monthly tier suffix when billing cycle is monthly', async () => { | |
| mockIsActiveSubscription.value = true | |
| mockSubscriptionTier.value = 'STANDARD' | |
| mockIsYearlySubscription.value = false | |
| const wrapper = createWrapper() | |
| await flushPromises() | |
| const creatorButton = wrapper | |
| .findAll('button') | |
| .find((btn) => btn.text().includes('Creator')) | |
| await creatorButton?.trigger('click') | |
| await flushPromises() | |
| expect(mockAccessBillingPortal).toHaveBeenCalledWith('creator-monthly') | |
| }) |
🤖 Prompt for AI Agents
In tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
around lines 137 to 171, add test coverage for the monthly billing deep-linking:
create two tests (one for Creator and one for Pro) that set
mockIsActiveSubscription.value = true, set mockSubscriptionTier.value
appropriately, set mockIsYearlySubscription.value = true (to simulate monthly
billing per the PR note), create the wrapper and await flushPromises(), find the
appropriate button (by text includes 'Creator' or 'Pro'), trigger click and
await flushPromises(), and assert mockAccessBillingPortal was called with
'creator-monthly' and 'pro-monthly' respectively; also ensure mocks are
reset/cleared as needed before each test to avoid cross-test interference.
) ## Summary Pass target tier to billing portal API for deep linking to Stripe's subscription update confirmation screen when user has an active subscription. ## Changes - **What**: When a user with an active subscription clicks a tier in PricingTable, pass the target tier (including billing cycle) to `accessBillingPortal` which sends it as `target_tier` in the request body. This enables the backend to create a Stripe billing portal deep link directly to the subscription update confirmation screen. - **Dependencies**: Requires comfy-api PR for `POST /customers/billing` `target_tier` support ## Review Focus - PricingTable now differentiates between new subscriptions (checkout flow) and existing subscriptions (billing portal with deep link) - Type derivation uses `Parameters<typeof authStore.accessBillingPortal>[0]` to avoid duplicating the tier union (matches codebase pattern) - Registry types manually updated to include `target_tier` field (will be regenerated when API is deployed) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7692-feat-pass-target-tier-to-billing-portal-for-subscription-updates-2d06d73d365081b38fe4c81e95dce58c) by [Unito](https://www.unito.io) --------- Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: GitHub Action <action@github.com>
…bscription updates (#7726) Backport of #7692 to `cloud/1.35` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7726-backport-cloud-1-35-feat-pass-target-tier-to-billing-portal-for-subscription-updates-2d16d73d36508173acadf20aa6d97017) by [Unito](https://www.unito.io) Co-authored-by: Hunter <huntcsg@users.noreply.github.com> Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: GitHub Action <action@github.com>
## Summary Fix: PricingTable showed "Current Plan" on the wrong billing cycle (e.g., showing it on Yearly when subscribed to Monthly) because we weren't checking subscription_duration. Now we check for ANNUAL | MONTHLY match. Fix: Subscribed users were being sent to billing portal instead of checkout. Now routes to checkout. Improved: Types now use openapi.yml as source of truth. Tier names in user popover and subscription panels now reflect the billing cycle (YEARLY/MONTHLY). Recommended to merge this before #7692 --------- Co-authored-by: bymyself <cbyrne@comfy.org>
) ## Summary Pass target tier to billing portal API for deep linking to Stripe's subscription update confirmation screen when user has an active subscription. ## Changes - **What**: When a user with an active subscription clicks a tier in PricingTable, pass the target tier (including billing cycle) to `accessBillingPortal` which sends it as `target_tier` in the request body. This enables the backend to create a Stripe billing portal deep link directly to the subscription update confirmation screen. - **Dependencies**: Requires comfy-api PR for `POST /customers/billing` `target_tier` support ## Review Focus - PricingTable now differentiates between new subscriptions (checkout flow) and existing subscriptions (billing portal with deep link) - Type derivation uses `Parameters<typeof authStore.accessBillingPortal>[0]` to avoid duplicating the tier union (matches codebase pattern) - Registry types manually updated to include `target_tier` field (will be regenerated when API is deployed) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7692-feat-pass-target-tier-to-billing-portal-for-subscription-updates-2d06d73d365081b38fe4c81e95dce58c) by [Unito](https://www.unito.io) --------- Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: GitHub Action <action@github.com>
Summary
Pass target tier to billing portal API for deep linking to Stripe's subscription update confirmation screen when user has an active subscription.
Changes
accessBillingPortalwhich sends it astarget_tierin the request body. This enables the backend to create a Stripe billing portal deep link directly to the subscription update confirmation screen.POST /customers/billingtarget_tiersupportReview Focus
Parameters<typeof authStore.accessBillingPortal>[0]to avoid duplicating the tier union (matches codebase pattern)target_tierfield (will be regenerated when API is deployed)┆Issue is synchronized with this Notion page by Unito