Skip to content

feat: pass target tier to billing portal for subscription updates#7692

Merged
christian-byrne merged 8 commits intomainfrom
stripe-checkout-flow-link-improvement
Dec 22, 2025
Merged

feat: pass target tier to billing portal for subscription updates#7692
christian-byrne merged 8 commits intomainfrom
stripe-checkout-flow-link-improvement

Conversation

@huntcsg
Copy link
Contributor

@huntcsg huntcsg commented Dec 21, 2025

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 by Unito

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.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 21, 2025

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Registry & Types
packages/registry-types/src/comfyRegistryTypes.ts
Added target_tier options to the AccessBillingPortal request schema.
Auth store & types
src/stores/firebaseAuthStore.ts
Exported BillingPortalTargetTier type; changed accessBillingPortal to accept targetTier? and conditionally POST { target_tier } to /customers/billing.
Composable actions
src/composables/auth/useFirebaseAuthActions.ts
Added accessBillingPortal(targetTier?: BillingPortalTargetTier) wrapper that forwards the tier to the auth store; updated returned actions to include it.
Pricing UI
src/platform/cloud/subscription/components/PricingTable.vue
When user has an active subscription, computes checkoutTier and calls accessBillingPortal(checkoutTier) (deep link) instead of initiating new checkout; imported/destructured new action.
Tests
tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts, tests-ui/tests/store/firebaseAuthStore.test.ts
Added/updated tests verifying billing portal POST includes target_tier when provided, deep-link behavior for active subscriptions, and unchanged checkout flow for new subscribers.

Sequence Diagram

sequenceDiagram
    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
Loading

Possibly related PRs

  • Comfy-Org/ComfyUI_frontend PR 7359: Modifies PricingTable and billing-portal checkout path; likely overlaps with this PR's billing-portal deep-link changes.
  • Comfy-Org/ComfyUI_frontend PR 7701: Alters billing portal vs checkout invocation in the same files; directly related and potentially conflicting.
  • Comfy-Org/ComfyUI_frontend PR 7572: Introduces yearly-tier naming and tier-handling logic used when computing target_tier values.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch stripe-checkout-flow-link-improvement

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Dec 21, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 12/22/2025, 06:32:39 PM UTC

🔗 Links


🎉 Your Storybook is ready for review!

@github-actions
Copy link

github-actions bot commented Dec 21, 2025

🎭 Playwright Test Results

All tests passed!

⏰ Completed at: 12/22/2025, 06:42:14 PM UTC

📈 Summary

  • Total Tests: 511
  • Passed: 503 ✅
  • Failed: 0
  • Flaky: 0
  • Skipped: 8 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 491 / ❌ 0 / ⚠️ 0 / ⏭️ 8
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 9 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@github-actions
Copy link

github-actions bot commented Dec 21, 2025

Bundle Size Report

Summary

  • Raw size: 17.2 MB baseline 17.2 MB — 🔴 +115 B
  • Gzip: 3.52 MB baseline 3.52 MB — 🔴 +18 B
  • Brotli: 2.69 MB baseline 2.69 MB — 🟢 -19 B
  • Bundles: 98 current • 98 baseline • 42 added / 42 removed

Category Glance
App Entry Points 🔴 +94 B (3.19 MB) · Other 🔴 +21 B (3.44 MB) · Vendor & Third-Party ⚪ 0 B (9.1 MB) · Graph Workspace ⚪ 0 B (996 kB) · Panels & Settings ⚪ 0 B (295 kB) · UI Components ⚪ 0 B (186 kB) · + 3 more

Per-category breakdown
App Entry Points — 3.19 MB (baseline 3.19 MB) • 🔴 +94 B

Main entry bundles and manifests

File Before After Δ Raw Δ Gzip Δ Brotli
assets/index-BH0EmCIc.js (new) 2.99 MB 🔴 +2.99 MB 🔴 +631 kB 🔴 +480 kB
assets/index-LJm200v8.js (removed) 2.99 MB 🟢 -2.99 MB 🟢 -631 kB 🟢 -480 kB
assets/index-bLV1uA0S.js (new) 192 kB 🔴 +192 kB 🔴 +41.8 kB 🔴 +34.8 kB
assets/index-DwovRClm.js (removed) 192 kB 🟢 -192 kB 🟢 -41.8 kB 🟢 -34.8 kB
assets/index-DcggQyOn.js (removed) 345 B 🟢 -345 B 🟢 -245 B 🟢 -234 B
assets/index-LWr-77yg.js (new) 345 B 🔴 +345 B 🔴 +245 B 🔴 +238 B

Status: 3 added / 3 removed

Graph Workspace — 996 kB (baseline 996 kB) • ⚪ 0 B

Graph editor runtime, canvas, workflow orchestration

File Before After Δ Raw Δ Gzip Δ Brotli
assets/GraphView-BCyv7x4N.js (removed) 996 kB 🟢 -996 kB 🟢 -194 kB 🟢 -148 kB
assets/GraphView-CxM2QLjP.js (new) 996 kB 🔴 +996 kB 🔴 +194 kB 🔴 +148 kB

Status: 1 added / 1 removed

Views & Navigation — 6.54 kB (baseline 6.54 kB) • ⚪ 0 B

Top-level views, pages, and routed surfaces

File Before After Δ Raw Δ Gzip Δ Brotli
assets/UserSelectView-D_zb-5OE.js (new) 6.54 kB 🔴 +6.54 kB 🔴 +2.14 kB 🔴 +1.89 kB
assets/UserSelectView-DpAl4SBo.js (removed) 6.54 kB 🟢 -6.54 kB 🟢 -2.14 kB 🟢 -1.9 kB

Status: 1 added / 1 removed

Panels & Settings — 295 kB (baseline 295 kB) • ⚪ 0 B

Configuration panels, inspectors, and settings screens

File Before After Δ Raw Δ Gzip Δ Brotli
assets/LegacyCreditsPanel-BQbugVR2.js (new) 21.4 kB 🔴 +21.4 kB 🔴 +5.16 kB 🔴 +4.51 kB
assets/LegacyCreditsPanel-DSMxgX_h.js (removed) 21.4 kB 🟢 -21.4 kB 🟢 -5.16 kB 🟢 -4.51 kB
assets/KeybindingPanel-DnTHYoTh.js (new) 13.6 kB 🔴 +13.6 kB 🔴 +3.42 kB 🔴 +3.03 kB
assets/KeybindingPanel-DSP4hMw1.js (removed) 13.6 kB 🟢 -13.6 kB 🟢 -3.42 kB 🟢 -3.01 kB
assets/ExtensionPanel-C8HffMwj.js (new) 10.8 kB 🔴 +10.8 kB 🔴 +2.57 kB 🔴 +2.25 kB
assets/ExtensionPanel-lEF42Iwv.js (removed) 10.8 kB 🟢 -10.8 kB 🟢 -2.57 kB 🟢 -2.24 kB
assets/AboutPanel-BjYQVhbA.js (new) 9.16 kB 🔴 +9.16 kB 🔴 +2.46 kB 🔴 +2.21 kB
assets/AboutPanel-D1xHzM9u.js (removed) 9.16 kB 🟢 -9.16 kB 🟢 -2.46 kB 🟢 -2.21 kB
assets/ServerConfigPanel-DqafZkdF.js (new) 7.07 kB 🔴 +7.07 kB 🔴 +1.98 kB 🔴 +1.76 kB
assets/ServerConfigPanel-eHN6wy3G.js (removed) 7.07 kB 🟢 -7.07 kB 🟢 -1.98 kB 🟢 -1.76 kB
assets/UserPanel-BbH2mLA3.js (removed) 6.23 kB 🟢 -6.23 kB 🟢 -1.72 kB 🟢 -1.5 kB
assets/UserPanel-hGle0e7t.js (new) 6.23 kB 🔴 +6.23 kB 🔴 +1.72 kB 🔴 +1.5 kB
assets/settings-BhbWhsRg.js 101 B 101 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-BIdKi-OT.js 26.2 kB 26.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-Bu3OR-lX.js 24.6 kB 24.6 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-ByL6gy5c.js 25.4 kB 25.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-CA43q0kf.js 20.7 kB 20.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-CjlRFMdL.js 32.8 kB 32.8 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-DkGwvylK.js 26.9 kB 26.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-Dyd027Dx.js 24.7 kB 24.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-wwBxqLH5.js 21.3 kB 21.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-xx2Yb6R2.js 23.8 kB 23.8 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 6 added / 6 removed

