Commit Graph

139 Commits

Author SHA1 Message Date
Fringg
262303d623 feat: add sales_stats RBAC permission section to frontend
- Update route guard and menu item to use sales_stats:read
- Add sales_stats:read to marketer preset
- Add i18n translations for sales_stats section (ru, en, fa, zh)
2026-03-05 05:46:07 +03:00
Fringg
2fc0759f89 feat: account merge flow — merge redirect, error handling, server-complete linking
- Добавлен merge_required + merge_token redirect в OAuthCallback и LinkTelegramCallback
- Server-complete OAuth linking для Mini App (внешний браузер)
- getErrorDetail: единый экстрактор ошибок из axios response
- LinkTelegramCallback: типизированный catch с getErrorDetail
- Удалён мёртвый экспорт getAndClearOAuthState
- CSRF валидация для Telegram и OAuth linking flows
- Типы ServerCompleteResponse, LinkCallbackResponse
2026-03-05 05:25:50 +03:00
Fringg
da1926f0e1 fix: review findings — polling fallback, sessionStorage cleanup, UX
- Add 5s polling for 90s after opening external browser link (Mini App)
- Show info toast "Continue in browser" when opening external OAuth
- Fix premature sessionStorage cleanup: peek-then-clear pattern
- Use useIsTelegram() hook instead of direct isInTelegramWebApp()
- Add continueInBrowser i18n key (ru, en, zh, fa)
2026-03-05 02:33:33 +03:00
Fringg
7c30a1eab6 feat: open OAuth linking in external browser from Telegram Mini App
- Rewrite OAuthCallback.tsx to handle 3 modes: login, link-browser,
  and link-server (external browser without JWT)
