refactor: move billing frontend to billing repo#3577
Conversation
|
Important Review skippedToo many files! This PR contains 177 files, which is 27 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (177)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
a160cbd to
f888cea
Compare
|
This PR is stale because it has been open for 30 days with no activity. |
501a47a to
1872883
Compare
Move all billing frontend code from webapp/src/ee/billing/ to the billing repo's frontend/ directory. Platform now references billing code via path aliases and Vite config, mirroring the backend pattern. Key changes: - Add tsconfig.vite.json for Vite-only path resolution (no npm paths) - Update vite.config.ts with conditional billing aliases and fs.allow - Refactor eeModule.ee.tsx to use billingModule entry point - Move billingApiSchema.generated.ts to billing repo - Update dataCy.plugin to generate separate billing dataCyType.d.ts - Update eslint script to cover billing frontend code Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This test uses billing-specific data-cy values and belongs in billing e2e. Also updates billingApiSchema stub with permissive types and commits dataCyType.d.ts without billing values (CI-compatible).
Move translation of billing admin menu labels from eeModule to billingModule.useAdministrationMenuItems() hook so translation keys are extractable from the billing repo.
The committed version must match what CI generates (without billing). Billing e2e regenerates it before typecheck.
Platform's generate-data-cy.mjs and Vite plugin only scan src/ — no billing dependency. Billing e2e has its own generate script that combines platform + billing values before typechecking.
Switch can't see through Fragment children in React Router v5. Since routes.Administration is rendered outside a Switch by its consumer, Fragment works correctly.
Restores shared billing UI components (Plan, ActiveSubscription), billingApiSchema stub, tsconfig fallback paths, and tg.billing alias that were lost during rebase on main. Also updates dataCyType.d.ts.
Billing code from outside webapp/ gets duplicate package instances in production builds. Adding react-router-dom, formik, react-query, yup, clsx to resolve.dedupe ensures single instances. Also uses separate Switch blocks for platform and billing admin routes.
Change dataCyType.d.ts format from union type to interface-based pattern (DataCy.Values). TypeScript merges interface declarations across files, so each repo generates only its own values and they combine automatically. No more regeneration conflicts.
…s test Move limitPopover/, CriticalUsageCircle, TrialChip, TrialAnnouncement, BillingProgress, and other UI components that are only consumed by platform back to ee/billing/. Extract getHighlightColor to shared planUtils.ts. Move selfHostedLimits.cy.ts back to platform e2e.
GlobalLimitPopover, CriticalUsageCircle, TrialAnnouncement, TrialChip are platform components — import them directly instead of routing through billingModule.
PR #3525 added carry-over billing frontend files to the platform after the split-billing-frontend branch was created, so they were carried through the rebase. Billing frontend lives in the billing repo now — remove them and regenerate the e2e dataCyType.d.ts accordingly.
Point the tg.billing / tg.ee.module/billing path aliases and the Vite billing alias at billing/frontend/src/ after the billing frontend source directory was renamed from billing/ to src/.
extractDataCy() now also scans billing/frontend/src and writes the billing repo's e2e dataCyType.d.ts when the billing frontend is present, so running or building the webapp keeps both the platform and billing e2e dataCy types in sync — the same way the platform one already works.
Regenerate dataCyType.d.ts to pick up data-cy attributes added/removed on main since the last rebase (TM management work added one, ICU import toggle UI removal dropped one).
1872883 to
a260de5
Compare
Added by the move-billing-frontend commit but never referenced — no npm script, vite config, or CI step uses it. The main tsc covers webapp/src (excluding eeSetup), and tsc:prod covers everything including eeSetup. The file was also incomplete as a standalone tsconfig (missing custom.d.ts / figmaTheme.ts includes, so running it directly floods unrelated Palette augmentation errors).
Mirror the pattern used by the eslint script: when the billing repo is present alongside the platform, also run tsc on its frontend so a single 'npm run tsc' from webapp/ type-checks both. Without this, billing-only type errors were silently missed (tsconfig.json excludes src/eeSetup, so the import chain into tg.billing/* was never followed).
Summary
webapp/src/ee/billing/to thebillingrepo'sfrontend/directorybillingModule.tsxentry point so new billing features don't require platform changestsconfig.vite.json(for Vite, no npm package paths) andtsconfig.extend.json(for tsc)Depends on
Test plan
npm run tscpassesnpm run eslintpassesnpm run buildproduces valid bundle