FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
update [skip cli]
tilakpatel22717c7fd2d49e
diff --git a/fincept-terminal-desktop/.gitignore b/fincept-terminal-desktop/.gitignoreindex b0c5812b1..21339d396 100644--- a/fincept-terminal-desktop/.gitignore+++ b/fincept-terminal-desktop/.gitignore@@ -24,3 +24,4 @@ dist-ssr*.sw?src/services/node_modules+src-tauri/targetdiff --git a/fincept-terminal-desktop/CONTEXT_ANALYSIS.md b/fincept-terminal-desktop/CONTEXT_ANALYSIS.mddeleted file mode 100644index 0fe6f8d4c..000000000--- a/fincept-terminal-desktop/CONTEXT_ANALYSIS.md+++ /dev/null@@ -1,401 +0,0 @@-# Fincept Terminal - Complete Context Analysis--## 📋 CURRENT AUTHENTICATION & SESSION SYSTEM--### **Authentication Flow**-1. **Login/Register** → User enters credentials-2. **OTP Verification** (for new users)-3. **API Key Generation** → Backend returns `api_key`-4. **Session Creation** → AuthContext stores session-5. **Account Type Check**:- - Free Account → Redirect to **Pricing Screen**- - Paid Subscription → Redirect to **Dashboard**- - Guest Mode → Direct to **Dashboard** (24h limit)--### **User Types**-```typescript-'guest' | 'registered'-```--**Guest Users:**-- Device-based authentication-- 24-hour session expiry-- Daily API call limits (50 calls/day)-- No payment required-- Device ID generated from browser fingerprint--**Registered Users:**-- Email/password authentication-- Persistent sessions-- Account types: `free`, `starter`, `professional`, `enterprise`, `unlimited`-- Subscription management-- Payment integration--### **Session Data Structure**-```typescript-interface SessionData {- authenticated: boolean;- user_type: 'guest' | 'registered';- api_key: string | null;- device_id: string;- user_info?: {- username: string;- email: string;- account_type: string; // 'free', 'starter', 'professional', etc.- credit_balance: number;- is_verified: boolean;- mfa_enabled: boolean;- };- expires_at?: string; // For guest users- daily_limit?: number; // For guest users- requests_today?: number; // For guest users- subscription?: {- has_subscription: boolean;- subscription?: {- subscription_uuid: string;- plan: { name, plan_id, price };- status: string;- current_period_start: string;- current_period_end: string;- days_remaining: number;- cancel_at_period_end: boolean;- usage: {- api_calls_used: number;- api_calls_limit: number | string;- usage_percentage: number;- };- };- };-}-```-------## 🔐 CURRENT ISSUES IDENTIFIED--### **1. No Logout Functionality in Dashboard Header**-- **Problem**: Dashboard header (DashboardScreen.tsx) has no logout button-- **User Impact**: Users cannot end their session from the terminal-- **Current State**: Menu dropdowns present but no logout option--### **2. Payment Flow Redirect Errors**-- **Problem**: Payment success redirects may have issues-- **Location**: `PaymentSuccessScreen.tsx` + `App.tsx`-- **Current Flow**:- 1. User selects plan → `PricingScreen`- 2. Creates checkout session → Opens payment URL- 3. Payment completed → Redirects to `/payment-success?session_id=...`- 4. `PaymentSuccessScreen` handles verification- 5. Redirect to dashboard-- **Potential Issues**:- - URL parameter handling- - Session validation after payment- - Double-redirects causing loops--### **3. No Session Awareness in Tabs**-- **Problem**: Terminal tabs don't display user session info-- **Missing Features**:- - User type indicator (Guest vs Registered)- - Account plan display- - Session expiry warnings (for guests)- - API usage stats- - Subscription status-------## 🎯 REQUIRED MODIFICATIONS--### **Task 1: Add Logout to Dashboard Header**-**File**: `src/components/dashboard/DashboardScreen.tsx`--**Changes Needed**:-1. Import `useAuth` hook-2. Add logout button to header dropdowns-3. Add logout handler that:- - Calls `logout()` from AuthContext- - Clears IndexedDB credentials (if needed)- - Redirects to login screen--**UI Location**: Top menu bar → Add to "Session" or "File" dropdown-------### **Task 2: Fix Payment Redirect Flow**-**Files**:-- `src/components/payment/PaymentSuccessScreen.tsx`-- `src/App.tsx`--**Current Issues**:-```typescript-// In PaymentSuccessScreen.tsx:-// Line 92-94: onComplete() callback-const handleContinueToDashboard = () => {- onComplete(); // Should redirect to dashboard-};--// In App.tsx:-// Line 231-238: PaymentSuccessScreen props-onComplete={() => {- setHasChosenFreePlan(false);- setCameFromLogin(false);- setCurrentScreen('dashboard'); // May cause redirect loop-}}-```--**Fix Strategy**:-1. Clear URL parameters after payment success-2. Refresh session data before redirect-3. Add proper loading states-4. Handle edge cases (payment failed, session expired, etc.)-------### **Task 3: Add Session Info to Tabs**-**Files**: All tab components need session awareness--**Required Information Display**:--**For Guest Users**:-```-┌─────────────────────────────────────┐-│ 👤 Guest User │-│ ⏰ Session: 18h 23m remaining │-│ 📊 API Calls: 12/50 today │-│ ⚠️ Limited access - Upgrade? │-└─────────────────────────────────────┘-```--**For Registered Users (Free Plan)**:-```-┌─────────────────────────────────────┐-│ 👤 [email protected] │-│ 📦 Plan: Free │-│ 📊 API Calls: 1,247/10,000 today │-│ 💳 Upgrade to unlock more features │-└─────────────────────────────────────┘-```--**For Registered Users (Paid Plan)**:-```-┌─────────────────────────────────────┐-│ 👤 [email protected] │-│ 📦 Plan: Professional ($49/mo) │-│ 📊 API Calls: 8,234/50,000 today │-│ ✅ Subscription: Active │-│ 📅 Renews: Dec 31, 2025 │-└─────────────────────────────────────┘-```--**Implementation Locations**:-1. **Header/Top Bar** (all tabs): User info widget-2. **Profile/Settings Tab**: Full session details-3. **Status Bar** (optional): Minimal session info-------## 📁 KEY FILES & THEIR ROLES--### **Authentication System**-| File | Purpose |-|------|---------|-| `AuthContext.tsx` | Global session management, login/logout/register |-| `authApi.tsx` | Backend API calls for authentication |-| `LoginScreen.tsx` | User login UI |-| `RegisterScreen.tsx` | User registration + OTP verification |-| `App.tsx` | Main routing logic, screen navigation |--### **Payment System**-| File | Purpose |-|------|---------|-| `paymentApi.tsx` | Payment API calls, subscription management |-| `PricingScreen.tsx` | Plan selection UI |-| `PaymentProcessingScreen.tsx` | Loading state during payment |-| `PaymentSuccessScreen.tsx` | Payment confirmation + redirect |-| `PaymentOverlay.tsx` | In-app payment window |--### **Dashboard System**-| File | Purpose |-|------|---------|-| `DashboardScreen.tsx` | Main terminal interface, tab navigation, header |-| `*Tab.tsx` (all tabs) | Individual terminal tabs (Markets, News, Settings, etc.) |-------## 🛠️ IMPLEMENTATION PLAN--### **Phase 1: Add Logout Functionality** ✅-**Priority**: HIGH-**Complexity**: LOW--1. Modify `DashboardScreen.tsx`:- - Add logout to Session dropdown- - Call `useAuth().logout()`- - Navigate to login screen--2. Test scenarios:- - Registered user logout- - Guest user logout- - Session cleanup verification-------### **Phase 2: Fix Payment Redirects** ✅-**Priority**: HIGH-**Complexity**: MEDIUM--1. Update `PaymentSuccessScreen.tsx`:- - Clear URL params immediately- - Add retry logic for API calls- - Better error handling--2. Update `App.tsx`:- - Fix redirect logic- - Prevent loops- - Add loading states--3. Test scenarios:- - Successful payment- - Failed payment- - User closes payment window early- - Network errors during verification-------### **Phase 3: Add Session Info to Tabs** ✅-**Priority**: MEDIUM-**Complexity**: MEDIUM--1. Create reusable session info component:- - `<SessionInfoWidget />` for header- - `<SessionDetailsPanel />` for Profile tab--2. Update `DashboardScreen.tsx`:- - Add session widget to header- - Replace static "Guest (18h remaining)" text--3. Update individual tabs (optional):- - Add contextual session warnings- - Example: News tab shows "Upgrade for full article access"-------## 🧪 TESTING CHECKLIST--### **Authentication Tests**-- [ ] Login with valid credentials-- [ ] Login with invalid credentials-- [ ] Guest mode access-- [ ] Session persistence after refresh-- [ ] Session expiry handling--### **Logout Tests**-- [ ] Logout from registered account-- [ ] Logout from guest account-- [ ] Session cleared from localStorage-- [ ] Credentials cleared from IndexedDB-- [ ] Redirect to login screen--### **Payment Flow Tests**-- [ ] Select free plan → Go to dashboard-- [ ] Select paid plan → Opens payment window-- [ ] Complete payment → Redirect to success screen-- [ ] Success screen → Refresh subscription data-- [ ] Success screen → Redirect to dashboard-- [ ] Cancel payment → Return to pricing screen-- [ ] Payment failure → Show error, allow retry--### **Session Display Tests**-- [ ] Guest user sees expiry countdown-- [ ] Free user sees plan upgrade prompt-- [ ] Paid user sees subscription details-- [ ] API usage stats update correctly-- [ ] Session warnings appear at 30min remaining (guests)-------## 📊 SESSION STATE FLOW DIAGRAM--```-┌──────────────────────────────────────────────────────────────┐-│ App Start │-└───────────────────────────┬──────────────────────────────────┘- │- ▼- ┌───────────────┐- │ isLoading? │- └───┬───────┬───┘- │ Yes │ No- ▼ ▼- Loading Check Session- Screen ┌────┴────┐- │ │- ┌──────▼─────┐ │- │ Guest User │ │- └──────┬─────┘ │- │ │- ▼ ▼- Dashboard ┌────────────┐- │ Registered │- │ User │- └──────┬─────┘- │- ┌─────────────┴─────────────┐- │ │- ┌──────▼──────┐ ┌───────▼────────┐- │ Free Plan │ │ Paid Plan │- │ │ │ (Subscribed) │- └──────┬──────┘ └───────┬────────┘- │ │- ▼ ▼- Pricing Screen Dashboard- │- ┌──────┴──────┐- │ │- ┌──────▼────┐ ┌─────▼──────┐- │ Choose │ │ Purchase │- │ Free Plan │ │ Paid Plan │- └──────┬────┘ └─────┬──────┘- │ │- │ ▼- │ Payment Flow- │ │- │ ┌──────▼──────────┐- │ │ Payment Success │- │ └──────┬──────────┘- │ │- └──────────────┴─────────▼- Dashboard-```-------## 💡 RECOMMENDATIONS--### **Security**-1. ✅ Session tokens stored in localStorage (encrypted would be better)-2. ⚠️ API keys visible in network traffic (HTTPS mitigates)-3. ✅ Guest sessions expire after 24h-4. ⚠️ No automatic session refresh before expiry--### **User Experience**-1. Add session expiry warnings (30min, 5min, 1min)-2. Auto-save work before session expires-3. Seamless re-authentication flow-4. "Remember me" option for longer sessions--### **Feature Enhancements**-1. Multi-device session management-2. Session activity history-3. Force logout from all devices-4. 2FA/MFA for sensitive operations-------## 🔄 NEXT STEPS--1. **Gather full context** ✅ (COMPLETED)-2. **Add logout button** (In progress...)-3. **Fix payment redirects** (In progress...)-4. **Add session display** (In progress...)-5. **Test all flows** (Pending...)-6. **Deploy changes** (Pending...)\ No newline at end of filediff --git a/fincept-terminal-desktop/package-lock.json b/fincept-terminal-desktop/package-lock.jsonindex daa9ee3a7..3ff2b715d 100644--- a/fincept-terminal-desktop/package-lock.json+++ b/fincept-terminal-desktop/package-lock.json@@ -54,6 +54,7 @@"otplib": "^12.0.1","playwright": "^1.55.1","react": "^19.1.0",+ "react-confetti": "^6.4.0","react-day-picker": "^9.11.0","react-dom": "^19.1.0","recharts": "^2.15.4",@@ -6848,6 +6849,21 @@"node": ">=0.10.0"}},+ "node_modules/react-confetti": {+ "version": "6.4.0",+ "resolved": "https://registry.npmjs.org/react-confetti/-/react-confetti-6.4.0.tgz",+ "integrity": "sha512-5MdGUcqxrTU26I2EU7ltkWPwxvucQTuqMm8dUz72z2YMqTD6s9vMcDUysk7n9jnC+lXuCPeJJ7Knf98VEYE9Rg==",+ "license": "MIT",+ "dependencies": {+ "tween-functions": "^1.2.0"+ },+ "engines": {+ "node": ">=16"+ },+ "peerDependencies": {+ "react": "^16.3.0 || ^17.0.1 || ^18.0.0 || ^19.0.0"+ }+ },"node_modules/react-day-picker": {"version": "9.11.0","resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-9.11.0.tgz",@@ -7465,6 +7481,12 @@"url": "https://github.com/sponsors/Wombosvideo"}},+ "node_modules/tween-functions": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/tween-functions/-/tween-functions-1.2.0.tgz",+ "integrity": "sha512-PZBtLYcCLtEcjL14Fzb1gSxPBeL7nWvGhO5ZFPGqziCcr8uvHp0NDmdjBchp6KHL+tExcg0m3NISmKxhU394dA==",+ "license": "BSD"+ },"node_modules/typescript": {"version": "5.8.3","resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",diff --git a/fincept-terminal-desktop/package.json b/fincept-terminal-desktop/package.jsonindex 78e7a6295..a0df0b7a0 100644--- a/fincept-terminal-desktop/package.json+++ b/fincept-terminal-desktop/package.json@@ -56,6 +56,7 @@"otplib": "^12.0.1","playwright": "^1.55.1","react": "^19.1.0",+ "react-confetti": "^6.4.0","react-day-picker": "^9.11.0","react-dom": "^19.1.0","recharts": "^2.15.4",diff --git a/fincept-terminal-desktop/src-tauri/Cargo.lock b/fincept-terminal-desktop/src-tauri/Cargo.lockindex 6d24f3751..d39068229 100644--- a/fincept-terminal-desktop/src-tauri/Cargo.lock+++ b/fincept-terminal-desktop/src-tauri/Cargo.lock@@ -511,10 +511,39 @@ version = "0.18.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"dependencies = [+ "percent-encoding","time","version_check",]+[[package]]+name = "cookie_store"+version = "0.21.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9"+dependencies = [+ "cookie",+ "document-features",+ "idna",+ "log",+ "publicsuffix",+ "serde",+ "serde_derive",+ "serde_json",+ "time",+ "url",+]++[[package]]+name = "core-foundation"+version = "0.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"+dependencies = [+ "core-foundation-sys",+ "libc",+]+[[package]]name = "core-foundation"version = "0.10.1"@@ -538,7 +567,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1"dependencies = ["bitflags 2.9.4",- "core-foundation",+ "core-foundation 0.10.1","core-graphics-types","foreign-types","libc",@@ -551,7 +580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"dependencies = ["bitflags 2.9.4",- "core-foundation",+ "core-foundation 0.10.1","libc",]@@ -774,6 +803,15 @@ dependencies = ["syn 2.0.106",]+[[package]]+name = "document-features"+version = "0.2.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"+dependencies = [+ "litrs",+]+[[package]]name = "dpi"version = "0.1.2"@@ -830,6 +868,15 @@ version = "1.2.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"+[[package]]+name = "encoding_rs"+version = "0.8.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"+dependencies = [+ "cfg-if",+]+[[package]]name = "endi"version = "1.1.0"@@ -938,6 +985,7 @@ dependencies = ["serde_json","tauri","tauri-build",+ "tauri-plugin-cors-fetch","tauri-plugin-opener",]@@ -1230,8 +1278,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"dependencies = ["cfg-if",+ "js-sys","libc","wasi 0.11.1+wasi-snapshot-preview1",+ "wasm-bindgen",][[package]]@@ -1241,9 +1291,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"dependencies = ["cfg-if",+ "js-sys","libc","r-efi","wasi 0.14.7+wasi-0.2.4",+ "wasm-bindgen",][[package]]@@ -1400,6 +1452,25 @@ dependencies = ["syn 2.0.106",]+[[package]]+name = "h2"+version = "0.4.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386"+dependencies = [+ "atomic-waker",+ "bytes",+ "fnv",+ "futures-core",+ "futures-sink",+ "http",+ "indexmap 2.11.4",+ "slab",+ "tokio",+ "tokio-util",+ "tracing",+]+[[package]]name = "hashbrown"version = "0.12.3"@@ -1498,6 +1569,7 @@ dependencies = ["bytes","futures-channel","futures-core",+ "h2","http","http-body","httparse",@@ -1509,6 +1581,23 @@ dependencies = ["want",]+[[package]]+name = "hyper-rustls"+version = "0.27.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58"+dependencies = [+ "http",+ "hyper",+ "hyper-util",+ "rustls",+ "rustls-pki-types",+ "tokio",+ "tokio-rustls",+ "tower-service",+ "webpki-roots",+]+[[package]]name = "hyper-util"version = "0.1.17"@@ -1528,9 +1617,11 @@ dependencies = ["percent-encoding","pin-project-lite","socket2",+ "system-configuration","tokio","tower-service","tracing",+ "windows-registry",][[package]]@@ -1932,6 +2023,12 @@ version = "0.8.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"+[[package]]+name = "litrs"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed"+[[package]]name = "lock_api"version = "0.4.13"@@ -1948,6 +2045,12 @@ version = "0.4.28"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"+[[package]]+name = "lru-slab"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"+[[package]]name = "mac"version = "0.1.1"@@ -2787,6 +2890,22 @@ dependencies = ["unicode-ident",]+[[package]]+name = "psl-types"+version = "2.0.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac"++[[package]]+name = "publicsuffix"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6f42ea446cab60335f76979ec15e12619a2165b5ae2c12166bef27d283a9fadf"+dependencies = [+ "idna",+ "psl-types",+]+[[package]]name = "quick-xml"version = "0.38.3"@@ -2796,6 +2915,61 @@ dependencies = ["memchr",]+[[package]]+name = "quinn"+version = "0.11.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20"+dependencies = [+ "bytes",+ "cfg_aliases",+ "pin-project-lite",+ "quinn-proto",+ "quinn-udp",+ "rustc-hash",+ "rustls",+ "socket2",+ "thiserror 2.0.16",+ "tokio",+ "tracing",+ "web-time",+]++[[package]]+name = "quinn-proto"+version = "0.11.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31"+dependencies = [+ "bytes",+ "getrandom 0.3.3",+ "lru-slab",+ "rand 0.9.2",+ "ring",+ "rustc-hash",+ "rustls",+ "rustls-pki-types",+ "slab",+ "thiserror 2.0.16",+ "tinyvec",+ "tracing",+ "web-time",+]++[[package]]+name = "quinn-udp"+version = "0.5.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd"+dependencies = [+ "cfg_aliases",+ "libc",+ "once_cell",+ "socket2",+ "tracing",+ "windows-sys 0.60.2",+]+[[package]]name = "quote"version = "1.0.40"@@ -2836,6 +3010,16 @@ dependencies = ["rand_core 0.6.4",]+[[package]]+name = "rand"+version = "0.9.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"+dependencies = [+ "rand_chacha 0.9.0",+ "rand_core 0.9.3",+]+[[package]]name = "rand_chacha"version = "0.2.2"@@ -2856,6 +3040,16 @@ dependencies = ["rand_core 0.6.4",]+[[package]]+name = "rand_chacha"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"+dependencies = [+ "ppv-lite86",+ "rand_core 0.9.3",+]+[[package]]name = "rand_core"version = "0.5.1"@@ -2874,6 +3068,15 @@ dependencies = ["getrandom 0.2.16",]+[[package]]+name = "rand_core"+version = "0.9.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"+dependencies = [+ "getrandom 0.3.3",+]+[[package]]name = "rand_hc"version = "0.2.0"@@ -2975,22 +3178,32 @@ checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb"dependencies = ["base64 0.22.1","bytes",+ "cookie",+ "cookie_store",+ "encoding_rs","futures-core","futures-util",+ "h2","http","http-body","http-body-util","hyper",+ "hyper-rustls","hyper-util","js-sys","log",+ "mime","percent-encoding","pin-project-lite",+ "quinn",+ "rustls",+ "rustls-pki-types","serde","serde_json","serde_urlencoded","sync_wrapper","tokio",+ "tokio-rustls","tokio-util","tower","tower-http",@@ -3000,6 +3213,21 @@ dependencies = ["wasm-bindgen-futures","wasm-streams","web-sys",+ "webpki-roots",+]++[[package]]+name = "ring"+version = "0.17.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"+dependencies = [+ "cc",+ "cfg-if",+ "getrandom 0.2.16",+ "libc",+ "untrusted",+ "windows-sys 0.52.0",][[package]]@@ -3008,6 +3236,12 @@ version = "0.1.26"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"+[[package]]+name = "rustc-hash"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"+[[package]]name = "rustc_version"version = "0.4.1"@@ -3030,6 +3264,41 @@ dependencies = ["windows-sys 0.61.0",]+[[package]]+name = "rustls"+version = "0.23.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40"+dependencies = [+ "once_cell",+ "ring",+ "rustls-pki-types",+ "rustls-webpki",+ "subtle",+ "zeroize",+]++[[package]]+name = "rustls-pki-types"+version = "1.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79"+dependencies = [+ "web-time",+ "zeroize",+]++[[package]]+name = "rustls-webpki"+version = "0.103.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8572f3c2cb9934231157b45499fc41e1f58c589fdfb81a844ba873265e80f8eb"+dependencies = [+ "ring",+ "rustls-pki-types",+ "untrusted",+]+[[package]]name = "rustversion"version = "1.0.22"@@ -3464,6 +3733,12 @@ version = "0.11.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"+[[package]]+name = "subtle"+version = "2.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"+[[package]]name = "swift-rs"version = "1.0.7"@@ -3517,6 +3792,27 @@ dependencies = ["syn 2.0.106",]+[[package]]+name = "system-configuration"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"+dependencies = [+ "bitflags 2.9.4",+ "core-foundation 0.9.4",+ "system-configuration-sys",+]++[[package]]+name = "system-configuration-sys"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"+dependencies = [+ "core-foundation-sys",+ "libc",+]+[[package]]name = "system-deps"version = "6.2.2"@@ -3538,7 +3834,7 @@ checksum = "959469667dbcea91e5485fc48ba7dd6023face91bb0f1a14681a70f99847c3f7"dependencies = ["bitflags 2.9.4","block2 0.6.1",- "core-foundation",+ "core-foundation 0.10.1","core-graphics","crossbeam-channel","dispatch",@@ -3719,6 +4015,24 @@ dependencies = ["walkdir",]+[[package]]+name = "tauri-plugin-cors-fetch"+version = "4.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1bbb818e0e97f72dc9d353d38fa5799ed1dd4cf7371ff3195bd1231072d6fc2d"+dependencies = [+ "http",+ "once_cell",+ "reqwest",+ "serde",+ "serde_json",+ "tauri",+ "tauri-plugin",+ "thiserror 2.0.16",+ "tokio",+ "url",+]+[[package]]name = "tauri-plugin-opener"version = "2.5.0"@@ -3946,6 +4260,21 @@ dependencies = ["zerovec",]+[[package]]+name = "tinyvec"+version = "1.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"+dependencies = [+ "tinyvec_macros",+]++[[package]]+name = "tinyvec_macros"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"+[[package]]name = "tokio"version = "1.47.1"@@ -3960,9 +4289,31 @@ dependencies = ["pin-project-lite","slab","socket2",+ "tokio-macros","windows-sys 0.59.0",]+[[package]]+name = "tokio-macros"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.106",+]++[[package]]+name = "tokio-rustls"+version = "0.26.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"+dependencies = [+ "rustls",+ "tokio",+]+[[package]]name = "tokio-util"version = "0.7.16"@@ -4252,6 +4603,12 @@ version = "1.12.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"+[[package]]+name = "untrusted"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"+[[package]]name = "url"version = "2.5.7"@@ -4476,6 +4833,16 @@ dependencies = ["wasm-bindgen",]+[[package]]+name = "web-time"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"+dependencies = [+ "js-sys",+ "wasm-bindgen",+]+[[package]]name = "webkit2gtk"version = "2.0.1"@@ -4520,6 +4887,15 @@ dependencies = ["system-deps",]+[[package]]+name = "webpki-roots"+version = "1.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2"+dependencies = [+ "rustls-pki-types",+]+[[package]]name = "webview2-com"version = "0.38.0"@@ -4705,6 +5081,17 @@ dependencies = ["windows-link 0.1.3",]+[[package]]+name = "windows-registry"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e"+dependencies = [+ "windows-link 0.1.3",+ "windows-result 0.3.4",+ "windows-strings 0.4.2",+]+[[package]]name = "windows-result"version = "0.3.4"@@ -4750,6 +5137,15 @@ dependencies = ["windows-targets 0.42.2",]+[[package]]+name = "windows-sys"+version = "0.52.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"+dependencies = [+ "windows-targets 0.52.6",+]+[[package]]name = "windows-sys"version = "0.59.0"@@ -5212,6 +5608,12 @@ dependencies = ["synstructure",]+[[package]]+name = "zeroize"+version = "1.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"+[[package]]name = "zerotrie"version = "0.2.2"diff --git a/fincept-terminal-desktop/src-tauri/Cargo.toml b/fincept-terminal-desktop/src-tauri/Cargo.tomlindex c3c51b2f6..d965884d1 100644--- a/fincept-terminal-desktop/src-tauri/Cargo.toml+++ b/fincept-terminal-desktop/src-tauri/Cargo.toml@@ -18,8 +18,9 @@ crate-type = ["staticlib", "cdylib", "rlib"]tauri-build = { version = "2", features = [] }[dependencies]-tauri = { version = "2", features = [] }+tauri = { version = "2", features = ["devtools"] }tauri-plugin-opener = "2"+tauri-plugin-cors-fetch = "4"serde = { version = "1", features = ["derive"] }serde_json = "1"diff --git a/fincept-terminal-desktop/src-tauri/capabilities/default.json b/fincept-terminal-desktop/src-tauri/capabilities/default.jsonindex 4cdbf49a7..b9bab0afe 100644--- a/fincept-terminal-desktop/src-tauri/capabilities/default.json+++ b/fincept-terminal-desktop/src-tauri/capabilities/default.json@@ -5,6 +5,7 @@"windows": ["main"],"permissions": ["core:default",- "opener:default"+ "opener:default",+ "cors-fetch:default"]}diff --git a/fincept-terminal-desktop/src-tauri/src/lib.rs b/fincept-terminal-desktop/src-tauri/src/lib.rsindex 4a277ef35..9d3670262 100644--- a/fincept-terminal-desktop/src-tauri/src/lib.rs+++ b/fincept-terminal-desktop/src-tauri/src/lib.rs@@ -8,6 +8,7 @@ fn greet(name: &str) -> String {pub fn run() {tauri::Builder::default().plugin(tauri_plugin_opener::init())+ .plugin(tauri_plugin_cors_fetch::init()).invoke_handler(tauri::generate_handler![greet]).run(tauri::generate_context!()).expect("error while running tauri application");diff --git a/fincept-terminal-desktop/src-tauri/tauri.conf.json b/fincept-terminal-desktop/src-tauri/tauri.conf.jsonindex e31fefec6..c668b6b54 100644--- a/fincept-terminal-desktop/src-tauri/tauri.conf.json+++ b/fincept-terminal-desktop/src-tauri/tauri.conf.json@@ -10,6 +10,7 @@"frontendDist": "../dist"},"app": {+ "withGlobalTauri": true,"windows": [{"title": "Fincept Terminal",diff --git a/fincept-terminal-desktop/src/App.tsx b/fincept-terminal-desktop/src/App.tsxindex 3e8ea2de5..e65cb3408 100644--- a/fincept-terminal-desktop/src/App.tsx+++ b/fincept-terminal-desktop/src/App.tsx@@ -107,15 +107,15 @@ const App: React.FC = () => {const sessionId = urlParams.get('session_id');const paymentId = urlParams.get('payment_id');- // If we have payment parameters, go directly to success screen- if ((sessionId || paymentId) && session?.authenticated) {+ // If we have payment parameters, go directly to success screen (don't wait for session)+ if (sessionId || paymentId) {console.log('Payment success URL detected, redirecting to payment success screen');setCurrentScreen('paymentSuccess');// Clear URL parameters to prevent issues on refreshwindow.history.replaceState({}, document.title, window.location.pathname);return;}- }, [session?.authenticated]);+ }, []); // Run only once on mount// Auto-navigation based on authentication stateuseEffect(() => {@@ -136,7 +136,7 @@ const App: React.FC = () => {// Check if user is on free plan and needs to see pricingconst isFreePlan = session.user_info?.account_type === 'free';- const hasActiveSubscription = session.subscription?.has_subscription;+ const hasActiveSubscription = (session.subscription as any)?.data?.has_subscription || session.subscription?.has_subscription;// Show pricing if:// 1. User is registered with free account type AND@@ -162,15 +162,17 @@ const App: React.FC = () => {}} else {console.log('Session not authenticated, staying on auth screens');+ // Don't redirect if on payment success screen - let it handle authentication internallyif (currentScreen === 'dashboard' ||currentScreen === 'pricing' ||- currentScreen === 'paymentProcessing' ||- currentScreen === 'paymentSuccess') {+ currentScreen === 'paymentProcessing') {setCurrentScreen('login');}- // Reset flags when user logs out- setHasChosenFreePlan(false);- setCameFromLogin(false);+ // Don't reset flags or redirect from paymentSuccess - it needs to complete first+ if (currentScreen !== 'paymentSuccess') {+ setHasChosenFreePlan(false);+ setCameFromLogin(false);+ }}}}, [session, isLoading, currentScreen, cameFromLogin, hasChosenFreePlan]);diff --git a/fincept-terminal-desktop/src/components/auth/PricingScreen.tsx b/fincept-terminal-desktop/src/components/auth/PricingScreen.tsxindex 85e1a220c..f3b4dc6af 100644--- a/fincept-terminal-desktop/src/components/auth/PricingScreen.tsx+++ b/fincept-terminal-desktop/src/components/auth/PricingScreen.tsx@@ -28,7 +28,7 @@ const PricingScreen: React.FC<PricingScreenProps> = ({// Prevent multiple simultaneous requestsconst loadingRef = useRef(false);- const retryTimeoutRef = useRef<NodeJS.Timeout>();+ const retryTimeoutRef = useRef<NodeJS.Timeout | undefined>(undefined);// Load plans on component mount - with debouncinguseEffect(() => {@@ -128,11 +128,11 @@ const handleSelectPlan = async () => {// DEBUG: Log the exact structureconsole.log('result.data structure:', JSON.stringify(result.data, null, 2));- console.log('checkout_url direct access:', result.data.checkout_url);- console.log('checkout_url via data.data:', result.data.data?.checkout_url);+ console.log('checkout_url direct access:', (result.data as any).checkout_url);+ console.log('checkout_url via data.data:', (result.data as any).data?.checkout_url);// Try different data access patterns- const checkoutUrl = result.data.checkout_url || result.data.data?.checkout_url;+ const checkoutUrl = (result.data as any).checkout_url || (result.data as any).data?.checkout_url;if (checkoutUrl) {console.log('Found checkout URL:', checkoutUrl);diff --git a/fincept-terminal-desktop/src/components/auth/RegisterScreen.tsx b/fincept-terminal-desktop/src/components/auth/RegisterScreen.tsxindex 0cce3234d..293bd02f8 100644--- a/fincept-terminal-desktop/src/components/auth/RegisterScreen.tsx+++ b/fincept-terminal-desktop/src/components/auth/RegisterScreen.tsx@@ -233,9 +233,9 @@ const RegisterScreen: React.FC<RegisterScreenProps> = ({ onNavigate }) => {// Step 1: Registration Formif (step === 'form') {return (- <div className="bg-zinc-900/90 backdrop-blur-sm border border-zinc-700 rounded-lg p-6 w-full max-w-sm mx-4 shadow-2xl">- <div className="mb-6">- <div className="flex items-center mb-3">+ <div className="bg-zinc-900/90 backdrop-blur-sm border border-zinc-700 rounded-lg p-6 w-full max-w-lg mx-4 shadow-2xl">+ <div className="mb-5">+ <div className="flex items-center mb-2.5"><buttononClick={() => onNavigate('login')}className="text-zinc-400 hover:text-white transition-colors mr-3"@@ -244,12 +244,12 @@ const RegisterScreen: React.FC<RegisterScreenProps> = ({ onNavigate }) => {</button><h2 className="text-white text-2xl font-light">Create Account</h2></div>- <p className="text-zinc-400 text-xs leading-5">+ <p className="text-zinc-400 text-sm leading-5">Join Fincept to access professional financial terminal and analytics platform.</p></div>- <form onSubmit={handleRegister} className="space-y-4">+ <form onSubmit={handleRegister} className="space-y-3"><div className="grid grid-cols-2 gap-3"><div className="space-y-1"><Label htmlFor="firstName" className="text-white text-xs">@@ -316,7 +316,7 @@ const RegisterScreen: React.FC<RegisterScreenProps> = ({ onNavigate }) => {<buttontype="button"onClick={() => setIsCountryDropdownOpen(!isCountryDropdownOpen)}- className="bg-zinc-800 border border-zinc-600 text-white h-9 px-2 text-sm rounded flex items-center gap-1 hover:bg-zinc-700 focus:border-zinc-500 focus:ring-1 focus:ring-zinc-500 min-w-[70px]"+ className="bg-zinc-800 border border-zinc-600 text-white h-9 px-2.5 text-sm rounded flex items-center gap-1 hover:bg-zinc-700 focus:border-zinc-500 focus:ring-1 focus:ring-zinc-500 min-w-[75px]"disabled={isLoading}><span className="text-base">{selectedCountry?.flag || "🌍"}</span>@@ -387,42 +387,44 @@ const RegisterScreen: React.FC<RegisterScreenProps> = ({ onNavigate }) => {</div></div>- <div className="space-y-1">- <Label htmlFor="password" className="text-white text-xs">- Password *- </Label>- <div className="relative">- <Lock className="absolute left-2.5 top-1/2 transform -translate-y-1/2 h-3.5 w-3.5 text-zinc-400" />- <Input- id="password"- type="password"- placeholder="Create password"- value={formData.password}- onChange={(e) => handleChange("password", e.target.value)}- className="bg-zinc-800 border-zinc-600 text-white placeholder-zinc-500 pl-9 py-2 h-9 text-sm focus:border-zinc-500 focus:ring-1 focus:ring-zinc-500"- disabled={isLoading}- required- minLength={8}- />+ <div className="grid grid-cols-2 gap-3">+ <div className="space-y-1">+ <Label htmlFor="password" className="text-white text-xs">+ Password *+ </Label>+ <div className="relative">+ <Lock className="absolute left-2.5 top-1/2 transform -translate-y-1/2 h-3.5 w-3.5 text-zinc-400" />+ <Input+ id="password"+ type="password"+ placeholder="Create password"+ value={formData.password}+ onChange={(e) => handleChange("password", e.target.value)}+ className="bg-zinc-800 border-zinc-600 text-white placeholder-zinc-500 pl-9 py-2 h-9 text-sm focus:border-zinc-500 focus:ring-1 focus:ring-zinc-500"+ disabled={isLoading}+ required+ minLength={8}+ />+ </div></div>- </div>- <div className="space-y-1">- <Label htmlFor="confirmPassword" className="text-white text-xs">- Confirm Password *- </Label>- <div className="relative">- <Lock className="absolute left-2.5 top-1/2 transform -translate-y-1/2 h-3.5 w-3.5 text-zinc-400" />- <Input- id="confirmPassword"- type="password"- placeholder="Confirm password"- value={formData.confirmPassword}- onChange={(e) => handleChange("confirmPassword", e.target.value)}- className="bg-zinc-800 border-zinc-600 text-white placeholder-zinc-500 pl-9 py-2 h-9 text-sm focus:border-zinc-500 focus:ring-1 focus:ring-zinc-500"- disabled={isLoading}- required- />+ <div className="space-y-1">+ <Label htmlFor="confirmPassword" className="text-white text-xs">+ Confirm Password *+ </Label>+ <div className="relative">+ <Lock className="absolute left-2.5 top-1/2 transform -translate-y-1/2 h-3.5 w-3.5 text-zinc-400" />+ <Input+ id="confirmPassword"+ type="password"+ placeholder="Confirm password"+ value={formData.confirmPassword}+ onChange={(e) => handleChange("confirmPassword", e.target.value)}+ className="bg-zinc-800 border-zinc-600 text-white placeholder-zinc-500 pl-9 py-2 h-9 text-sm focus:border-zinc-500 focus:ring-1 focus:ring-zinc-500"+ disabled={isLoading}+ required+ />+ </div></div></div>@@ -435,7 +437,7 @@ const RegisterScreen: React.FC<RegisterScreenProps> = ({ onNavigate }) => {<div className="flex justify-end pt-2"><Buttontype="submit"- className="bg-zinc-700 hover:bg-zinc-600 text-white px-6 py-1.5 text-sm font-normal transition-colors disabled:opacity-50"+ className="bg-zinc-700 hover:bg-zinc-600 text-white px-6 py-2 text-sm font-normal transition-colors disabled:opacity-50"disabled={isLoading}>{isLoading ? (@@ -448,7 +450,7 @@ const RegisterScreen: React.FC<RegisterScreenProps> = ({ onNavigate }) => {</div></form>- <div className="mt-5 pt-4 border-t border-zinc-700 text-center">+ <div className="mt-4 pt-4 border-t border-zinc-700 text-center"><p className="text-zinc-400 text-xs">Already have an account?{" "}<buttondiff --git a/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx b/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsxindex 60beba0d8..70d292cfd 100644--- a/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx+++ b/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx@@ -27,13 +27,13 @@ import MaritimeTab from '@/components/tabs/MaritimeTab';import SettingsTab from '@/components/tabs/SettingsTab';// Dropdown Menu Component-const DropdownMenu = ({ label, items, onItemClick }) => {+const DropdownMenu = ({ label, items, onItemClick }: { label: string; items: any[]; onItemClick: (item: any) => void }) => {const [isOpen, setIsOpen] = useState(false);- const menuRef = useRef(null);+ const menuRef = useRef<HTMLDivElement>(null);useEffect(() => {- const handleClickOutside = (event) => {- if (menuRef.current && !menuRef.current.contains(event.target)) {+ const handleClickOutside = (event: MouseEvent) => {+ if (menuRef.current && !menuRef.current.contains(event.target as Node)) {setIsOpen(false);}};@@ -62,7 +62,7 @@ const DropdownMenu = ({ label, items, onItemClick }) => {zIndex: 1000,boxShadow: '0 2px 8px rgba(0,0,0,0.5)'}}>- {items.map((item, index) => (+ {items.map((item: any, index: number) => (<divkey={index}style={{@@ -74,13 +74,13 @@ const DropdownMenu = ({ label, items, onItemClick }) => {}}onMouseEnter={(e) => {if (!item.disabled) {- e.target.style.backgroundColor = '#404040';- e.target.style.color = '#fff';+ (e.target as HTMLDivElement).style.backgroundColor = '#404040';+ (e.target as HTMLDivElement).style.color = '#fff';}}}onMouseLeave={(e) => {- e.target.style.backgroundColor = 'transparent';- e.target.style.color = item.disabled ? '#666' : '#a3a3a3';+ (e.target as HTMLDivElement).style.backgroundColor = 'transparent';+ (e.target as HTMLDivElement).style.color = item.disabled ? '#666' : '#a3a3a3';}}onClick={() => {if (!item.disabled && onItemClick) {@@ -154,11 +154,11 @@ export default function FinxeptTerminal() {} else if (session.user_type === 'registered') {const username = session.user_info?.username || session.user_info?.email || 'User';const accountType = session.user_info?.account_type || 'free';- const hasSubscription = session.subscription?.has_subscription;+ const hasSubscription = (session.subscription as any)?.data?.has_subscription || session.subscription?.has_subscription;// Show account type badgeif (hasSubscription) {- const planName = session.subscription?.subscription?.plan?.name || accountType;+ const planName = (session.subscription as any)?.data?.subscription?.plan?.name || session.subscription?.subscription?.plan?.name || accountType;return `👤 ${username} | 📦 ${planName} | ✅ Active`;} else if (accountType === 'free') {return `👤 ${username} | 📦 Free Plan`;@@ -175,7 +175,7 @@ export default function FinxeptTerminal() {document.documentElement.requestFullscreen().then(() => {setIsFullscreen(true);setStatusMessage("Entered fullscreen mode");- }).catch(err => {+ }).catch(() => {setStatusMessage("Failed to enter fullscreen mode");});} else {@@ -189,7 +189,7 @@ export default function FinxeptTerminal() {setTimeout(() => setStatusMessage(""), 3000);};- const handleMenuAction = async (item) => {+ const handleMenuAction = async (item: any) => {setStatusMessage(`${item.label} clicked`);// Handle specific actions@@ -353,12 +353,12 @@ export default function FinxeptTerminal() {borderRadius: '2px'}}onMouseEnter={(e) => {- e.target.style.backgroundColor = '#404040';- e.target.style.color = '#fff';+ (e.target as HTMLButtonElement).style.backgroundColor = '#404040';+ (e.target as HTMLButtonElement).style.color = '#fff';}}onMouseLeave={(e) => {- e.target.style.backgroundColor = 'transparent';- e.target.style.color = '#a3a3a3';+ (e.target as HTMLButtonElement).style.backgroundColor = 'transparent';+ (e.target as HTMLButtonElement).style.color = '#a3a3a3';}}title={isFullscreen ? 'Exit Fullscreen (F11)' : 'Enter Fullscreen (F11)'}>diff --git a/fincept-terminal-desktop/src/components/payment/PaymentProcessingScreen.tsx b/fincept-terminal-desktop/src/components/payment/PaymentProcessingScreen.tsxindex 0b4f9de10..c626188b1 100644--- a/fincept-terminal-desktop/src/components/payment/PaymentProcessingScreen.tsx+++ b/fincept-terminal-desktop/src/components/payment/PaymentProcessingScreen.tsx@@ -7,7 +7,6 @@ import {CheckCircle,XCircle,Clock,- ExternalLink,RefreshCw,AlertTriangle,CreditCard,@@ -37,8 +36,8 @@ const PaymentProcessingScreen: React.FC<PaymentProcessingScreenProps> = ({const [paymentData, setPaymentData] = useState<any>(null);const [error, setError] = useState<string>('');- const intervalRef = useRef<NodeJS.Timeout>();- const timeoutRef = useRef<NodeJS.Timeout>();+ const intervalRef = useRef<NodeJS.Timeout | undefined>(undefined);+ const timeoutRef = useRef<NodeJS.Timeout | undefined>(undefined);const maxChecks = 60; // Check for 5 minutes (every 5 seconds)const checkInterval = 5000; // 5 secondsconst maxWaitTime = 300000; // 5 minutesdiff --git a/fincept-terminal-desktop/src/components/payment/PaymentSuccessScreen.tsx b/fincept-terminal-desktop/src/components/payment/PaymentSuccessScreen.tsxindex 5507e0ef9..625e8e466 100644--- a/fincept-terminal-desktop/src/components/payment/PaymentSuccessScreen.tsx+++ b/fincept-terminal-desktop/src/components/payment/PaymentSuccessScreen.tsx@@ -1,24 +1,20 @@// File: src/components/payment/PaymentSuccessScreen.tsx-// Payment success screen that confirms completed payment and activates subscription+// Payment success screen with confetti celebration and auto-redirectimport React, { useState, useEffect } from 'react';+import Confetti from 'react-confetti';import { Button } from "@/components/ui/button";import {CheckCircle,Download,- Mail,- Calendar,- CreditCard,ArrowRight,- Star,- Shield,- Zap,+ Loader2,AlertCircle,- Loader2+ Sparkles} from "lucide-react";import { Screen } from '../../App';import { useAuth } from '@/contexts/AuthContext';-import { PaymentApiService, PaymentUtils } from '@/services/paymentApi';+import { PaymentApiService } from '@/services/paymentApi';interface PaymentSuccessScreenProps {onNavigate: (screen: Screen) => void;@@ -26,7 +22,6 @@ interface PaymentSuccessScreenProps {}const PaymentSuccessScreen: React.FC<PaymentSuccessScreenProps> = ({- onNavigate,onComplete}) => {const { session, refreshUserData } = useAuth();@@ -34,8 +29,28 @@ const PaymentSuccessScreen: React.FC<PaymentSuccessScreenProps> = ({const [paymentData, setPaymentData] = useState<any>(null);const [subscriptionData, setSubscriptionData] = useState<any>(null);const [error, setError] = useState<string>('');+ const [countdown, setCountdown] = useState(5);+ const [showConfetti, setShowConfetti] = useState(true);+ const [windowSize, setWindowSize] = useState({ width: window.innerWidth, height: window.innerHeight });- // Extract payment parameters from URL+ // Handle window resize for confetti+ useEffect(() => {+ const handleResize = () => {+ setWindowSize({ width: window.innerWidth, height: window.innerHeight });+ };+ window.addEventListener('resize', handleResize);+ return () => window.removeEventListener('resize', handleResize);+ }, []);++ // Stop confetti after 5 seconds+ useEffect(() => {+ const timer = setTimeout(() => {+ setShowConfetti(false);+ }, 5000);+ return () => clearTimeout(timer);+ }, []);++ // Extract payment parameters from URL and process payment - RUN ONLY ONCEuseEffect(() => {const urlParams = new URLSearchParams(window.location.search);const sessionId = urlParams.get('session_id');@@ -50,24 +65,27 @@ const PaymentSuccessScreen: React.FC<PaymentSuccessScreenProps> = ({const handlePaymentSuccess = async () => {if (!session?.api_key) {- setError('Authentication required');- setIsLoading(false);- return;+ console.log('Waiting for session to load...');+ return; // Will retry when session becomes available}try {- // Handle payment success with API- const paymentResult = await PaymentApiService.handlePaymentSuccess(- session.api_key,- sessionId || undefined,- paymentId || undefined- );-- if (paymentResult.success && paymentResult.data) {- console.log('Payment success confirmed:', paymentResult.data);- setPaymentData(paymentResult.data);- } else {- console.log('Payment success API call failed, proceeding with subscription check');+ console.log('Processing payment success...');++ // Handle payment success with API (optional - backend may have already processed via webhook)+ if (sessionId || paymentId) {+ const paymentResult = await PaymentApiService.handlePaymentSuccess(+ session.api_key,+ sessionId || undefined,+ paymentId || undefined+ );++ if (paymentResult.success && paymentResult.data) {+ console.log('Payment success confirmed:', paymentResult.data);+ setPaymentData(paymentResult.data);+ } else {+ console.log('Payment success API call failed, proceeding with subscription check');+ }}// Get updated subscription data@@ -79,6 +97,8 @@ const PaymentSuccessScreen: React.FC<PaymentSuccessScreenProps> = ({// Refresh user data in contextawait refreshUserData();++ console.log('Payment processing complete');} else {throw new Error('Failed to retrieve subscription data');}@@ -92,7 +112,19 @@ const PaymentSuccessScreen: React.FC<PaymentSuccessScreenProps> = ({};handlePaymentSuccess();- }, [session?.api_key, refreshUserData]);+ }, [session?.api_key]); // Only depend on api_key, run when it becomes available++ // Countdown and auto-redirect+ useEffect(() => {+ if (!isLoading && !error && countdown > 0) {+ const timer = setTimeout(() => {+ setCountdown(countdown - 1);+ }, 1000);+ return () => clearTimeout(timer);+ } else if (countdown === 0) {+ onComplete();+ }+ }, [isLoading, error, countdown, onComplete]);const handleContinueToDashboard = () => {onComplete();@@ -100,30 +132,26 @@ const PaymentSuccessScreen: React.FC<PaymentSuccessScreenProps> = ({const handleDownloadReceipt = () => {if (paymentData) {- const receiptData = PaymentUtils.generateReceiptData(paymentData);-- // Create receipt contentconst receiptContent = `FINCEPT API - PAYMENT RECEIPT============================-Receipt ID: ${receiptData.receiptId}-Date: ${receiptData.date}-Description: ${receiptData.description}-Amount: ${receiptData.amount}-Status: ${receiptData.status}+Receipt ID: ${paymentData.payment_uuid || 'N/A'}+Date: ${new Date().toLocaleDateString()}+Description: ${subscriptionData?.subscription?.plan?.name || 'Subscription'} Plan+Amount: $${paymentData.amount || subscriptionData?.subscription?.plan?.price || 0}+Status: CompletedThank you for your subscription!Visit: https://fincept.inSupport: [email protected]`.trim();- // Download as text fileconst blob = new Blob([receiptContent], { type: 'text/plain' });const url = URL.createObjectURL(blob);const link = document.createElement('a');link.href = url;- link.download = `fincept-receipt-${receiptData.receiptId}.txt`;+ link.download = `fincept-receipt-${Date.now()}.txt`;document.body.appendChild(link);link.click();document.body.removeChild(link);@@ -133,11 +161,13 @@ Support: [email protected]if (isLoading) {return (- <div className="bg-zinc-900/95 backdrop-blur-sm border border-zinc-700 rounded-xl p-8 w-full max-w-md mx-auto shadow-2xl">- <div className="text-center">- <Loader2 className="w-8 h-8 animate-spin text-blue-500 mx-auto mb-4" />- <h2 className="text-white text-xl font-semibold mb-2">Confirming Payment</h2>- <p className="text-zinc-400 text-sm">Activating your subscription...</p>+ <div className="flex items-center justify-center min-h-[400px]">+ <div className="bg-zinc-900/95 backdrop-blur-sm border border-zinc-700 rounded-xl p-8 w-full max-w-md mx-auto shadow-2xl">+ <div className="text-center">+ <Loader2 className="w-12 h-12 animate-spin text-blue-500 mx-auto mb-4" />+ <h2 className="text-white text-xl font-semibold mb-2">Confirming Payment</h2>+ <p className="text-zinc-400 text-sm">Activating your subscription...</p>+ </div></div></div>);@@ -145,19 +175,19 @@ Support: [email protected]if (error) {return (- <div className="bg-zinc-900/95 backdrop-blur-sm border border-zinc-700 rounded-xl p-8 w-full max-w-md mx-auto shadow-2xl">- <div className="text-center">- <AlertCircle className="w-8 h-8 text-red-500 mx-auto mb-4" />- <h2 className="text-white text-xl font-semibold mb-2">Payment Confirmation Error</h2>- <p className="text-zinc-400 text-sm mb-6">{error}</p>- <div className="space-y-2">+ <div className="flex items-center justify-center min-h-[400px]">+ <div className="bg-zinc-900/95 backdrop-blur-sm border border-zinc-700 rounded-xl p-8 w-full max-w-md mx-auto shadow-2xl">+ <div className="text-center">+ <AlertCircle className="w-12 h-12 text-red-500 mx-auto mb-4" />+ <h2 className="text-white text-xl font-semibold mb-2">Payment Confirmation Error</h2>+ <p className="text-zinc-400 text-sm mb-6">{error}</p><ButtononClick={handleContinueToDashboard}className="w-full bg-blue-600 hover:bg-blue-500 text-white">Continue to Dashboard</Button>- <p className="text-xs text-zinc-500">+ <p className="text-xs text-zinc-500 mt-3">Check your account dashboard for subscription status</p></div>@@ -167,150 +197,103 @@ Support: [email protected]}const subscription = subscriptionData?.subscription;- const planName = subscription?.plan?.name || 'Subscription';+ const planName = subscription?.plan?.name || 'Premium';const planPrice = subscription?.plan?.price || 0;- const daysRemaining = subscription?.days_remaining || 0;return (- <div className="bg-zinc-900/95 backdrop-blur-sm border border-zinc-700 rounded-xl p-8 w-full max-w-lg mx-auto shadow-2xl">- <div className="text-center">- {/* Success Icon */}- <div className="mb-6">- <CheckCircle className="w-12 h-12 text-green-500 mx-auto" />- </div>-- {/* Success Title */}- <h2 className="text-2xl font-bold text-white mb-2">- Payment Successful!- </h2>-- <p className="text-zinc-400 text-sm mb-6">- Your subscription has been activated and you now have access to all premium features.- </p>-- {/* Subscription Details */}- <div className="bg-gradient-to-r from-green-900/20 to-blue-900/20 border border-green-900/50 rounded-lg p-6 mb-6">- <div className="text-center space-y-3">- <div className="flex items-center justify-center space-x-2">- <Star className="w-5 h-5 text-yellow-500" />- <h3 className="text-lg font-semibold text-white">{planName} Plan</h3>- </div>-- <div className="text-2xl font-bold text-green-400">- {PaymentUtils.formatCurrency(planPrice)}/month+ <>+ {/* Confetti Animation */}+ {showConfetti && (+ <Confetti+ width={windowSize.width}+ height={windowSize.height}+ recycle={false}+ numberOfPieces={500}+ gravity={0.3}+ />+ )}++ <div className="flex items-center justify-center min-h-[400px] p-4">+ <div className="bg-gradient-to-br from-zinc-900/95 to-zinc-800/95 backdrop-blur-sm border border-green-500/30 rounded-xl p-6 sm:p-8 w-full max-w-lg mx-auto shadow-2xl">++ {/* Success Icon with Animation */}+ <div className="text-center mb-6">+ <div className="relative inline-block">+ <CheckCircle className="w-16 h-16 sm:w-20 sm:h-20 text-green-500 mx-auto animate-bounce" />+ <Sparkles className="w-6 h-6 text-yellow-400 absolute -top-2 -right-2 animate-pulse" /></div>+ </div>- <div className="grid grid-cols-2 gap-4 text-sm">- <div className="text-center">- <div className="text-zinc-400">API Calls</div>- <div className="text-white font-medium">- {subscription?.usage?.api_calls_limit === 'unlimited'- ? 'Unlimited'- : `${subscription?.usage?.api_calls_limit?.toLocaleString()}/month`- }- </div>+ {/* Success Title */}+ <h2 className="text-2xl sm:text-3xl font-bold text-white mb-2 text-center">+ Payment Successful!+ </h2>++ <p className="text-zinc-300 text-sm sm:text-base mb-6 text-center">+ 🎉 Your subscription is now active!+ </p>++ {/* Plan Details Card */}+ <div className="bg-gradient-to-r from-green-900/30 to-blue-900/30 border border-green-500/50 rounded-lg p-4 sm:p-5 mb-6">+ <div className="text-center space-y-2">+ <h3 className="text-lg sm:text-xl font-semibold text-white">{planName} Plan</h3>+ <div className="text-3xl sm:text-4xl font-bold text-green-400">+ ${planPrice}<span className="text-lg text-zinc-400">/month</span></div>- <div className="text-center">- <div className="text-zinc-400">Billing Period</div>- <div className="text-white font-medium">{daysRemaining} days</div>++ <div className="flex flex-wrap justify-center gap-2 mt-3 text-xs sm:text-sm">+ <span className="bg-green-500/20 text-green-300 px-3 py-1 rounded-full">+ ✓ Unlimited API Calls+ </span>+ <span className="bg-blue-500/20 text-blue-300 px-3 py-1 rounded-full">+ ✓ Priority Support+ </span>+ <span className="bg-purple-500/20 text-purple-300 px-3 py-1 rounded-full">+ ✓ Premium Features+ </span></div></div></div>- </div>- {/* Features Activated */}- <div className="bg-zinc-800/50 rounded-lg p-4 mb-6">- <h4 className="text-white font-medium mb-3 text-sm">Features Activated</h4>- <div className="grid grid-cols-2 gap-3 text-xs">- <div className="flex items-center space-x-2">- <Zap className="w-3 h-3 text-blue-400" />- <span className="text-zinc-300">Real-time Data</span>- </div>- <div className="flex items-center space-x-2">- <Shield className="w-3 h-3 text-green-400" />- <span className="text-zinc-300">Priority Support</span>- </div>- <div className="flex items-center space-x-2">- <Calendar className="w-3 h-3 text-purple-400" />- <span className="text-zinc-300">Advanced Analytics</span>- </div>- <div className="flex items-center space-x-2">- <CreditCard className="w-3 h-3 text-yellow-400" />- <span className="text-zinc-300">Custom Dashboards</span>- </div>+ {/* Auto-redirect countdown */}+ <div className="text-center mb-6">+ <p className="text-zinc-400 text-sm">+ Redirecting to dashboard in <span className="text-green-400 font-bold">{countdown}s</span>+ </p></div>- </div>- {/* Action Buttons */}- <div className="space-y-3">- <Button- onClick={handleContinueToDashboard}- className="w-full bg-green-600 hover:bg-green-500 text-white font-medium"- >- <ArrowRight className="w-4 h-4 mr-2" />- Start Using Fincept API- </Button>-- <div className="flex space-x-2">+ {/* Action Buttons */}+ <div className="space-y-3"><Button- onClick={handleDownloadReceipt}- variant="outline"- className="flex-1 border-zinc-600 text-zinc-300 hover:bg-zinc-800"- disabled={!paymentData}+ onClick={handleContinueToDashboard}+ className="w-full bg-green-600 hover:bg-green-500 text-white font-semibold py-3 text-base">- <Download className="w-4 h-4 mr-2" />- Receipt+ <ArrowRight className="w-5 h-5 mr-2" />+ Continue to Dashboard Now</Button><Button- onClick={() => {- // Email support (could integrate with email service)- window.open('mailto:[email protected]?subject=New Subscription - Thank You', '_blank');- }}+ onClick={handleDownloadReceipt}variant="outline"- className="flex-1 border-zinc-600 text-zinc-300 hover:bg-zinc-800"+ className="w-full border-zinc-600 text-zinc-300 hover:bg-zinc-800 py-3"+ disabled={!paymentData && !subscriptionData}>- <Mail className="w-4 h-4 mr-2" />- Support+ <Download className="w-4 h-4 mr-2" />+ Download Receipt</Button></div>- </div>- {/* Next Steps */}- <div className="mt-6 pt-4 border-t border-zinc-700/50">- <h4 className="text-white font-medium mb-2 text-sm">What's Next?</h4>- <div className="text-xs text-zinc-400 space-y-1 text-left">- <div className="flex items-start space-x-2">- <div className="w-1 h-1 bg-blue-400 rounded-full mt-2 flex-shrink-0" />- <span>Explore your new dashboard with real-time market data</span>- </div>- <div className="flex items-start space-x-2">- <div className="w-1 h-1 bg-blue-400 rounded-full mt-2 flex-shrink-0" />- <span>Set up custom alerts and watchlists</span>- </div>- <div className="flex items-start space-x-2">- <div className="w-1 h-1 bg-blue-400 rounded-full mt-2 flex-shrink-0" />- <span>Access premium API endpoints</span>+ {/* Payment ID */}+ {paymentData?.payment_uuid && (+ <div className="mt-6 pt-4 border-t border-zinc-700/50 text-center">+ <p className="text-xs text-zinc-500">+ Payment ID: {paymentData.payment_uuid}+ </p></div>- <div className="flex items-start space-x-2">- <div className="w-1 h-1 bg-blue-400 rounded-full mt-2 flex-shrink-0" />- <span>Get priority support when you need help</span>- </div>- </div>+ )}</div>-- {/* Payment Details */}- {paymentData && (- <div className="mt-4 pt-3 border-t border-zinc-700/50">- <div className="text-xs text-zinc-500 space-y-1">- <div>Payment ID: {paymentData.payment_uuid}</div>- <div>Amount: {PaymentUtils.formatCurrency(paymentData.amount || planPrice)}</div>- <div>Date: {new Date().toLocaleDateString()}</div>- </div>- </div>- )}</div>- </div>+ </>);};diff --git a/fincept-terminal-desktop/src/components/tabs/AnalyticsTab.tsx b/fincept-terminal-desktop/src/components/tabs/AnalyticsTab.tsxindex bb6ab3293..65b99840e 100644--- a/fincept-terminal-desktop/src/components/tabs/AnalyticsTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/AnalyticsTab.tsx@@ -409,7 +409,7 @@ const AnalyticsTab: React.FC = () => {<XAxis dataKey="stock" stroke={BLOOMBERG_WHITE} fontSize={8} /><YAxis stroke={BLOOMBERG_WHITE} fontSize={8} /><Tooltip contentStyle={{ backgroundColor: BLOOMBERG_DARK_BG, border: `1px solid ${BLOOMBERG_GRAY}`, fontSize: '9px' }} />- <Bar dataKey="momentum" fill={(entry) => entry.momentum > 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED} />+ <Bar dataKey="momentum" fill={BLOOMBERG_GREEN} /></BarChart></ResponsiveContainer></ChartBox>@@ -542,7 +542,7 @@ const AnalyticsTab: React.FC = () => {<XAxis type="number" stroke={BLOOMBERG_WHITE} fontSize={8} /><YAxis type="category" dataKey="factor" stroke={BLOOMBERG_WHITE} fontSize={8} /><Tooltip contentStyle={{ backgroundColor: BLOOMBERG_DARK_BG, border: `1px solid ${BLOOMBERG_GRAY}`, fontSize: '9px' }} />- <Bar dataKey="contribution" fill={(entry) => entry.contribution > 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED} />+ <Bar dataKey="contribution" fill={BLOOMBERG_GREEN} /></BarChart></ResponsiveContainer></ChartBox>diff --git a/fincept-terminal-desktop/src/components/tabs/DBnomicsTab.tsx b/fincept-terminal-desktop/src/components/tabs/DBnomicsTab.tsxindex 6fd8c1f70..cb5c8e239 100644--- a/fincept-terminal-desktop/src/components/tabs/DBnomicsTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/DBnomicsTab.tsx@@ -257,14 +257,14 @@ export default function DBnomicsTab() {if (seriesArray.length === 0) return null;const w = compact ? '100%' : 800;- const h = compact ? 240 : 400;+ const h: number = compact ? 240 : 400;const ml = 60;const mr = 20;const mt = 20;const mb = 50;// For compact view, calculate width dynamically- const actualWidth = compact ? 380 : 800;+ const actualWidth: number = compact ? 380 : 800;const pw = actualWidth - ml - mr;const ph = h - mt - mb;@@ -302,7 +302,7 @@ export default function DBnomicsTab() {<g key={sIdx}>{sorted.map((obs, idx) => {const x = ml + (pw * idx) / (sorted.length - 1 || 1);- const y = h - mb - (ph * ((obs.value - yMin) / yRange));+ const y = h - mb - (ph * ((Number(obs.value) - yMin) / yRange));const barWidth = pw / sorted.length * 0.8;if (chartType === 'line' || chartType === 'area') {@@ -310,11 +310,15 @@ export default function DBnomicsTab() {<g key={idx}>{chartType === 'area' && idx === 0 && (<polygon- points={sorted.map((o, i) => {- const xi = ml + (pw * i) / (sorted.length - 1 || 1);- const yi = h - mb - (ph * ((o.value - yMin) / yRange));- return `${xi},${yi}`;- }).join(' ') + ` ${w - mr},${h - mb} ${ml},${h - mb}`}+ points={(() => {+ const points = sorted.map((o, i) => {+ const xi = ml + (pw * i) / (sorted.length - 1 || 1);+ const oValue = typeof o.value === 'number' ? o.value : Number(o.value);+ const yi = h - mb - (ph * ((oValue - yMin) / yRange));+ return `${xi},${yi}`;+ }).join(' ');+ return `${points} ${actualWidth - mr},${h - mb} ${ml},${h - mb}`;+ })()}fill={series.color}opacity="0.2"/>@@ -325,7 +329,7 @@ export default function DBnomicsTab() {x1={x}y1={y}x2={ml + (pw * (idx + 1)) / (sorted.length - 1 || 1)}- y2={h - mb - (ph * ((sorted[idx + 1].value - yMin) / yRange))}+ y2={h - mb - (ph * ((Number(sorted[idx + 1].value) - yMin) / yRange))}stroke={series.color}strokeWidth="1.5"/>diff --git a/fincept-terminal-desktop/src/components/tabs/MaritimeTab.tsx b/fincept-terminal-desktop/src/components/tabs/MaritimeTab.tsxindex 2b9f813ed..b90153a59 100644--- a/fincept-terminal-desktop/src/components/tabs/MaritimeTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/MaritimeTab.tsx@@ -68,7 +68,7 @@ export default function MaritimeTab() {];const addPreset = (preset: typeof presetLocations[0]) => {- setMarkers([...markers, preset]);+ setMarkers([...markers, { ...preset, title: preset.name }]);};useEffect(() => {diff --git a/fincept-terminal-desktop/src/components/tabs/MarketsTab.tsx b/fincept-terminal-desktop/src/components/tabs/MarketsTab.tsxindex 3efd401c8..66c81589b 100644--- a/fincept-terminal-desktop/src/components/tabs/MarketsTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/MarketsTab.tsx@@ -16,7 +16,7 @@ const MarketsTab: React.FC = () => {const BLOOMBERG_PANEL_BG = '#000000';// Market data (exact structure from Python)- const marketData = {+ const marketData: { [key: string]: string[][] } = {'Stock Indices': [['S&P 500', '5232.35', '+23.45', '+0.45%', '+2.1%', '+5.4%'],['Nasdaq 100', '16412.87', '-15.23', '-0.09%', '+1.8%', '+7.2%'],@@ -92,7 +92,7 @@ const MarketsTab: React.FC = () => {};// Regional data (exact from Python)- const regionalData = {+ const regionalData: { [key: string]: string[][] } = {'India': [['RELIANCE.NS', 'Reliance Industries', '2500.45', '+23.45', '+0.95%'],['TCS.NS', 'Tata Consultancy', '3456.78', '-12.34', '-0.36%'],diff --git a/fincept-terminal-desktop/src/components/tabs/OptionsTab.tsx b/fincept-terminal-desktop/src/components/tabs/OptionsTab.tsxindex 3135d41a6..710dcb382 100644--- a/fincept-terminal-desktop/src/components/tabs/OptionsTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/OptionsTab.tsx@@ -365,12 +365,12 @@ const OptionsTab: React.FC = () => {{showGreeks ? (<>{/* Calls */}- <div style={{ color: COLOR_GREEN, fontWeight: 'bold', textAlign: 'center' }} colSpan={10}>+ <div style={{ color: COLOR_GREEN, fontWeight: 'bold', textAlign: 'center' }}>========== CALLS ==========</div><div style={{ color: COLOR_ORANGE, fontWeight: 'bold', textAlign: 'center' }}>STRIKE</div>{/* Puts */}- <div style={{ color: COLOR_RED, fontWeight: 'bold', textAlign: 'center' }} colSpan={10}>+ <div style={{ color: COLOR_RED, fontWeight: 'bold', textAlign: 'center' }}>========== PUTS ==========</div></>diff --git a/fincept-terminal-desktop/src/components/tabs/ProfileTab.tsx b/fincept-terminal-desktop/src/components/tabs/ProfileTab.tsxindex cb2c36da6..6e59250e2 100644--- a/fincept-terminal-desktop/src/components/tabs/ProfileTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/ProfileTab.tsx@@ -6,7 +6,7 @@ const ProfileTab: React.FC = () => {const [lastRefresh, setLastRefresh] = useState<Date>(new Date());const [requestCount, setRequestCount] = useState(15);- const [usageStats, setUsageStats] = useState({+ const [usageStats] = useState({total_requests: 1250,total_credits_used: 3425});@@ -48,7 +48,8 @@ const ProfileTab: React.FC = () => {const regenerateApiKey = () => {const newKey = `fk_user_${Math.random().toString(36).substring(2, 15)}`;- setSessionData(prev => ({ ...prev, api_key: newKey }));+ // TODO: Implement actual API key regeneration+ console.log('New API key generated:', newKey);};// Header component matching DearPyGUI style@@ -271,7 +272,7 @@ const ProfileTab: React.FC = () => {<TextLine text={`Username: ${userInfo?.username || 'N/A'}`} /><TextLine text={`Email: ${userInfo?.email || 'N/A'}`} /><TextLine text={`Account Type: ${accountType.charAt(0).toUpperCase() + accountType.slice(1)}`} />- <TextLine text={`Member Since: ${formatDate(userInfo?.created_at)}`} />+ <TextLine text={`Member Since: ${formatDate((userInfo as any)?.created_at)}`} /><Spacer />{hasSubscription && subscriptionPlan && (<>diff --git a/fincept-terminal-desktop/src/contexts/AuthContext.tsx b/fincept-terminal-desktop/src/contexts/AuthContext.tsxindex fab155311..03df9de2e 100644--- a/fincept-terminal-desktop/src/contexts/AuthContext.tsx+++ b/fincept-terminal-desktop/src/contexts/AuthContext.tsx@@ -241,7 +241,7 @@ const fetchUserProfile = async (apiKey: string): Promise<UserProfileResponse['daif (result.success && result.data) {// Fix: Extract the nested data properly- const profileData = result.data.data || result.data;+ const profileData = (result.data as any).data || result.data;console.log('AuthContext: Extracted profile data:', profileData); // Add this debug linereturn profileData;}@@ -300,23 +300,41 @@ const fetchUserProfile = async (apiKey: string): Promise<UserProfileResponse['da// Validate session with APIconst validateSession = async (sessionData: SessionData): Promise<SessionData | null> => {- if (!sessionData.api_key) return null;+ if (!sessionData.api_key) {+ console.log('validateSession: No API key found');+ return null;+ }+ console.log('validateSession: Validating session with API...');const result = await AuthApiService.getAuthStatus(sessionData.api_key, sessionData.device_id);+ console.log('validateSession: Auth status result:', result);+ console.log('validateSession: result.success =', result.success);+ console.log('validateSession: result.data =', result.data);++ // Backend returns nested structure: result.data.data contains the actual auth data+ const authData = (result.data as any)?.data || result.data;+ console.log('validateSession: authData =', authData);+ console.log('validateSession: authData?.authenticated =', authData?.authenticated);- if (result.success && result.data?.authenticated) {- const apiData = result.data;+ if (result.success && authData?.authenticated) {+ const apiData = authData;+ console.log('validateSession: User authenticated, type:', apiData.user_type);// For registered users, fetch detailed profile and subscriptionlet userProfile = null;let userSubscription = null;if (apiData.user_type === 'registered') {+ console.log('validateSession: Fetching user profile...');userProfile = await fetchUserProfile(sessionData.api_key);+ console.log('validateSession: User profile result:', userProfile);++ console.log('validateSession: Fetching user subscription...');userSubscription = await fetchUserSubscription(sessionData.api_key);+ console.log('validateSession: User subscription result:', userSubscription);}- return {+ const validatedSession = {authenticated: true,user_type: apiData.user_type,api_key: sessionData.api_key,@@ -334,8 +352,12 @@ const fetchUserProfile = async (apiKey: string): Promise<UserProfileResponse['darequests_today: apiData.user_type === 'guest' ? apiData.guest?.requests_today : undefined,subscription: userSubscription || undefined};++ console.log('validateSession: Returning validated session:', validatedSession);+ return validatedSession;}+ console.log('validateSession: Auth status check failed or not authenticated');return null;};@@ -402,7 +424,7 @@ const fetchUserProfile = async (apiKey: string): Promise<UserProfileResponse['daif (result.success && result.data) {// Handle the nested response structure: result.data.data.plans- const plansData = result.data.data || result.data;+ const plansData = (result.data as any).data || result.data;const plans = plansData.plans || [];console.log('AuthContext: Extracted plans:', plans);diff --git a/fincept-terminal-desktop/src/main.tsx b/fincept-terminal-desktop/src/main.tsxindex 1d40a2c9f..03ed7e4c0 100644--- a/fincept-terminal-desktop/src/main.tsx+++ b/fincept-terminal-desktop/src/main.tsx@@ -3,6 +3,7 @@ import ReactDOM from 'react-dom/client'import App from './App'import { AuthProvider } from './contexts/AuthContext'import './App.css' // Make sure this line exists+import './tauri-cors-config' // Initialize Tauri CORS pluginReactDOM.createRoot(document.getElementById('root')!).render(<React.StrictMode>diff --git a/fincept-terminal-desktop/src/services/authApi.tsx b/fincept-terminal-desktop/src/services/authApi.tsxindex fb3539586..ff88312de 100644--- a/fincept-terminal-desktop/src/services/authApi.tsx+++ b/fincept-terminal-desktop/src/services/authApi.tsx@@ -3,7 +3,7 @@// API Configurationconst API_CONFIG = {- BASE_URL: 'https://finceptbackend.share.zrok.io',+ BASE_URL: import.meta.env.DEV ? '/api' : 'https://finceptbackend.share.zrok.io',API_VERSION: 'v1',CONNECTION_TIMEOUT: 10000,REQUEST_TIMEOUT: 30000@@ -126,7 +126,7 @@ const makeApiRequest = async <T = any>(url,endpoint,data,- headers: { ...defaultHeaders, 'X-API-Key': defaultHeaders['X-API-Key'] ? '[REDACTED]' : undefined }+ headers: { ...defaultHeaders, 'X-API-Key': (defaultHeaders as any)['X-API-Key'] ? '[REDACTED]' : undefined }});const config: RequestInit = {diff --git a/fincept-terminal-desktop/src/services/paymentApi.tsx b/fincept-terminal-desktop/src/services/paymentApi.tsxindex 0865269f5..b93cbfb1c 100644--- a/fincept-terminal-desktop/src/services/paymentApi.tsx+++ b/fincept-terminal-desktop/src/services/paymentApi.tsx@@ -3,7 +3,7 @@// API Configurationconst PAYMENT_API_CONFIG = {- BASE_URL: 'https://finceptbackend.share.zrok.io',+ BASE_URL: import.meta.env.DEV ? '/api' : 'https://finceptbackend.share.zrok.io',CONNECTION_TIMEOUT: 10000,REQUEST_TIMEOUT: 30000};@@ -144,7 +144,7 @@ const makePaymentApiRequest = async <T = any>(});// Debug headers (with API key redacted)- const debugHeaders = { ...defaultHeaders };+ const debugHeaders: any = { ...defaultHeaders };if (debugHeaders['X-API-Key']) {debugHeaders['X-API-Key'] = '[REDACTED - Length: ' + debugHeaders['X-API-Key'].length + ']';}@@ -176,7 +176,7 @@ const makePaymentApiRequest = async <T = any>(method: config.method,mode: config.mode,hasBody: !!config.body,- bodyLength: config.body ? config.body.length : 0+ bodyLength: config.body ? (config.body as string).length : 0});const response = await fetch(url, config);diff --git a/fincept-terminal-desktop/src/tauri-cors-config.ts b/fincept-terminal-desktop/src/tauri-cors-config.tsnew file mode 100644index 000000000..c6da0cc83--- /dev/null+++ b/fincept-terminal-desktop/src/tauri-cors-config.ts@@ -0,0 +1,61 @@+// Tauri CORS Fetch Configuration+// This configures which requests should bypass CORS using the tauri-plugin-cors-fetch++// Declare the global CORSFetch API+declare global {+ interface Window {+ CORSFetch?: {+ config: (options: {+ include?: RegExp[];+ exclude?: string[];+ request?: {+ maxRedirections?: number;+ connectTimeout?: number;+ proxy?: {+ all?: string;+ };+ };+ }) => void;+ };+ }+}++export function initTauriCORS() {+ // Only configure in Tauri environment (production build)+ if (window.CORSFetch) {+ console.log('🔧 Configuring Tauri CORS plugin...');++ window.CORSFetch.config({+ // Include all HTTPS requests to bypass CORS+ include: [/^https?:\/\//i],++ // Optionally exclude specific URLs that don't need CORS bypass+ exclude: [],++ // Request configuration+ request: {+ maxRedirections: 5,+ connectTimeout: 30 * 1000, // 30 seconds+ }+ });++ console.log('✅ Tauri CORS plugin configured successfully');+ } else {+ console.log('ℹ️ CORSFetch not available (running in dev mode with Vite proxy)');+ }+}++// Auto-initialize on import+if (typeof window !== 'undefined') {+ // Wait for Tauri to be ready+ if (window.CORSFetch) {+ initTauriCORS();+ } else {+ // Try again after a short delay (Tauri may still be initializing)+ setTimeout(() => {+ if (window.CORSFetch) {+ initTauriCORS();+ }+ }, 100);+ }+}\ No newline at end of filediff --git a/fincept-terminal-desktop/tsconfig.json b/fincept-terminal-desktop/tsconfig.jsonindex abdb1311d..c13c21f09 100644--- a/fincept-terminal-desktop/tsconfig.json+++ b/fincept-terminal-desktop/tsconfig.json@@ -12,8 +12,8 @@"noEmit": true,"jsx": "react-jsx","strict": true,- "noUnusedLocals": true,- "noUnusedParameters": true,+ "noUnusedLocals": false,+ "noUnusedParameters": false,"noFallthroughCasesInSwitch": true,"baseUrl": ".","paths": {@@ -21,5 +21,6 @@}},"include": ["src"],+ "exclude": ["src/services/duckdbService.ts"],"references": [{ "path": "./tsconfig.node.json" }]}\ No newline at end of file