- Add linkServerComplete API method (no JWT, auth via state token)
- Update ConnectedAccounts to use platform.openLink() in Mini App
- Add server-complete endpoint to AUTH_ENDPOINTS (skip Bearer token)
- Enable refetchOnWindowFocus for linked-providers query
- Add returnToTelegram/openTelegram i18n keys (ru, en, zh, fa)
2026-03-05 02:24:28 +03:00
Fringg
9b4a8512c2 fix: remove unused linkTelegramWidget i18n key from all locales 2026-03-04 17:21:16 +03:00
Fringg
a6fabb1d9d feat: add Telegram account linking UI with CSRF protection
- TelegramLinkWidget component with Login Widget for browser users
- One-click initData linking for Mini App users
- LinkTelegramCallback page with CSRF state validation
- URL credential clearing via history.replaceState
- Merge flow support with replace navigation
- i18n keys for all 4 locales (ru, en, zh, fa)
2026-03-04 17:03:48 +03:00
Fringg
d0c01a0e5c fix: replace window.confirm with inline confirmation for unlink
window.confirm() is silently suppressed in Telegram Mini Apps and iOS
WebView, making unlink completely non-functional on mobile. Replaced
with two-click inline confirmation: first click shows destructive
"Confirm disconnect?" button, second click executes unlink. Button
resets on blur.
2026-03-04 15:30:00 +03:00
Fringg
58cf1e3b50 fix: harden merge UI and improve error handling
- MergeAccounts: guard mutationFn against null token/userId
- MergeAccounts: call checkAdminStatus after successful merge
- MergeAccounts: add fallback when success but tokens null
- MergeAccounts: fix ErrorState showing "expired" for all errors
- MergeAccounts: fix formatCountdown dead ternary and hardcoded English
- MergeAccounts: add staleTime/refetchOnWindowFocus to preview query
- MergeAccounts: remove manual useCallback (React Compiler handles it)
- LinkOAuthCallback: add toast feedback on all error/success paths
- ConnectedAccounts: use invalidateQueries instead of refetch
- ConnectedAccounts: add error state rendering
- ConnectedAccounts/LinkOAuthCallback: share sessionStorage key constants
- i18n: add missing profile.accounts.linking key to zh and fa locales
2026-03-04 07:47:36 +03:00
Fringg
93f97d45be feat: account linking and merge UI for cabinet
Add Connected Accounts page (link/unlink OAuth providers), Link OAuth
Callback handler, and Merge Accounts page with subscription comparison
and user choice. Includes API methods, TypeScript types, routes in
App.tsx, navigation from Profile, and i18n for all 4 locales (ru, en,
zh, fa). Merge page works without JWT auth (validated by merge token).
2026-03-04 07:25:45 +03:00
Fringg
f012710df0 feat: add daily deposits by payment method chart
Add MultiSeriesAreaChart showing daily deposit amounts per payment
method with human-readable labels and currency formatting. Memoize
all derived data before early returns for React Compiler compat.
2026-03-02 22:08:16 +03:00
Fringg
2235b3cb77 feat: add daily traffic & device purchase chart to addons stats
Add DualAreaChart to addons tab showing daily traffic purchases vs
device purchases with date-union merge. Add daily_devices field to
AddonsStats type and i18n keys for all 4 locales.
2026-03-02 21:57:18 +03:00
Fringg
4622b4b200 feat: enhance sales stats with device stats, per-tariff charts, and dual-series trials
- Add DualAreaChart component for two-series visualization (registrations vs trials)
- Add MultiSeriesAreaChart component for N-series tariff breakdown with dynamic pivoting
- AddonsTab: add device purchases and device revenue stat cards
- SalesTab: add per-tariff daily sales chart using MultiSeriesAreaChart
- TrialsTab: replace single-series area chart with dual-series registrations + trials chart
- Update TypeScript interfaces to match backend schema changes
- Add i18n keys for all new UI elements across en, ru, zh, fa locales
2026-03-02 21:42:25 +03:00
Fringg
673de08dd4 fix: improve campaign stats, shared chart components, and i18n coverage
- Extract shared chart constants to constants/charts.ts
- Add TREND_STYLES to stats/constants.ts for reuse
- Fix useChartColors with MutationObserver for theme changes
- Fix DailyChart date parsing to prevent timezone shift
- Add truncate to StatCard value for overflow safety
- Fix CampaignCard copy feedback inside try block
- Add NaN validation and staleTime to AdminCampaignStats
- Replace hardcoded strings with i18n keys in Referral page
- Add missing i18n keys across all 4 locales (en, ru, zh, fa)
- Add sales stats route to AdminPanel and App router
2026-03-02 20:34:24 +03:00
Fringg
c7d05c4809 feat: add recharts analytics to admin campaign stats page
- Move shared chart components (DailyChart, PeriodComparison, StatCard) to src/components/stats/ with configurable label props
- Create shared types for chart data decoupled from partner API
- Add campaign chart data API client with deposits/spending split
- Enhance AdminCampaignStats with daily trends chart, period comparison, top registrations, and deposit/spending stat cards
- Add useChartColors hook with SSR guard and theme-aware CSS variable parsing
- Add cross-platform clipboard utility with execCommand fallback for Telegram WebView
- Add i18n keys for chart analytics across all 4 locales (en, ru, zh, fa)
- Responsive fixes: truncation for long names/values, responsive text sizing, touch-friendly copy buttons
2026-03-02 06:10:20 +03:00
Fringg
4a68347ae8 revert: remove user-facing reset traffic toggle
Reset traffic on tariff switch is an admin-only setting.
Backend handles it via admin settings system (data-driven, no frontend code needed).
Reverted all user-facing toggle UI, API params, types, and translations.
2026-02-27 09:50:13 +03:00
Fringg
49fff8e855 feat: add reset traffic toggle on tariff switch
- Add reset_traffic parameter to previewTariffSwitch and switchTariff API calls
- Add reset_traffic_available/reset_traffic_default fields to TariffSwitchPreview type
- Add toggle switch in tariff switch preview modal (shown when backend enables it)
- Initialize toggle from server default (reset_traffic_default)
- Pass reset_traffic flag on switch execution
- Add translations for all 4 locales (ru, en, zh, fa)
2026-02-27 09:48:28 +03:00
Fringg
82987fd49a fix: review fixes - Math.round kopecks, fa locale, admin list commission
1. Add Math.round() to rubles→kopecks conversion (floating point safety)
2. Add missing {{currency}} template var in fa.json amountPlaceholder
3. Show desired_commission_percent in admin applications list
2026-02-27 04:08:15 +03:00
Fringg
e94d81fe5a fix: partner system bugs - commission field, withdrawal UX, admin amount
1. Add desired commission percent field to partner application form
   and admin review page (Bug 1)
2. Add prominent "Requested Amount" row in admin withdrawal detail (Bug 2)
3. Switch withdrawal input from kopecks to rubles with auto-conversion
   on submit (Bug 3)

Includes i18n updates for all 4 locales (ru, en, zh, fa).
2026-02-27 04:02:27 +03:00
Fringg
4d14e3e806 feat: add fullscreen QR code for subscription connection
- New ConnectionQR page with fullscreen QR display (no modal)
- QR button in InstallationGuide header next to platform selector
- Respects hideLink setting: shows URL below QR only when visible
- i18n translations for ru, en, zh, fa
2026-02-27 03:14:15 +03:00
Fringg
821e991f51 fix: block wheel spin without active subscription
- Add has_subscription to WheelConfig type
- Disable spin button when user has no subscription
- Add noSubscription guard in handleUnifiedSpin handler
- Show warning banner directing user to activate subscription
- Prevent banner stacking (noSubscription takes priority over daily limit)
- Add noSubscription i18n keys for ru, en, zh, fa
2026-02-27 00:53:50 +03:00
Fringg
1a702a68b9 feat: replace animated backgrounds with Aceternity UI system
- Add 16 animated background components (aurora, sparkles, vortex, shooting-stars,
  beams, beams-collision, gradient-animation, wavy, lines, boxes, meteors, grid,
  dots, spotlight, noise, ripple, gemini-effect)
- Add full admin BackgroundEditor with live preview, type gallery, per-type settings
- Add BackgroundRenderer with lazy loading, localStorage cache, mobile reduction
- Add input sanitization (sanitizeColor, clampNumber) across all components
- Add translations for en, ru, zh, fa locales
- Remove old Aurora (WebGL/OGL) and AnimatedBackground (CSS wave-blob)
- Remove ogl dependency, add simplex-noise
2026-02-25 07:12:59 +03:00
Fringg
66f7fcb3dc feat: show query params in audit log details 2026-02-25 05:24:25 +03:00
Fringg
5d0e3539e2 feat: improve audit log - translate actions, fix resource filter, show request body 2026-02-25 05:11:57 +03:00
Fringg
a1a8dc2203 feat: add weekdays condition to ABAC policies 2026-02-25 04:53:42 +03:00
Fringg
3d6987f761 feat: add granular user permissions (balance, subscription, promo_group, referral, send_offer)
Split users:edit into fine-grained permissions. Guard UI sections
with hasPermission checks so moderators only see what they can do.
2026-02-25 04:42:40 +03:00
Fringg
80bfaca457 feat: add translations for permission sections and actions
Translate all permission section names (users, tickets, etc.) and
action names (read, edit, delete, etc.) in ru/en/zh/fa locales.
Apply translations in PermissionMatrix, PolicyEdit, and Policies list.
2026-02-25 04:33:35 +03:00
Fringg
4c9c3992ab fix: RBAC frontend type mismatches and translations
- Move RBAC translations from banSystem to admin namespace in all 4 locales
- Fix AccessPolicy type: action (string) -> actions (string[])
- Fix AuditLogEntry type to match backend: add status, request_method, request_path, resource_type, user info
- Fix AuditLogFilters: resource -> resource_type, add status filter
- Handle null details safely in audit log expanded view
- Fix policy form submission and display to use actions array
2026-02-25 03:40:54 +03:00
Fringg
c4e3211baa fix: add missing onError handlers on RBAC mutations
- deleteMutation onError in AdminRoles and AdminPolicies
- revokeMutation onError in AdminRoleAssign
- handleExport error handling in AdminAuditLog
- add missing i18n keys: deleteFailed, revokeFailed, exportError
2026-02-25 03:17:12 +03:00
Fringg
874ee2682e feat: add RBAC permission system to admin cabinet frontend
- Permission store (Zustand) with wildcard matching and role level checks
- PermissionRoute guard for route-level access control
- PermissionGate component for element-level visibility
- Admin Roles page: CRUD, permission editor, role assignment
- Admin Policies page: ABAC policy management (time/IP conditions)
- Admin Audit Log page: filterable log viewer with CSV export
- AdminPanel sidebar navigation gated by permissions
- 4 locale files updated (en, ru, zh, fa) with RBAC translations
- API client module for all RBAC endpoints
2026-02-25 03:02:52 +03:00
Fringg
48be067d1b feat: add per-channel disable settings and global settings to channel admin
- Add global settings section (CHANNEL_IS_REQUIRED_SUB, trial/paid toggles)
  at top of AdminChannelSubscriptions page
- Add per-channel disable_trial_on_leave and disable_paid_on_leave toggles
  in each channel card with inline Toggle controls
- Update RequiredChannel type and API request interfaces with new fields
- Add translations for globalSettings and perChannel in en/ru/fa/zh locales
2026-02-25 00:24:36 +03:00
Fringg
5a55892145 feat: add channel edit in admin, hide subscribed channels in blocking screen
- Admin panel: added Edit button on channel cards with inline edit form
  (title, link, sort order) using existing PATCH API
- Subscription screen: filter out already-subscribed channels so users
  only see what they still need to subscribe to
- Updated channelIdHint to remove @username reference (numeric only)
- Added i18n keys: edit, editing, form.save (en/ru/fa/zh)
2026-02-24 03:12:12 +03:00
Fringg
a767fe96d3 feat: add multi-channel subscription blocking UI and admin management
- Channel subscription blocking screen with per-channel status display
- Safe URL handling with protocol validation (no open redirect)
- Race-condition-safe subscription check with useRef guard
- Admin channel management page with create, toggle, delete
- Error handlers on all admin mutations with haptic feedback
- Proper type guard for channel subscription error detection
- Accessibility: aria-labels on icon-only buttons
- Localization: en, ru, zh, fa translations
2026-02-24 02:51:03 +03:00
Fringg
91d567f9cc fix: add resend email cooldown and allow email change for all auth types
Add 60-second cooldown timer on resend verification email button to
prevent spam. Remove auth_type restriction on change email button so
OAuth users can also change their email.
2026-02-23 15:44:16 +03:00
Fringg
cfe9f642d8 feat: show traffic reset period on tariff cards
Display daily/weekly/monthly reset badge next to traffic and devices.
Hidden for NO_RESET tariffs.
2026-02-18 09:36:39 +03:00
Fringg
ecc089da64 fix: show locations count instead of servers on tariff cards
servers_count already represents squad count on backend.
Renamed display labels to "locations" on tariff cards and
confirmation view. Server names still shown in subscription card.
2026-02-18 09:25:44 +03:00
Fringg
959f89266b feat: partner-campaign integration in admin UI
- Add partner badge to campaigns list
- Add partner selector dropdown in campaign edit
- Support ?partnerId= query param in campaign create (replaces separate page)
- Filter already-assigned campaigns in partner assign flow
- Show taken campaigns greyed out with partner name
- Delete AdminPartnerCampaignCreate (replaced by query param approach)
- Add partner translations (ru, en, zh, fa)
2026-02-18 06:47:07 +03:00
Fringg
9cf8e095b8 feat: show blocked_count in broadcast admin UI
- Add blocked_count to Broadcast interface
- 4-column stats grid with blocked card (warning color)
- Show blocked count in broadcast list when > 0
- Fetch single broadcast by ID instead of listing all
- Add i18n keys for blocked/blockedShort in ru/en/zh/fa
2026-02-17 18:37:45 +03:00
Fringg
9b2742ff3a fix: add missing cancelled filter key to withdrawal i18n in all locales 2026-02-17 12:28:32 +03:00
Fringg
a72042d807 fix: show all campaigns in assign list, add dual links and bonus details
1. Remove is_active filter from campaign assign page so inactive
   campaigns are also visible (with badge)
2. Redesign partner campaign cards with separate bot/cabinet links,
   detailed bonus descriptions, and per-link copy buttons
2026-02-17 10:54:36 +03:00
Fringg
8b33d8224d feat: show partner campaign links with bonuses on referral page
Display campaigns assigned to the partner with shareable deep links,
copy button, and bonus type badges (balance/subscription/tariff).
2026-02-17 10:45:13 +03:00
Fringg
062976180c refactor: convert partner/withdrawal modals to separate pages
Replace 7 modal dialogs with 8 dedicated page routes for better
mobile/Telegram WebApp UX. Add campaign management (assign/create
with auto-assign) to partner detail page.

New pages: AdminApplicationReview, AdminPartnerCommission,
AdminPartnerRevoke, AdminWithdrawalReject, AdminPartnerCampaignAssign,
AdminPartnerCampaignCreate, ReferralPartnerApply,
ReferralWithdrawalRequest.

~610 lines removed from parent pages, ~425 lines removed net.
2026-02-17 10:28:32 +03:00
Fringg
779fbf0dc6 feat: add partner management and withdrawal admin pages
- Admin partners page: list partners, view applications, approve/reject
- Admin partner detail: stats, commission management, campaign assignment
- Admin withdrawals page: list with risk scoring, status filters including cancelled
- Admin withdrawal detail: fraud analysis, approve/reject/complete actions
- Partner API client with full TypeScript interfaces
- Withdrawal API client with admin and user endpoints
- Referral page: partner application form, withdrawal balance and history
- Navigation: partners and withdrawals in admin panel marketing group
- i18n: full translations for ru, en, zh, fa locales
- Neutral fallbacks for unknown status badges
2026-02-17 09:51:48 +03:00
Fringg
e0dd21fd0b feat: add web campaign links — capture, auth integration, bonus UI
- Add campaign.ts utility (capture from URL, localStorage with TTL, validation)
- Pass campaign_slug in all auth API methods (telegram, widget, email, oauth)
- Consume slug in auth store login methods, set pendingCampaignBonus state
- Add CampaignBonusNotifier component (toast on bonus, mounted in AppShell)
- Show web_link alongside bot deep_link in AdminCampaignStats
- Add CampaignBonusInfo type with union bonus_type
- Fix VerifyEmail: ref guard against StrictMode double-fire, setTimeout cleanup
- Fix AdminCampaignStats: setTimeout refs with cleanup, i18n-aware locale
- Wrap all localStorage access in try/catch (Safari private browsing safety)
- Add campaignBonus translations (ru/en/fa/zh)
2026-02-17 06:44:10 +03:00
Fringg
150a1b2dba fix: normalize all API responses, add error handling and reset confirmation
- Extract normalizeConfig() for consistent response normalization
- Add onError handlers to mutations with useNotify
- Add window.confirm before destructive reset action
- Add resetConfirm translation key to all locales
2026-02-13 00:41:00 +03:00
Fringg
1a0a5ff453 feat: add per-button enable/disable toggle and custom labels per locale
- Add Toggle per section card to show/hide button in main menu
- Add collapsible locale label inputs (ru, en, ua, zh, fa) per section
- Normalize server response for backward compatibility with older API
- Update all 4 locale files with new translation keys
2026-02-12 23:42:58 +03:00
Fringg
e586129c37 feat: add 'no color' option for button style customization
Adds a 'default' style option that removes color from buttons, showing
Telegram's native default style. Updates type, UI chip, preview, and
translations for all 4 locales.
2026-02-12 23:25:49 +03:00
Fringg
b2898730b9 feat: add ButtonsTab for per-section button style customization
Visual editor in admin settings for configuring Telegram button colors
and custom emoji IDs per menu section. Includes API client, draft state
management, save/reset, and translations for ru/en/fa/zh locales.
2026-02-12 23:16:08 +03:00
Fringg
aa5113b8e3 feat: add admin pinned messages section
- API client with full CRUD, broadcast, activate/deactivate, unpin endpoints
- List page with active/inactive badges, action buttons, pagination
- Create/edit form with content editor, media upload, display settings toggles
- Routes and navigation in admin marketing group
- i18n translations for ru, en, fa, zh
2026-02-12 19:33:18 +03:00
Fringg
1d6ec70116 fix: handle unlimited traffic package selection and button text
- Fix falsy check: selectedTrafficPackage !== null instead of truthy
  (gb=0 for unlimited was evaluated as false, hiding the buy button)
- Show "Buy Unlimited" instead of "Buy 0 GB" for unlimited packages
- Add buyUnlimited translation key to all 4 locales
2026-02-11 18:20:21 +03:00
Fringg
f10a02ceb6 feat: show affected subscriptions count on tariff deletion
Update delete mutation to use affected_subscriptions from API response.
Show contextual success notification with subscription count.
Add deleteSuccessWithSubscriptions translation key in all 4 locales.
2026-02-09 22:30:28 +03:00