// ─────────────────────────────────────────────────────────── // Huio Control Panel — Realistic Mock Operational Data (cp-mock-data.jsx) // ─────────────────────────────────────────────────────────── const INITIAL_USERS = [ { id: 'usr-1', name: 'Nguyễn Văn Hải', phone: '0901234567', role: 'both', plan: 'business', status: 'verified', date: '2026-01-10', pushToken: 'ExponentPushToken[mock-token-hai]' }, { id: 'usr-2', name: 'Trần Thị Thu Thảo', phone: '0987654321', role: 'organizer', plan: 'pro', status: 'verified', date: '2026-02-15', pushToken: 'ExponentPushToken[mock-token-thao]' }, { id: 'usr-3', name: 'Lê Hoàng Long', phone: '0912345678', role: 'participant', plan: 'free', status: 'pending', date: '2026-05-20', pushToken: null }, { id: 'usr-4', name: 'Phạm Minh Đức', phone: '0934567890', role: 'participant', plan: 'free', status: 'unsigned', date: '2026-05-22', pushToken: 'ExponentPushToken[mock-token-duc]' }, { id: 'usr-5', name: 'Vũ Thị Hồng', phone: '0978901234', role: 'both', plan: 'pro', status: 'verified', date: '2026-03-01', pushToken: null }, { id: 'usr-6', name: 'Ngô Quốc Khánh', phone: '0956789012', role: 'participant', plan: 'free', status: 'pending', date: '2026-05-26', pushToken: 'ExponentPushToken[mock-token-khanh]' } ]; const INITIAL_GROUPS = [ { id: 'grp-1', name: 'Dây Hụi Đại Phát 10M', organizer: 'Trần Thị Thu Thảo', amount: 10000000, members: 16, period: '5 / 16', volume: 160000000, status: 'active' }, { id: 'grp-2', name: 'Hụi Hưu Trí Hải Phòng', organizer: 'Nguyễn Văn Hải', amount: 2000000, members: 20, period: '12 / 20', volume: 40000000, status: 'active' }, { id: 'grp-3', name: 'Dây Hụi Lão Bà Kim Liên', organizer: 'Vũ Thị Hồng', amount: 5000000, members: 12, period: '1 / 12', volume: 60000000, status: 'active' }, { id: 'grp-4', name: 'Hụi Tương Trợ Sài Gòn', organizer: 'Lê Hoàng Long', amount: 1000000, members: 10, period: '0 / 10', volume: 10000000, status: 'draft' } ]; const INITIAL_CCCD_REQUESTS = [ { id: 'req-1', userId: 'usr-3', name: 'Lê Hoàng Long', cccdNum: '037096001254', dob: '1996-04-12', status: 'pending' }, { id: 'req-2', userId: 'usr-6', name: 'Ngô Quốc Khánh', cccdNum: '045094002361', dob: '1994-08-25', status: 'pending' } ]; const INITIAL_RISK_ALERTS = []; const INITIAL_DB_STATS = [ { table: 'profiles', rows: 124, rls: 'active' }, { table: 'hui_groups', rows: 32, rls: 'active' }, { table: 'hui_slots', rows: 286, rls: 'active' }, { table: 'hui_members', rows: 145, rls: 'active' }, { table: 'hui_periods', rows: 194, rls: 'active' }, { table: 'ledger_entries', rows: 1438, rls: 'active' }, { table: 'settlements', rows: 84, rls: 'active' }, { table: 'analytics_events', rows: 13, rls: 'active' }, { table: 'error_logs', rows: 3, rls: 'active' }, { table: 'documentation_embeddings', rows: 840, rls: 'active' } ]; const INITIAL_ANALYTICS_EVENTS = [ { id: 'ae-1', user_id: 'usr-3', anonymous_id: 'anon-long-123', event_type: 'identity_verification_submitted', metadata: { platform: 'ios', timestamp: '2026-06-08T11:24:10Z', cccdNumber: '037096001254' }, created_at: '2026-06-08T11:24:10Z', profiles: { name: 'Lê Hoàng Long', phone: '0912345678' } }, { id: 'ae-2', user_id: 'usr-3', anonymous_id: 'anon-long-123', event_type: 'terms_accepted', metadata: { platform: 'ios', timestamp: '2026-06-08T11:20:00Z' }, created_at: '2026-06-08T11:20:00Z', profiles: { name: 'Lê Hoàng Long', phone: '0912345678' } }, { id: 'ae-3', user_id: 'usr-3', anonymous_id: 'anon-long-123', event_type: 'role_selected', metadata: { platform: 'ios', timestamp: '2026-06-08T11:18:45Z', role: 'participant' }, created_at: '2026-06-08T11:18:45Z', profiles: { name: 'Lê Hoàng Long', phone: '0912345678' } }, { id: 'ae-4', user_id: 'usr-3', anonymous_id: 'anon-long-123', event_type: 'auth_otp_verified', metadata: { platform: 'ios', timestamp: '2026-06-08T11:15:30Z', phone: '+84912345678' }, created_at: '2026-06-08T11:15:30Z', profiles: { name: 'Lê Hoàng Long', phone: '0912345678' } }, { id: 'ae-5', user_id: null, anonymous_id: 'anon-long-123', event_type: 'auth_otp_requested', metadata: { platform: 'ios', timestamp: '2026-06-08T11:14:12Z', phone: '+84912345678' }, created_at: '2026-06-08T11:14:12Z' }, { id: 'ae-6', user_id: null, anonymous_id: 'anon-long-123', event_type: 'onboarding_slide_viewed', metadata: { platform: 'ios', timestamp: '2026-06-08T11:12:00Z', slideIndex: 3 }, created_at: '2026-06-08T11:12:00Z' }, { id: 'ae-7', user_id: null, anonymous_id: 'anon-long-123', event_type: 'onboarding_started', metadata: { platform: 'ios', timestamp: '2026-06-08T11:10:00Z' }, created_at: '2026-06-08T11:10:00Z' }, { id: 'ae-8', user_id: 'usr-6', anonymous_id: 'anon-khanh-456', event_type: 'role_selected', metadata: { platform: 'android', timestamp: '2026-06-08T10:45:00Z', role: 'participant' }, created_at: '2026-06-08T10:45:00Z', profiles: { name: 'Ngô Quốc Khánh', phone: '0956789012' } }, { id: 'ae-9', user_id: 'usr-6', anonymous_id: 'anon-khanh-456', event_type: 'auth_otp_verified', metadata: { platform: 'android', timestamp: '2026-06-08T10:42:10Z', phone: '+84956789012' }, created_at: '2026-06-08T10:42:10Z', profiles: { name: 'Ngô Quốc Khánh', phone: '0956789012' } }, { id: 'ae-10', user_id: null, anonymous_id: 'anon-khanh-456', event_type: 'onboarding_completed', metadata: { platform: 'android', timestamp: '2026-06-08T10:39:00Z' }, created_at: '2026-06-08T10:39:00Z' }, { id: 'ae-11', user_id: null, anonymous_id: 'anon-khanh-456', event_type: 'onboarding_started', metadata: { platform: 'android', timestamp: '2026-06-08T10:35:00Z' }, created_at: '2026-06-08T10:35:00Z' }, { id: 'ae-12', user_id: null, anonymous_id: 'anon-temp-789', event_type: 'onboarding_skipped', metadata: { platform: 'ios', timestamp: '2026-06-08T09:12:00Z', slideIndex: 1 }, created_at: '2026-06-08T09:12:00Z' }, { id: 'ae-13', user_id: null, anonymous_id: 'anon-temp-789', event_type: 'onboarding_started', metadata: { platform: 'ios', timestamp: '2026-06-08T09:10:00Z' }, created_at: '2026-06-08T09:10:00Z' } ]; const INITIAL_ERROR_LOGS = [ { id: 'el-1', user_id: 'usr-3', anonymous_id: 'anon-long-123', error_message: 'Failed to verify OTP code', error_stack: 'Error: Failed to verify OTP code\n at verifyOtp (OtpScreen.tsx:45)\n at onPress (OtpScreen.tsx:82)\n at touchableHandlePress (TouchableOpacity.js:120)', metadata: { platform: 'ios', isFatal: true, version: '1.0.0', build: '42' }, created_at: '2026-06-08T11:15:20Z', profiles: { name: 'Lê Hoàng Long', phone: '0912345678' }, resolved: false }, { id: 'el-2', user_id: null, anonymous_id: 'anon-temp-789', error_message: 'Network request failed', error_stack: 'TypeError: Network request failed\n at fetch (whatwg-fetch.js:456)\n at getSession (supabase.js:123)\n at checkSession (App.tsx:18)', metadata: { platform: 'ios', isFatal: false, version: '1.0.0' }, created_at: '2026-06-08T09:10:05Z', resolved: false }, { id: 'el-3', user_id: 'usr-6', anonymous_id: 'anon-khanh-456', error_message: 'CCCD Photo upload failed: Timeout', error_stack: 'Error: Upload timeout\n at uploadFile (supabaseStorage.ts:89)\n at submitVerification (IdentityVerificationScreen.tsx:142)', metadata: { platform: 'android', isFatal: false, version: '1.0.0', build: '39' }, created_at: '2026-06-08T10:43:00Z', profiles: { name: 'Ngô Quốc Khánh', phone: '0956789012' }, resolved: false } ]; const getInitialLogs = (lang) => [ { id: 1, time: '11:24:10', type: 'info', text: lang === 'vi' ? 'Ngô Quốc Khánh đăng tải tài liệu CCCD để xác minh danh tính' : 'Ngo Quoc Khanh uploaded CCCD document for identity verification' }, { id: 2, time: '10:55:04', type: 'success', text: lang === 'vi' ? 'Dây Hụi Lão Bà Kim Liên được kích hoạt bởi chủ thảo Vũ Thị Hồng' : 'Kim Lien group activated by organizer Vu Thi Hong' }, { id: 3, time: '09:12:45', type: 'info', text: lang === 'vi' ? 'Thành viên mới Phạm Minh Đức đăng ký tài khoản qua số điện thoại 0934567890' : 'New member Pham Minh Duc registered account with phone number 0934567890' }, { id: 4, time: '08:00:00', type: 'system', text: lang === 'vi' ? 'Chạy tác vụ tự động kiểm tra định kỳ lịch thanh toán hụi ngày' : 'Cron job: Automatic verification of daily payments schedule executed' }, { id: 5, time: '07:45:12', type: 'success', text: lang === 'vi' ? 'Nguyễn Văn Hải nâng cấp thành công tài khoản lên gói Business' : 'Nguyen Van Hai upgraded account to Business tier successfully' } ]; // ───── GRAPH DATA GENERATION HELPERS ───── const generate30DaysData = () => { const data = []; const now = new Date(); for (let i = 29; i >= 0; i--) { const d = new Date(now); d.setDate(now.getDate() - i); const dateStr = `${d.getMonth() + 1}/${d.getDate()}`; const seed = Math.sin(i / 3) * 0.3 + 1; const volume = Math.round((20 + seed * 15 + (i % 5) * 5) * 1000000); const commission = Math.round(volume * 0.01); data.push({ date: dateStr, volume, commission, rawDate: d }); } return data; }; const generate12MonthsData = (lang) => { const data = []; const now = new Date(); const monthNamesVi = ['T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10', 'T11', 'T12']; const monthNamesEn = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; const months = lang === 'vi' ? monthNamesVi : monthNamesEn; for (let i = 11; i >= 0; i--) { const d = new Date(now.getFullYear(), now.getMonth() - i, 1); const monthLabel = months[d.getMonth()]; const seed = Math.cos(i / 2) * 0.2 + 1; const volume = Math.round((500 + seed * 300 + (i % 3) * 100) * 1000000); const commission = Math.round(volume * 0.01); data.push({ date: monthLabel, volume, commission, rawDate: d }); } return data; }; window.CP_MOCK_DATA = { INITIAL_USERS, INITIAL_GROUPS, INITIAL_CCCD_REQUESTS, INITIAL_RISK_ALERTS, INITIAL_DB_STATS, INITIAL_ANALYTICS_EVENTS, INITIAL_ERROR_LOGS, getInitialLogs, generate30DaysData, generate12MonthsData };