UI Components — 186 kB (baseline 186 kB) • ⚪ 0 B

Reusable component library chunks

File Before After Δ Raw Δ Gzip Δ Brotli
assets/Load3D.vue_vue_type_script_setup_true_lang-3eVDNZa6.js (removed) 54.3 kB 🟢 -54.3 kB 🟢 -8.62 kB 🟢 -7.41 kB
assets/Load3D.vue_vue_type_script_setup_true_lang-DJ6M-Doo.js (new) 54.3 kB 🔴 +54.3 kB 🔴 +8.62 kB 🔴 +7.41 kB
assets/LazyImage.vue_vue_type_script_setup_true_lang-CrwvwnhJ.js (new) 50 kB 🔴 +50 kB 🔴 +11 kB 🔴 +9.63 kB
assets/LazyImage.vue_vue_type_script_setup_true_lang-ZCS-ztpJ.js (removed) 50 kB 🟢 -50 kB 🟢 -11 kB 🟢 -9.64 kB
assets/WidgetSelect.vue_vue_type_script_setup_true_lang-DWpm3Dut.js (removed) 48.8 kB 🟢 -48.8 kB 🟢 -10.5 kB 🟢 -9.13 kB
assets/WidgetSelect.vue_vue_type_script_setup_true_lang-NtDH_MVh.js (new) 48.8 kB 🔴 +48.8 kB 🔴 +10.5 kB 🔴 +9.13 kB
assets/WidgetInputNumber.vue_vue_type_script_setup_true_lang-BbB95Nbe.js (new) 14.3 kB 🔴 +14.3 kB 🔴 +3.73 kB 🔴 +3.29 kB
assets/WidgetInputNumber.vue_vue_type_script_setup_true_lang-CBWypzxB.js (removed) 14.3 kB 🟢 -14.3 kB 🟢 -3.74 kB 🟢 -3.3 kB
assets/ComfyQueueButton-BV1xgV8V.js (removed) 8.45 kB 🟢 -8.45 kB 🟢 -2.47 kB 🟢 -2.19 kB
assets/ComfyQueueButton-DFBcUfjA.js (new) 8.45 kB 🔴 +8.45 kB 🔴 +2.47 kB 🔴 +2.2 kB
assets/WidgetWithControl.vue_vue_type_script_setup_true_lang--uxY2-bz.js (removed) 3.68 kB 🟢 -3.68 kB 🟢 -1.45 kB 🟢 -1.31 kB
assets/WidgetWithControl.vue_vue_type_script_setup_true_lang-Ctxppcet.js (new) 3.68 kB 🔴 +3.68 kB 🔴 +1.45 kB 🔴 +1.31 kB
assets/WidgetLayoutField.vue_vue_type_script_setup_true_lang-_xR9pSMQ.js (new) 2.14 kB 🔴 +2.14 kB 🔴 +890 B 🔴 +768 B
assets/WidgetLayoutField.vue_vue_type_script_setup_true_lang-Bor3Iy4y.js (removed) 2.14 kB 🟢 -2.14 kB 🟢 -889 B 🟢 -773 B
assets/MediaTitle.vue_vue_type_script_setup_true_lang-BjmFCQ-M.js (removed) 897 B 🟢 -897 B 🟢 -503 B 🟢 -434 B
assets/MediaTitle.vue_vue_type_script_setup_true_lang-DVxckpSE.js (new) 897 B 🔴 +897 B 🔴 +502 B 🔴 +430 B
assets/UserAvatar.vue_vue_type_script_setup_true_lang-DymEwRe0.js 1.34 kB 1.34 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/WidgetButton-U5ly29Pt.js 2.04 kB 2.04 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 8 added / 8 removed

Data & Services — 12.5 kB (baseline 12.5 kB) • ⚪ 0 B

Stores, services, APIs, and repositories

File Before After Δ Raw Δ Gzip Δ Brotli
assets/keybindingService-BOdAb25Y.js (new) 7.51 kB 🔴 +7.51 kB 🔴 +1.83 kB 🔴 +1.58 kB
assets/keybindingService-BV1Aj-vv.js (removed) 7.51 kB 🟢 -7.51 kB 🟢 -1.83 kB 🟢 -1.57 kB
assets/audioService-_N430mmI.js (new) 2.2 kB 🔴 +2.2 kB 🔴 +963 B 🔴 +826 B
assets/audioService-BVCmQ0v9.js (removed) 2.2 kB 🟢 -2.2 kB 🟢 -962 B 🟢 -829 B
assets/serverConfigStore-7JI8VFS2.js 2.83 kB 2.83 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 2 added / 2 removed

Utilities & Hooks — 1.41 kB (baseline 1.41 kB) • ⚪ 0 B

Helpers, composables, and utility bundles

File Before After Δ Raw Δ Gzip Δ Brotli
assets/audioUtils-C_cYTg8G.js (removed) 1.41 kB 🟢 -1.41 kB 🟢 -651 B 🟢 -548 B
assets/audioUtils-CFDh6Bcj.js (new) 1.41 kB 🔴 +1.41 kB 🔴 +651 B 🔴 +542 B

Status: 1 added / 1 removed

Vendor & Third-Party — 9.1 MB (baseline 9.1 MB) • ⚪ 0 B

External libraries and shared vendor chunks

File Before After Δ Raw Δ Gzip Δ Brotli
assets/vendor-chart-DaR9dw3X.js 452 kB 452 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-other-Cf7iqkoX.js 3.86 MB 3.86 MB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-primevue-BIgr9yoj.js 1.96 MB 1.96 MB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-three-DYL0ZbEr.js 2.02 MB 2.02 MB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-tiptap-C1NB2Q_L.js 232 kB 232 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-vue-DSfeuQOV.js 160 kB 160 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-xterm-BF8peZ5_.js 420 kB 420 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
Other — 3.44 MB (baseline 3.44 MB) • 🔴 +21 B

Bundles that do not match a named category

