mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-05-18 04:08:48 -05:00
b0dde80ba9
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.
17 lines
601 B
Python
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"
|