Spaces:
Paused
Paused
CBV01 commited on
Commit ·
bee7763
1
Parent(s): ac02e1d
Fix accounts UI layout, payment gateway initialization, and user email integration
Browse files- backend/database.py +2 -0
- backend/main.py +5 -2
- frontend/src/app/accounts/page.tsx +101 -105
- frontend/src/app/register/page.tsx +1 -1
- frontend/src/components/MonetizationOverlay.tsx +11 -10
backend/database.py
CHANGED
|
@@ -185,6 +185,7 @@ def init_db():
|
|
| 185 |
username TEXT UNIQUE NOT NULL,
|
| 186 |
password_hash TEXT NOT NULL,
|
| 187 |
role TEXT DEFAULT 'user',
|
|
|
|
| 188 |
is_active INTEGER DEFAULT 1,
|
| 189 |
passkey_verified INTEGER DEFAULT 0
|
| 190 |
)""",
|
|
@@ -342,6 +343,7 @@ def init_db():
|
|
| 342 |
# Migration for users table (Premium Features & Plan Limits)
|
| 343 |
user_cols = [
|
| 344 |
("plan", "TEXT DEFAULT 'free'"),
|
|
|
|
| 345 |
("scrape_limit", "INTEGER DEFAULT 100"),
|
| 346 |
("max_accounts", "INTEGER DEFAULT 1"),
|
| 347 |
("total_scraped", "INTEGER DEFAULT 0"),
|
|
|
|
| 185 |
username TEXT UNIQUE NOT NULL,
|
| 186 |
password_hash TEXT NOT NULL,
|
| 187 |
role TEXT DEFAULT 'user',
|
| 188 |
+
email TEXT,
|
| 189 |
is_active INTEGER DEFAULT 1,
|
| 190 |
passkey_verified INTEGER DEFAULT 0
|
| 191 |
)""",
|
|
|
|
| 343 |
# Migration for users table (Premium Features & Plan Limits)
|
| 344 |
user_cols = [
|
| 345 |
("plan", "TEXT DEFAULT 'free'"),
|
| 346 |
+
("email", "TEXT"),
|
| 347 |
("scrape_limit", "INTEGER DEFAULT 100"),
|
| 348 |
("max_accounts", "INTEGER DEFAULT 1"),
|
| 349 |
("total_scraped", "INTEGER DEFAULT 0"),
|
backend/main.py
CHANGED
|
@@ -533,6 +533,7 @@ async def qr_login_worker(client: TelegramClient, qr, user_id, api_id, api_hash,
|
|
| 533 |
class UserRegister(BaseModel):
|
| 534 |
username: str
|
| 535 |
password: str
|
|
|
|
| 536 |
|
| 537 |
class PasskeyVerify(BaseModel):
|
| 538 |
passkey: str
|
|
@@ -574,8 +575,8 @@ async def register(user: UserRegister):
|
|
| 574 |
pw_hash = get_password_hash(user.password)
|
| 575 |
|
| 576 |
conn.execute(
|
| 577 |
-
"INSERT INTO users (id, username, password_hash, role) VALUES (?, ?, ?, ?)",
|
| 578 |
-
(user_id, user.username, pw_hash, "user")
|
| 579 |
)
|
| 580 |
if hasattr(conn, "commit"): conn.commit()
|
| 581 |
if hasattr(conn, "close"): conn.close()
|
|
@@ -1958,6 +1959,7 @@ async def get_user_status(user_id: str = Depends(get_current_user_id)):
|
|
| 1958 |
"daily_campaign_count": 0,
|
| 1959 |
"max_daily_keywords": cfg["max_daily_keywords"],
|
| 1960 |
"daily_keyword_count": 0,
|
|
|
|
| 1961 |
"is_approved": 1,
|
| 1962 |
"has_proof": True
|
| 1963 |
}
|
|
@@ -1980,6 +1982,7 @@ async def get_user_status(user_id: str = Depends(get_current_user_id)):
|
|
| 1980 |
return {
|
| 1981 |
"plan": row["plan"],
|
| 1982 |
"username": row["username"],
|
|
|
|
| 1983 |
"scrape_limit": row["scrape_limit"] or p_cfg["scrape_limit"],
|
| 1984 |
"max_accounts": row["max_accounts"] or p_cfg["max_accounts"],
|
| 1985 |
"max_daily_campaigns": row["max_daily_campaigns"] or p_cfg["max_daily_campaigns"],
|
|
|
|
| 533 |
class UserRegister(BaseModel):
|
| 534 |
username: str
|
| 535 |
password: str
|
| 536 |
+
email: Optional[str] = None
|
| 537 |
|
| 538 |
class PasskeyVerify(BaseModel):
|
| 539 |
passkey: str
|
|
|
|
| 575 |
pw_hash = get_password_hash(user.password)
|
| 576 |
|
| 577 |
conn.execute(
|
| 578 |
+
"INSERT INTO users (id, username, password_hash, role, email) VALUES (?, ?, ?, ?, ?)",
|
| 579 |
+
(user_id, user.username, pw_hash, "user", user.email)
|
| 580 |
)
|
| 581 |
if hasattr(conn, "commit"): conn.commit()
|
| 582 |
if hasattr(conn, "close"): conn.close()
|
|
|
|
| 1959 |
"daily_campaign_count": 0,
|
| 1960 |
"max_daily_keywords": cfg["max_daily_keywords"],
|
| 1961 |
"daily_keyword_count": 0,
|
| 1962 |
+
"email": "admin@arkitel.app",
|
| 1963 |
"is_approved": 1,
|
| 1964 |
"has_proof": True
|
| 1965 |
}
|
|
|
|
| 1982 |
return {
|
| 1983 |
"plan": row["plan"],
|
| 1984 |
"username": row["username"],
|
| 1985 |
+
"email": row["email"] or f"{row['username']}@arkitel.app",
|
| 1986 |
"scrape_limit": row["scrape_limit"] or p_cfg["scrape_limit"],
|
| 1987 |
"max_accounts": row["max_accounts"] or p_cfg["max_accounts"],
|
| 1988 |
"max_daily_campaigns": row["max_daily_campaigns"] or p_cfg["max_daily_campaigns"],
|
frontend/src/app/accounts/page.tsx
CHANGED
|
@@ -372,107 +372,104 @@ export default function AccountsPage() {
|
|
| 372 |
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 animate-in fade-in slide-in-from-bottom-8 duration-1000">
|
| 373 |
{accounts.map((acc) => (
|
| 374 |
<div key={acc.phone_number} className="bg-card border border-border p-6 rounded-[32px] group relative hover:shadow-2xl hover:shadow-indigo-500/5 transition-all duration-500 flex flex-col">
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
<
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
<button
|
| 406 |
-
onClick={() => handleSyncProfile(acc.phone_number)}
|
| 407 |
-
className="p-1.5 bg-foreground/5 hover:bg-indigo-500/10 hover:text-indigo-500 rounded-lg text-foreground/30 transition-all"
|
| 408 |
-
title="Sync Profile"
|
| 409 |
-
>
|
| 410 |
-
{actionLoading === acc.phone_number + '_sync' ? <Loader2 size={14} className="animate-spin" /> : <CloudSync size={14} />}
|
| 411 |
-
</button>
|
| 412 |
-
<button
|
| 413 |
-
onClick={() => handleValidateSession(acc.phone_number)}
|
| 414 |
-
className="p-1.5 bg-foreground/5 hover:bg-emerald-500/10 hover:text-emerald-500 rounded-lg text-foreground/30 transition-all"
|
| 415 |
-
title="Pulse Check"
|
| 416 |
-
>
|
| 417 |
-
{actionLoading === acc.phone_number + '_valid' ? <Loader2 size={14} className="animate-spin" /> : <Rocket size={14} />}
|
| 418 |
-
</button>
|
| 419 |
-
<button
|
| 420 |
-
onClick={() => handleSessionDump(acc.phone_number)}
|
| 421 |
-
className="p-1.5 bg-foreground/5 hover:bg-indigo-500/10 hover:text-indigo-500 rounded-lg text-foreground/30 transition-all"
|
| 422 |
-
title="Export Key"
|
| 423 |
-
>
|
| 424 |
-
{actionLoading === acc.phone_number + '_dump' ? <Loader2 size={14} className="animate-spin" /> : <KeyRound size={14} />}
|
| 425 |
-
</button>
|
| 426 |
-
<button
|
| 427 |
-
onClick={() => handleDeleteAccount(acc.phone_number)}
|
| 428 |
-
className="p-1.5 bg-foreground/5 hover:bg-red-500/10 hover:text-red-500 rounded-lg text-foreground/30 transition-all"
|
| 429 |
-
title="Delete"
|
| 430 |
-
>
|
| 431 |
-
{actionLoading === acc.phone_number ? <Loader2 size={14} className="animate-spin" /> : <X size={14} />}
|
| 432 |
-
</button>
|
| 433 |
</div>
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
<
|
| 451 |
-
|
| 452 |
-
|
|
|
|
|
|
|
| 453 |
</div>
|
| 454 |
-
<h4 className="text-lg font-bold text-foreground tracking-tight">{acc.first_name || 'Account'} {acc.last_name || ''}</h4>
|
| 455 |
-
<p className="text-[10px] font-black text-indigo-500 uppercase tracking-widest mt-1">@{acc.username || 'unknown_node'}</p>
|
| 456 |
-
</div>
|
| 457 |
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
</div>
|
| 464 |
-
|
| 465 |
-
<div className="flex flex-col gap-2.5">
|
| 466 |
-
<div className="flex items-center gap-3 text-xs font-bold text-foreground/70">
|
| 467 |
-
<div className="w-7 h-7 rounded-lg bg-indigo-500/10 flex items-center justify-center text-indigo-500"><Phone size={14} /></div>
|
| 468 |
-
{acc.phone_number}
|
| 469 |
</div>
|
| 470 |
-
|
|
|
|
| 471 |
<div className="flex items-center gap-3 text-xs font-bold text-foreground/70">
|
| 472 |
-
<div className="w-7 h-7 rounded-lg bg-
|
| 473 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
</div>
|
| 475 |
-
<span className="text-[10px] font-bold text-foreground/40">98.4%</span>
|
| 476 |
</div>
|
| 477 |
</div>
|
| 478 |
|
|
@@ -498,18 +495,17 @@ export default function AccountsPage() {
|
|
| 498 |
</span>
|
| 499 |
</div>
|
| 500 |
</div>
|
| 501 |
-
</div>
|
| 502 |
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
|
|
|
| 509 |
</div>
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
</div>
|
| 513 |
)}
|
| 514 |
|
| 515 |
{/* Premium Connection Modal Overay */}
|
|
|
|
| 372 |
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 animate-in fade-in slide-in-from-bottom-8 duration-1000">
|
| 373 |
{accounts.map((acc) => (
|
| 374 |
<div key={acc.phone_number} className="bg-card border border-border p-6 rounded-[32px] group relative hover:shadow-2xl hover:shadow-indigo-500/5 transition-all duration-500 flex flex-col">
|
| 375 |
+
{/* Header: Status and Active Indicator */}
|
| 376 |
+
<div className="flex justify-between items-center mb-6">
|
| 377 |
+
<span className={`px-3 py-1 text-[10px] font-bold rounded-full flex items-center gap-1.5 uppercase transition-all ${
|
| 378 |
+
acc.status === 'active' ? 'bg-emerald-500/10 text-emerald-500' :
|
| 379 |
+
(acc.status === 'resting' || acc.status === 'pending') ? 'bg-amber-500/10 text-amber-500' :
|
| 380 |
+
'bg-red-500/10 text-red-500'
|
| 381 |
+
}`}>
|
| 382 |
+
<div className={`w-1.5 h-1.5 rounded-full ${
|
| 383 |
+
acc.status === 'active' ? 'bg-emerald-500 animate-pulse' :
|
| 384 |
+
(acc.status === 'resting' || acc.status === 'pending') ? 'bg-amber-500' :
|
| 385 |
+
'bg-red-500'
|
| 386 |
+
}`} />
|
| 387 |
+
{acc.status}
|
| 388 |
+
</span>
|
| 389 |
+
|
| 390 |
+
<div className="flex items-center gap-2">
|
| 391 |
+
{acc.is_active ? (
|
| 392 |
+
<div className="flex items-center gap-1.5 px-3 py-1 bg-indigo-500/10 text-indigo-500 rounded-full text-[10px] font-black uppercase border border-indigo-500/20 shadow-lg shadow-indigo-500/10">
|
| 393 |
+
<Star size={12} className="fill-indigo-500" />
|
| 394 |
+
Primary Node
|
| 395 |
+
</div>
|
| 396 |
+
) : (
|
| 397 |
+
<button
|
| 398 |
+
onClick={() => handleSetActive(acc.phone_number)}
|
| 399 |
+
className="px-3 py-1 bg-white/5 hover:bg-white/10 text-foreground/40 hover:text-white rounded-full text-[10px] font-bold uppercase transition-all border border-white/5"
|
| 400 |
+
>
|
| 401 |
+
{actionLoading === acc.phone_number + '_active' ? <Loader2 size={10} className="animate-spin" /> : 'Use This'}
|
| 402 |
+
</button>
|
| 403 |
+
)}
|
| 404 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 405 |
</div>
|
| 406 |
+
|
| 407 |
+
{/* Profile Image and Identity */}
|
| 408 |
+
<div className="flex flex-col items-center mb-6">
|
| 409 |
+
<div className="w-20 h-20 rounded-full border-4 border-foreground/5 p-1 mb-3 bg-foreground/[0.02] relative shadow-inner overflow-hidden flex items-center justify-center">
|
| 410 |
+
{acc.profile_photo ? (
|
| 411 |
+
<img
|
| 412 |
+
src={acc.profile_photo.startsWith('http') ? acc.profile_photo : (process.env.NEXT_PUBLIC_API_URL ? `${process.env.NEXT_PUBLIC_API_URL}${acc.profile_photo}` : `http://localhost:8000${acc.profile_photo}`)}
|
| 413 |
+
className="w-full h-full rounded-full object-cover"
|
| 414 |
+
onError={(e) => {
|
| 415 |
+
const target = e.target as any;
|
| 416 |
+
target.src = `https://ui-avatars.com/api/?name=${encodeURIComponent(acc.first_name || 'A')}&background=6366f1&color=fff`;
|
| 417 |
+
}}
|
| 418 |
+
/>
|
| 419 |
+
) : (
|
| 420 |
+
<div className="w-full h-full rounded-full bg-indigo-500/10 flex items-center justify-center text-indigo-500">
|
| 421 |
+
<Users size={32} />
|
| 422 |
+
</div>
|
| 423 |
+
)}
|
| 424 |
+
</div>
|
| 425 |
+
<h4 className="text-lg font-bold text-white tracking-tight px-4 text-center">{acc.first_name || 'Account'} {acc.last_name || ''}</h4>
|
| 426 |
+
<p className="text-[10px] font-black text-indigo-500 uppercase tracking-widest mt-1 max-w-full truncate px-4">@{acc.username || 'unknown_node'}</p>
|
| 427 |
</div>
|
|
|
|
|
|
|
|
|
|
| 428 |
|
| 429 |
+
{/* Info Grid */}
|
| 430 |
+
<div className="bg-white/[0.02] border border-white/5 rounded-[2rem] p-5 mb-auto space-y-4">
|
| 431 |
+
<div className="flex items-center justify-between text-[10px] font-bold text-foreground/30 uppercase tracking-tighter">
|
| 432 |
+
<span className="flex items-center gap-1.5 font-black text-white/20"><Rocket size={10} className="opacity-50" /> #CH_{acc.phone_number.slice(-4)}</span>
|
| 433 |
+
<span className="flex items-center gap-1.5 bg-white/5 px-2 py-0.5 rounded-full"><Globe size={10} className="opacity-50" /> {acc.country || 'Global'}</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 434 |
</div>
|
| 435 |
+
|
| 436 |
+
<div className="flex flex-col gap-2.5">
|
| 437 |
<div className="flex items-center gap-3 text-xs font-bold text-foreground/70">
|
| 438 |
+
<div className="w-7 h-7 rounded-lg bg-indigo-500/10 flex items-center justify-center text-indigo-500"><Phone size={14} /></div>
|
| 439 |
+
{acc.phone_number}
|
| 440 |
+
</div>
|
| 441 |
+
|
| 442 |
+
{/* Action Cluster - High end layout */}
|
| 443 |
+
<div className="grid grid-cols-4 gap-2 pt-3 mt-1 border-t border-white/5">
|
| 444 |
+
<button
|
| 445 |
+
onClick={() => handleSyncProfile(acc.phone_number)}
|
| 446 |
+
className="col-span-1 p-3 bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-500 rounded-2xl flex items-center justify-center transition-all border border-indigo-500/10"
|
| 447 |
+
title="Sync Profile"
|
| 448 |
+
>
|
| 449 |
+
{actionLoading === acc.phone_number + '_sync' ? <Loader2 size={14} className="animate-spin" /> : <CloudSync size={16} />}
|
| 450 |
+
</button>
|
| 451 |
+
<button
|
| 452 |
+
onClick={() => handleValidateSession(acc.phone_number)}
|
| 453 |
+
className="col-span-1 p-3 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-500 rounded-2xl flex items-center justify-center transition-all border border-emerald-500/10"
|
| 454 |
+
title="Pulse Check"
|
| 455 |
+
>
|
| 456 |
+
{actionLoading === acc.phone_number + '_valid' ? <Loader2 size={14} className="animate-spin" /> : <Rocket size={16} />}
|
| 457 |
+
</button>
|
| 458 |
+
<button
|
| 459 |
+
onClick={() => handleSessionDump(acc.phone_number)}
|
| 460 |
+
className="col-span-1 p-3 bg-white/5 hover:bg-white/10 text-white/40 rounded-2xl flex items-center justify-center transition-all border border-white/10"
|
| 461 |
+
title="Export Key"
|
| 462 |
+
>
|
| 463 |
+
{actionLoading === acc.phone_number + '_dump' ? <Loader2 size={14} className="animate-spin" /> : <KeyRound size={16} />}
|
| 464 |
+
</button>
|
| 465 |
+
<button
|
| 466 |
+
onClick={() => handleDeleteAccount(acc.phone_number)}
|
| 467 |
+
className="col-span-1 p-3 bg-red-500/10 hover:bg-red-500/20 text-red-500 rounded-2xl flex items-center justify-center transition-all border border-red-500/10"
|
| 468 |
+
title="Delete"
|
| 469 |
+
>
|
| 470 |
+
{actionLoading === acc.phone_number ? <Loader2 size={14} className="animate-spin" /> : <X size={16} />}
|
| 471 |
+
</button>
|
| 472 |
</div>
|
|
|
|
| 473 |
</div>
|
| 474 |
</div>
|
| 475 |
|
|
|
|
| 495 |
</span>
|
| 496 |
</div>
|
| 497 |
</div>
|
|
|
|
| 498 |
|
| 499 |
+
{/* Joined Footer */}
|
| 500 |
+
<div className="flex items-center justify-between pt-5 mt-5 border-t border-border/10">
|
| 501 |
+
<span className="text-[10px] font-bold text-foreground/20 uppercase tracking-[0.1em]">Joined {acc.created_at ? new Date(acc.created_at).toLocaleDateString('en-US', { day: 'numeric', month: 'short', year: 'numeric' }) : 'Recently'}</span>
|
| 502 |
+
<button className="text-[10px] font-black text-indigo-500 uppercase tracking-widest hover:text-indigo-400 flex items-center gap-1 transition-all group/btn">
|
| 503 |
+
View Details <ChevronRight size={10} className="group-hover/btn:translate-x-1 transition-transform" />
|
| 504 |
+
</button>
|
| 505 |
+
</div>
|
| 506 |
</div>
|
| 507 |
+
))}
|
| 508 |
+
</div>
|
|
|
|
| 509 |
)}
|
| 510 |
|
| 511 |
{/* Premium Connection Modal Overay */}
|
frontend/src/app/register/page.tsx
CHANGED
|
@@ -33,7 +33,7 @@ export default function RegisterPage() {
|
|
| 33 |
const res = await fetch(`${apiUrl}/api/auth/register`, {
|
| 34 |
method: "POST",
|
| 35 |
headers: { "Content-Type": "application/json" },
|
| 36 |
-
body: JSON.stringify({ username, password }),
|
| 37 |
});
|
| 38 |
|
| 39 |
const data = await res.json();
|
|
|
|
| 33 |
const res = await fetch(`${apiUrl}/api/auth/register`, {
|
| 34 |
method: "POST",
|
| 35 |
headers: { "Content-Type": "application/json" },
|
| 36 |
+
body: JSON.stringify({ username, password, email: username }),
|
| 37 |
});
|
| 38 |
|
| 39 |
const data = await res.json();
|
frontend/src/components/MonetizationOverlay.tsx
CHANGED
|
@@ -115,7 +115,7 @@ export const MonetizationOverlay: React.FC<MonetizationOverlayProps> = ({ childr
|
|
| 115 |
|
| 116 |
const handler = pPop.setup({
|
| 117 |
key: publicKey,
|
| 118 |
-
email: `${status?.username || 'user'}@arkitel.app`,
|
| 119 |
amount: Math.round(finalAmount * 100), // kobo
|
| 120 |
currency: 'NGN',
|
| 121 |
ref: ref,
|
|
@@ -146,7 +146,7 @@ export const MonetizationOverlay: React.FC<MonetizationOverlayProps> = ({ childr
|
|
| 146 |
setMsg({ type: 'error', text: 'Payment window closed.' });
|
| 147 |
}
|
| 148 |
});
|
| 149 |
-
handler.
|
| 150 |
} catch (err) {
|
| 151 |
console.error("Paystack open error", err);
|
| 152 |
setMsg({ type: 'error', text: 'Failed to open payment gateway. Refresh the page.' });
|
|
@@ -189,6 +189,13 @@ export const MonetizationOverlay: React.FC<MonetizationOverlayProps> = ({ childr
|
|
| 189 |
<div className="relative w-full h-full min-h-[400px]">
|
| 190 |
{children}
|
| 191 |
{isLocked && (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
<div className="absolute inset-0 z-50 flex items-center justify-center p-4">
|
| 193 |
{/* Backdrop - Minimalist Deep Dark */}
|
| 194 |
<div className="absolute inset-0 bg-[#0a0a0c]/95 backdrop-blur-md" />
|
|
@@ -254,14 +261,8 @@ export const MonetizationOverlay: React.FC<MonetizationOverlayProps> = ({ childr
|
|
| 254 |
</button>
|
| 255 |
</div>
|
| 256 |
) : (
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
src="https://js.paystack.co/v1/inline.js"
|
| 260 |
-
strategy="lazyOnload"
|
| 261 |
-
onLoad={() => setIsPaystackReady(true)}
|
| 262 |
-
/>
|
| 263 |
-
|
| 264 |
-
{/* Horizontal Plan Scroll/Tabs */}
|
| 265 |
<div className="grid grid-cols-3 gap-2">
|
| 266 |
{plans.map((plan) => {
|
| 267 |
const meta = PLAN_METADATA[plan.key] || { icon: Star, color: 'from-gray-500 to-gray-700' };
|
|
|
|
| 115 |
|
| 116 |
const handler = pPop.setup({
|
| 117 |
key: publicKey,
|
| 118 |
+
email: status?.email || `${(status?.username || 'user').replace(/\s+/g, '_')}@arkitel.app`,
|
| 119 |
amount: Math.round(finalAmount * 100), // kobo
|
| 120 |
currency: 'NGN',
|
| 121 |
ref: ref,
|
|
|
|
| 146 |
setMsg({ type: 'error', text: 'Payment window closed.' });
|
| 147 |
}
|
| 148 |
});
|
| 149 |
+
handler.open();
|
| 150 |
} catch (err) {
|
| 151 |
console.error("Paystack open error", err);
|
| 152 |
setMsg({ type: 'error', text: 'Failed to open payment gateway. Refresh the page.' });
|
|
|
|
| 189 |
<div className="relative w-full h-full min-h-[400px]">
|
| 190 |
{children}
|
| 191 |
{isLocked && (
|
| 192 |
+
<>
|
| 193 |
+
<Script
|
| 194 |
+
src="https://js.paystack.co/v1/inline.js"
|
| 195 |
+
strategy="lazyOnload"
|
| 196 |
+
onLoad={() => setIsPaystackReady(true)}
|
| 197 |
+
/>
|
| 198 |
+
|
| 199 |
<div className="absolute inset-0 z-50 flex items-center justify-center p-4">
|
| 200 |
{/* Backdrop - Minimalist Deep Dark */}
|
| 201 |
<div className="absolute inset-0 bg-[#0a0a0c]/95 backdrop-blur-md" />
|
|
|
|
| 261 |
</button>
|
| 262 |
</div>
|
| 263 |
) : (
|
| 264 |
+
<form className="space-y-5" onSubmit={(e) => e.preventDefault()}>
|
| 265 |
+
{/* Horizontal Plan Scroll/Tabs */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
<div className="grid grid-cols-3 gap-2">
|
| 267 |
{plans.map((plan) => {
|
| 268 |
const meta = PLAN_METADATA[plan.key] || { icon: Star, color: 'from-gray-500 to-gray-700' };
|