File Before After Δ Raw Δ Gzip Δ Brotli
assets/SubscriptionRequiredDialogContent-DanjmUV-.js (new) 28 kB 🔴 +28 kB 🔴 +6.28 kB 🔴 +5.44 kB
assets/SubscriptionRequiredDialogContent-CtnoJQ3x.js (removed) 28 kB 🟢 -28 kB 🟢 -6.27 kB 🟢 -5.43 kB
assets/WidgetRecordAudio-6cAsLI98.js (removed) 20.4 kB 🟢 -20.4 kB 🟢 -5.23 kB 🟢 -4.63 kB
assets/WidgetRecordAudio-DsuSClas.js (new) 20.4 kB 🔴 +20.4 kB 🔴 +5.23 kB 🔴 +4.63 kB
assets/AudioPreviewPlayer-BuF6aa_K.js (new) 13.3 kB 🔴 +13.3 kB 🔴 +3.35 kB 🔴 +3 kB
assets/AudioPreviewPlayer-Cb7-EME7.js (removed) 13.3 kB 🟢 -13.3 kB 🟢 -3.35 kB 🟢 -2.99 kB
assets/ValueControlPopover-CnK9wJEW.js (removed) 5.49 kB 🟢 -5.49 kB 🟢 -1.71 kB 🟢 -1.52 kB
assets/ValueControlPopover-DCj2BbHc.js (new) 5.49 kB 🔴 +5.49 kB 🔴 +1.71 kB 🔴 +1.52 kB
assets/WidgetGalleria-D45OuIwp.js (removed) 4.1 kB 🟢 -4.1 kB 🟢 -1.45 kB 🟢 -1.3 kB
assets/WidgetGalleria-uM6VfLhF.js (new) 4.1 kB 🔴 +4.1 kB 🔴 +1.45 kB 🔴 +1.31 kB
assets/WidgetColorPicker-C-dC6Z1S.js (removed) 3.41 kB 🟢 -3.41 kB 🟢 -1.38 kB 🟢 -1.23 kB
assets/WidgetColorPicker-C0fY9_Yd.js (new) 3.41 kB 🔴 +3.41 kB 🔴 +1.38 kB 🔴 +1.23 kB
assets/WidgetTextarea-BDMUPNxu.js (removed) 3.08 kB 🟢 -3.08 kB 🟢 -1.22 kB 🟢 -1.08 kB
assets/WidgetTextarea-CYpBrxfX.js (new) 3.08 kB 🔴 +3.08 kB 🔴 +1.21 kB 🔴 +1.08 kB
assets/WidgetMarkdown-DfP1XkV-.js (new) 3.08 kB 🔴 +3.08 kB 🔴 +1.28 kB 🔴 +1.12 kB
assets/WidgetMarkdown-W_9PYStb.js (removed) 3.08 kB 🟢 -3.08 kB 🟢 -1.28 kB 🟢 -1.13 kB
assets/WidgetAudioUI-Co0LRICU.js (new) 2.89 kB 🔴 +2.89 kB 🔴 +1.16 kB 🔴 +1.06 kB
assets/WidgetAudioUI-D3wVlEs3.js (removed) 2.89 kB 🟢 -2.89 kB 🟢 -1.17 kB 🟢 -1.06 kB
assets/WidgetInputText-BV5LqIWN.js (new) 1.99 kB 🔴 +1.99 kB 🔴 +920 B 🔴 +853 B
assets/WidgetInputText-DAHDDL23.js (removed) 1.99 kB 🟢 -1.99 kB 🟢 -921 B 🟢 -855 B
assets/WidgetToggleSwitch-BK4Khs_8.js (removed) 1.76 kB 🟢 -1.76 kB 🟢 -835 B 🟢 -726 B
assets/WidgetToggleSwitch-C4JI3Gaz.js (new) 1.76 kB 🔴 +1.76 kB 🔴 +836 B 🔴 +726 B
assets/MediaImageBottom-BHkGPA36.js (new) 1.55 kB 🔴 +1.55 kB 🔴 +732 B 🔴 +641 B
assets/MediaImageBottom-r7stHvuP.js (removed) 1.55 kB 🟢 -1.55 kB 🟢 -735 B 🟢 -640 B
assets/MediaAudioBottom-DcOi42jF.js (new) 1.51 kB 🔴 +1.51 kB 🔴 +732 B 🔴 +644 B
assets/MediaAudioBottom-DDnKxtQt.js (removed) 1.51 kB 🟢 -1.51 kB 🟢 -735 B 🟢 -645 B
assets/Media3DBottom-CfSV0F1m.js (removed) 1.5 kB 🟢 -1.5 kB 🟢 -731 B 🟢 -644 B
assets/Media3DBottom-Dfp3NRsF.js (new) 1.5 kB 🔴 +1.5 kB 🔴 +730 B 🔴 +645 B
assets/MediaVideoBottom-BcMtF0YC.js (new) 1.5 kB 🔴 +1.5 kB 🔴 +733 B 🔴 +644 B
assets/MediaVideoBottom-QXSmi7Ud.js (removed) 1.5 kB 🟢 -1.5 kB 🟢 -730 B 🟢 -642 B
assets/Media3DTop-BLlJNBY7.js (new) 1.49 kB 🔴 +1.49 kB 🔴 +769 B 🔴 +653 B
assets/Media3DTop-Pz_Q5Xds.js (removed) 1.49 kB 🟢 -1.49 kB 🟢 -768 B 🟢 -655 B
assets/WidgetSelect-CIim_L3u.js (removed) 733 B 🟢 -733 B 🟢 -360 B 🟢 -319 B
assets/WidgetSelect-qSxim8yF.js (new) 733 B 🔴 +733 B 🔴 +361 B 🔴 +325 B
assets/WidgetInputNumber-B33gWPaQ.js (removed) 673 B 🟢 -673 B 🟢 -349 B 🟢 -291 B
assets/WidgetInputNumber-DOhkq9T8.js (new) 673 B 🔴 +673 B 🔴 +348 B 🔴 +289 B
assets/Load3D-CubGGB3A.js (new) 424 B 🔴 +424 B 🔴 +269 B 🔴 +223 B
assets/Load3D-zr9pa_La.js (removed) 424 B 🟢 -424 B 🟢 -267 B 🟢 -223 B
assets/WidgetLegacy-Cx44NKVP.js (removed) 364 B 🟢 -364 B 🟢 -239 B 🟢 -197 B
assets/WidgetLegacy-kGSau5zo.js (new) 364 B 🔴 +364 B 🔴 +238 B 🔴 +196 B
assets/commands-BWp4HdfU.js 101 B 101 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-CcfGaui5.js 14.4 kB 14.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-CisfgZf5.js 13.7 kB 13.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-CkU12Foh.js 13 kB 13 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-CoH2DJa6.js 14.2 kB 14.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-COSt-Bjx.js 14.9 kB 14.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-DalfIW5f.js 15.9 kB 15.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-DfTl0eCm.js 13.5 kB 13.5 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-DwSJL865.js 13.7 kB 13.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-Zxyx15Vd.js 12.8 kB 12.8 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-Bdc58rJq.js 97.1 kB 97.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-C9ZJBRdI.js 81.5 kB 81.5 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-CAL83XT3.js 84.6 kB 84.6 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-CHLLfvpG.js 82.4 kB 82.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-CJOg9JF6.js 70.3 kB 70.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-Cw9RZWRY.js 89 B 89 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-DDqR5EuX.js 71.3 kB 71.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-DLHyaEcz.js 92.1 kB 92.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-O7KfJeMO.js 79.9 kB 79.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-OzGsrlqJ.js 112 kB 112 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/MediaAudioTop-Dr0afgCA.js 1.46 kB 1.46 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/MediaImageTop-BXa-oKEc.js 1.75 kB 1.75 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/MediaVideoTop-BVdg2b8C.js 2.65 kB 2.65 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-1Vh3MCrN.js 240 kB 240 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-aW9En70v.js 260 kB 260 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-BIckSVgU.js 273 kB 273 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-BiYpVi7D.js 263 kB 263 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-Bw_Jitw_.js 101 B 101 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-CCEXtYfM.js 243 kB 243 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-CvmVDWYd.js 323 kB 323 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-D_wreoPJ.js 267 kB 267 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-Dz-0ZIBN.js 297 kB 297 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-VZsNmhG7.js 264 kB 264 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/WidgetChart-BU__hen8.js 2.48 kB 2.48 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/WidgetImageCompare-0zJeINY-.js 2.21 kB 2.21 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/widgetPropFilter-BIbGSUAt.js 1.28 kB 1.28 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

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
christian-byrne added a commit that referenced this pull request Dec 22, 2025
## 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>
github-actions bot pushed a commit that referenced this pull request Dec 22, 2025
## 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>
Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, should be good after backend is deployed.

