Add trial/paid distinction and CTAs to credits exhausted empty state

What does this MR do and why?

Enhances the Duo Agentic Chat "no credits" empty state to distinguish between trial and paid users:

  • Trial users: See "No credits remain on your trial" with an "Upgrade to Premium" CTA
  • Paid users: See "No credits remain for this billing period" with a "Purchase more credits" CTA
  • CTAs only appear for users with billing permissions (edit_billing on namespace)
  • Links route to group billing page (GitLab.com) or admin subscription page (self-managed)
  • Adds internal events tracking for view and click actions with trial/paid labels

References

#587921+

Screenshots or screen recordings

scenario before after
No credits left in trial (owner) image image
No credits left in trial (not owner) image image
No credits left in subscription (owner) image image
No credits left in subscription (not owner) image image

How to set up and validate locally

Prerequisites:

  • GDK with Duo features enabled
  • A group with Duo Enterprise/Pro subscription

1. Simulate credits exhausted state: Set ee/lib/gitlab/llm/tanuki_bot.rb#self.credits_available? to return false

Or temporarily modify ee/app/helpers/ee/page_layout_helper.rb:

credits_available: 'false',

2. Test scenarios:

  • Paid user with billing access (Owner of a paid group): Shows "No credits remain for this billing period", "Purchase more credits" button links to group billing
  • Paid user without billing access (Developer in a paid group): Shows paid copy, no purchase button (only "Learn more")
  • Trial user with billing access (Owner of a trial group): Shows "No credits remain on your trial", "Upgrade to Premium" button links to group billing
  • Trial user without billing access (Developer in a trial group): Shows trial copy, no upgrade button
  • Self-managed admin (Admin user on SM instance): Shows paid copy, "Purchase more credits" links to admin subscription page
  • Self-managed non-admin (Regular user on SM instance): Shows paid copy, no purchase button
  • No namespace context (User on homepage with default Duo namespace set): Uses default namespace for trial/billing checks

3. Tracking events:

  • view_duo_agentic_no_credits_empty_state with label trial or paid on page load
  • click_duo_agentic_no_credits_learn_more when clicking "Learn more"
  • click_duo_agentic_no_credits_purchase_credits when clicking "Purchase more credits" (paid)
  • click_duo_agentic_no_credits_upgrade_premium when clicking "Upgrade to Premium" (trial)

4. Verify namespace resolution: Inside a project: Project's root group Inside a group: Group's root ancestor Homepage/other pages: User's default Duo namespace

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Konstantin Greif

Merge request reports

Loading