Skip to content

Conversation

@tomerqodo
Copy link

Benchmark PR plausible#5866

Type: Clean (correct implementation)

Original PR Title: Consolidated View life cycle + billing integration
Original PR Description: ### Changes

This PR integrates consolidated view life cycle with billing properties.
It relies on two migrations (included here still), extracted to separate PRs:

Main changes:

  • new feature flag: :consolidated_view - we no longer display anything based on super_admin role; flag is not setup on production yet, meaning existing consolidated views will disappear (and no CTAs will be shown).
  • new billing feature: ConsolidatedView
  • all existing plans are updated, so that business tier includes the newly added features - either through static definitions or database migration
  • whenever /sites is visited an attempt is made to create consolidated view. If the team is eligible, and the feature flag is raised, the consolidated view card is shown. Otherwise a CTA card is displayed (courtesy of @sanne-san)
    • CTA card has several variants, depending on the context, but eventually leads to upgrade. Once the upgrade is performed, /sites will include the consolidated view card.
    • CTA card can be permanently dismissed per user and team; because local storage and cookies turned out to be very difficult to work with in this setup, the decision was made to introduce a new postgres table capable of storing user preferences in a team context (it's almost a 1:1 copy of the existing site user preferences table)
    • When CTA is dismissed, the "New Site" button becomes a prima drop-down (courtesy of @ukutaht) from which the user may restore it (by selecting "+ New consolidated view" dropdown item)
    • CRM now presents a more elaborate alert on deleting consolidated view, as well as the availability status (whether upgrade is required)
    • some minor improvements BTW:
      • shared links enforce regular sites,
      • accessing a consolidated view via pre-existing URL, while ineligible, redirects to /sites
      • at least 2 sites are now required to create (or even suggest) a consolidated view
      • ConsolidatedView.enabled?/1 has been removed, since enabling doesn't mean availability

TODO:

  • staging preview is currently unavailable due to pending migrations
  • there are visual issues with card plots and overlapping dropdowns
record-2025-11-10-10-29-34-year.node.norm.mp4
  • the dropdown doesn't respect dark mode
image

Tests

  • Automated tests have been added
  • This PR does not require tests

Changelog

  • Entry has been added to changelog
  • This PR does not make a user-facing change

Documentation

  • Docs have been updated
  • This change does not need a documentation update

Dark mode

  • The UI has been tested both in dark and light mode
  • This PR does not change the UI

Original PR URL: plausible#5866

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.

2 participants