Comment on lines 105 to 108
const accessBillingPortal = wrapWithErrorHandlingAsync(
async (
targetTier?: Parameters<typeof authStore.accessBillingPortal>[0]
) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@christian-byrne christian-byrne marked this pull request as ready for review December 22, 2025 18:12
@christian-byrne christian-byrne requested a review from a team as a code owner December 22, 2025 18:12
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 22, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 959c199 and 245c804.

📒 Files selected for processing (6)
  • packages/registry-types/src/comfyRegistryTypes.ts
  • src/composables/auth/useFirebaseAuthActions.ts
  • src/platform/cloud/subscription/components/PricingTable.vue
  • src/stores/firebaseAuthStore.ts
  • tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
  • tests-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 use any type or as any type 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.ts
  • src/stores/firebaseAuthStore.ts
  • tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
  • tests-ui/tests/store/firebaseAuthStore.test.ts
  • src/platform/cloud/subscription/components/PricingTable.vue
  • src/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.ts
  • src/stores/firebaseAuthStore.ts
  • tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
  • tests-ui/tests/store/firebaseAuthStore.test.ts
  • src/platform/cloud/subscription/components/PricingTable.vue
  • src/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.ts
  • src/stores/firebaseAuthStore.ts
  • tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
  • tests-ui/tests/store/firebaseAuthStore.test.ts
  • src/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.ts
  • src/platform/cloud/subscription/components/PricingTable.vue
  • src/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.ts
  • src/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.ts
  • src/platform/cloud/subscription/components/PricingTable.vue
  • src/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.ts
  • src/platform/cloud/subscription/components/PricingTable.vue
  • src/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.ts
  • tests-ui/tests/store/firebaseAuthStore.test.ts
**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.test.ts: Use unit/component tests in tests-ui/ or src/**/*.test.ts with 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
  • tests-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.vue
  • src/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.vue
  • src/composables/auth/useFirebaseAuthActions.ts
**/*.vue

📄 CodeRabbit inference engine (AGENTS.md)

**/*.vue: Use Vue 3.5+ with TypeScript in .vue files, 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 use withDefaults or runtime props declaration
Prefer computed() over ref with watch when deriving values
Prefer useModel over separately defining prop and emit for two-way binding
Use vue-i18n in composition API for string literals; place new translation entries in src/locales/en/main.json
Use cn() utility function from @/utils/tailwindUtil for merging Tailwind class names; do not use :class="[]" syntax
Do not use the dark: Tailwind variant; use semantic values from the style.css theme instead (e.g., bg-node-component-surface)
Do not use !important or the ! important prefix for Tailwind classes; find and correct interfering !important classes 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}: Use api.apiURL() for backend endpoints instead of constructing URLs directly
Use api.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.ts
  • src/stores/firebaseAuthStore.ts
  • tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
  • tests-ui/tests/store/firebaseAuthStore.test.ts
  • src/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.ts
  • src/stores/firebaseAuthStore.ts
  • tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
  • tests-ui/tests/store/firebaseAuthStore.test.ts
  • src/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.ts
  • src/stores/firebaseAuthStore.ts
  • tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
  • tests-ui/tests/store/firebaseAuthStore.test.ts
  • src/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.ts
  • src/stores/firebaseAuthStore.ts
  • tests-ui/tests/platform/cloud/subscription/components/PricingTable.test.ts
  • tests-ui/tests/store/firebaseAuthStore.test.ts
  • src/platform/cloud/subscription/components/PricingTable.vue
  • src/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.ts
  • tests-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.ts
  • tests-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.ts
  • tests-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 NonNullable correctly 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 targetTier parameter 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 targetTier is provided
  • Request body structure when targetTier is 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], void make the wrapper's signature clear and maintainable. The targetTier parameter is correctly forwarded to the store method while preserving existing error handling.

