Skip to content

chore: remove deprecated coupons/codes feature and all ecommerce calls - #87

Draft
macdiesel wants to merge 5 commits into
masterfrom
bbeggs/ent-coupons-ecommerce-removal
Draft

chore: remove deprecated coupons/codes feature and all ecommerce calls#87
macdiesel wants to merge 5 commits into
masterfrom
bbeggs/ent-coupons-ecommerce-removal

Conversation

@macdiesel

Copy link
Copy Markdown
Member

Summary

Removes the deprecated "codes" / "coupon codes" / "coupons" feature from the admin portal frontend and eliminates all calls to the ecommerce backend (EcommerceApiService).

What was removed

Components/Containers (deleted entirely):

  • src/components/CodeAssignmentModal/
  • src/components/CodeManagement/
  • src/components/CodeModal/
  • src/components/CodeReminderModal/
  • src/components/CodeRevokeModal/
  • src/components/CodeSearchResults/
  • src/components/Coupon/
  • src/components/CouponDetails/
  • src/components/RequestCodesPage/
  • src/components/CodeDeprecationAlert/
  • src/components/EmailTemplateForm/
  • src/components/TemplateSourceFields/
  • src/containers/CodeAssignmentModal/
  • src/containers/CodeReminderModal/
  • src/containers/CodeRevokeModal/
  • src/containers/CouponDetails/
  • src/containers/SaveTemplateButton/
  • src/containers/TemplateSourceFields/

Services:

  • src/data/services/EcommerceApiService.js — all ecommerce API calls removed

Redux slices:

  • src/data/actions/coupons.js
  • src/data/actions/codeAssignment.js
  • src/data/actions/codeReminder.js
  • src/data/actions/codeRevoke.js
  • src/data/actions/emailTemplate.js
  • src/data/reducers/coupons.js
  • src/data/reducers/emailTemplate.js
  • src/data/constants/emailTemplate.js

Hooks:

  • useEnterpriseOffer hook and its test
  • useCoupons hook from EnterpriseSubsidiesContext
  • useApplicableCoupons from subsidy-request-modals
  • useSubsidySummaryAnalyticsApi no longer fetches for ecommerce budget type

Other:

  • NoAvailableCodesBanner component
  • ApproveCouponCodeRequestModal component
  • BUDGET_TYPES.ecommerce constant
  • ROUTE_NAMES.codeManagement constant
  • SUBSIDY_TYPES.coupon and SUPPORTED_SUBSIDY_TYPES.coupon constants

Eliminates all calls to the ecommerce backend from this frontend.

Behavior Changes

  • Routes removed: /admin/coupons/* and /admin/coupons/request-codes no longer exist
  • Sidebar: "Code Management" menu entry removed
  • Context values no longer provided: coupons is no longer in EnterpriseSubsidiesContext
  • Budget IDs: useBudgetId now always treats the budgetId as a subsidyAccessPolicyId (UUID); enterprise offer integer IDs are no longer supported
  • Feature flags: enableCodeManagementScreen / enablePortalCodeManagementScreen props removed from component tree
  • Subsidy types: coupon no longer appears as a subsidy type option in settings or subsidy request flows

Risks / Things Reviewers Should Verify

  • Verify no enterprise customer still relies on the legacy coupon UI (backend should have migrated all to learner credit)
  • Verify learner-credit budgets still render correctly without the enterpriseOffers context value
  • Verify subsidy request configuration creation still works (now only checks for subscriptions, not coupons)
  • The subsidyRequestsCounts.couponCodes value still exists in subsidy-requests hook (populated from enterprise-access API, not ecommerce) — sidebar no longer displays it

Notes

  • Imports that previously referenced @edx/frontend-enterprise-utils continue to use @2uinc/frontend-enterprise-utils per edx-fork convention.
  • All 365 test suites pass (2503 tests passing, 42 skipped)
  • ESLint passes cleanly
  • Opened as draft for team review.

macdiesel and others added 5 commits April 29, 2026 15:13
…ceApiService

Remove all coupon/code management components, containers, and their
associated redux slices (codeAssignment, codeRevoke, coupons). Delete
EcommerceApiService.js and remove ECOMMERCE_BASE_URL from config.
Remove CODE_MANAGEMENT feature flag.

Deleted directories:
- src/components/CodeAssignmentModal/
- src/components/CodeDeprecationAlert/
- src/components/CodeManagement/
- src/components/CodeModal/
- src/components/CodeReminderModal/
- src/components/CodeRevokeModal/
- src/components/CodeSearchResults/
- src/components/Coupon/
- src/components/CouponDetails/
- src/components/RequestCodesPage/
- src/components/SaveTemplateButton/
- src/components/NumberCard/
- src/components/RemindButton/
- src/components/RevokeButton/
- src/containers/CodeAssignmentModal/
- src/containers/CodeReminderModal/
- src/containers/CodeRevokeModal/
- src/containers/CouponDetails/
- src/containers/SaveTemplateButton/

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…er-credit, subsidy-requests

- Remove useEnterpriseOffer hook and all enterprise offer code paths
- Simplify useBudgetId to only return subsidyAccessPolicyId
- Remove useCoupons hook and coupons from EnterpriseSubsidiesContext
- Remove EcommerceApiService.fetchCouponOrders from subsidy-requests
- Remove ecommerce budget type and related UI branches
- Remove coupon-related subsidy type constants and UI (banners, modals)
- Remove orphaned EmailTemplateForm/TemplateSourceFields components
- Remove emailTemplate actions/reducer/constants (only used by code modals)
- Clean up settings, sidebar, and routes to remove code management props

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Rewrite EnterpriseSubsidiesContext hooks tests for new API surface
- Update subsidy-requests hooks tests to remove coupon references
- Remove orphaned test files for deleted components
- Fix lint issues in modified test files
- Inline email template constants in validation module

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove ecommerce budget type test cases from BudgetCard tests
- Update sidebar snapshot (Code Management entry removed)
- Remove coupon code request notification tests from sidebar
- Fix SubsidyRequestManagementTable hooks test
- Rewrite EnterpriseSubsidiesContext index test
- Fix SettingsAccessTab test references to coupons
- Remove enterprise offer test cases from BudgetDetailPage
- Fix portalConfiguration reducer test

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix SettingsAccessTab test syntax error from orphaned code blocks
- Remove enterprise offer test cases from BudgetDetailPage spend table test
- Remove unused mockEnterpriseOfferId reference

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.32%. Comparing base (6fb5654) to head (922033e).

Files with missing lines Patch % Lines
...rner-credit-management/BudgetDetailRedemptions.jsx 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #87      +/-   ##
==========================================
+ Coverage   86.55%   87.32%   +0.76%     
==========================================
  Files         822      759      -63     
  Lines       19436    17622    -1814     
  Branches     4029     3675     -354     
==========================================
- Hits        16823    15388    -1435     
+ Misses       2549     2146     -403     
- Partials       64       88      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant