Files
TimeTracker/app/utils/support_report_generation.py
T
Dries Peeters b0dde80ba9 feat(web): high-visibility support modal, prompts, and supporter UX
Add a support modal with usage stats, tier and license links, share control, and offline-safe outbound CTAs. Surface support from the header, sidebar, user menu, dashboard card, and settings "Support & Community" section without hiding entry points when a supporter license is active.

Introduce UsageStatsService and a persisted users.support_stats_reports_generated counter incremented on key report exports and custom report views. Add SupportPromptService for session-scoped soft toasts (after export, dashboard milestones, long session via POST /donate/request-soft-prompt).

Wire consent-aware track_event names support.* and mirror funnel rows in DonationInteraction; fix has_recent_donation_click to treat link_clicked as a recent click. Document events and SUPPORT_* / migration notes in docs.

Tests: tests/test_support_services.py for prompt and usage stats behavior.
2026-04-15 10:55:37 +02:00

17 lines
601 B
Python

"""Hook successful report exports/views for support stats and soft prompts."""
from __future__ import annotations
def record_report_generation_for_current_user() -> None:
"""Increment per-user report counter and queue a one-shot support prompt trigger."""
from flask import session
from flask_login import current_user
from app.services.usage_stats_service import UsageStatsService
if not getattr(current_user, "is_authenticated", False):
return
UsageStatsService.increment_reports_generated(current_user.id)
session["support_prompt_trigger"] = "after_report"