@christian-byrne
Copy link
Contributor

Oops, made a mistake while fixing conflict in GitHub UI, fixing now.

christian-byrne and others added 3 commits December 22, 2025 10:21
The accessBillingPortal import was accidentally removed during merge conflict resolution but is still used in handleSubscribe function.
@github-actions
Copy link

🔧 Auto-fixes Applied

This PR has been automatically updated to fix linting and formatting issues.

⚠️ Important: Your local branch is now behind. Run git pull before making additional changes to avoid conflicts.

Changes made:

  • ESLint auto-fixes
  • Prettier formatting

The test was failing because isYearlySubscription was missing from the useSubscription mock, causing undefined access errors.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 432657b and f0296f4.

📒 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 use any type or as any type 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 in tests-ui/ or src/**/*.test.ts with 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 isYearlySubscription in the useSubscription mock (line 24) addresses the test failure mentioned in the commit message. All mocks are contained and reset in beforeEach.


66-123: LGTM! Test fixture setup is thorough.

The i18n configuration and component stubs provide appropriate test fixtures. The createWrapper helper 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.open and verifies all expected side effects.

Comment on lines +125 to +237
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')
})
})
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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:

  • accessBillingPortal throwing an error
  • fetch request 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()
})

Comment on lines +137 to +171
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')
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

Suggested change
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.

@christian-byrne christian-byrne added needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch and removed preview labels Dec 22, 2025
@christian-byrne christian-byrne merged commit 176c8e1 into main Dec 22, 2025
27 checks passed
@christian-byrne christian-byrne deleted the stripe-checkout-flow-link-improvement branch December 22, 2025 18:43
github-actions bot pushed a commit that referenced this pull request Dec 22, 2025
)

## 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>
@comfy-pr-bot
Copy link
Member

@huntcsg Successfully backported to #7726

@github-actions github-actions bot removed the needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch label Dec 22, 2025
christian-byrne added a commit that referenced this pull request Dec 22, 2025
…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>
Yourz pushed a commit that referenced this pull request Dec 24, 2025
## 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>
Yourz pushed a commit that referenced this pull request Dec 24, 2025
)

## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants