CBV01 commited on
Commit
e81b8a2
·
1 Parent(s): 77ca6d3

feat: redesign onboarding modals, add custom industry option, redesign credentials setup modal, fix email delivery system with SSL/TLS and admin test panel

Browse files
backend/.env.example CHANGED
@@ -10,3 +10,10 @@ TELEGRAM_API_HASH=
10
 
11
  # Production Frontend URL for CORS
12
  FRONTEND_URL=https://your-frontend-app.vercel.app
 
 
 
 
 
 
 
 
10
 
11
  # Production Frontend URL for CORS
12
  FRONTEND_URL=https://your-frontend-app.vercel.app
13
+
14
+ # Email & SMTP Configuration (e.g. Gmail with App Password or custom SMTP)
15
+ SMTP_HOST=smtp.gmail.com
16
+ SMTP_PORT=587
17
+ SMTP_USER=your-email@gmail.com
18
+ SMTP_PASS=your-gmail-16-char-app-password
19
+ SMTP_FROM=ArkiTel Automation <your-email@gmail.com>
backend/main.py CHANGED
@@ -1195,10 +1195,10 @@ async def register(user: UserRegister):
1195
  if hasattr(conn, "close"): conn.close()
1196
  print(f"AUTH: Registered new user {user.username} with ID {user_id} (Country: {country_val})")
1197
 
1198
- # Dispatch Welcome Email with Welcome Coupon
1199
  welcome_coupon = "WELCOME20"
1200
  try:
1201
- send_welcome_email(
1202
  to_email=email_val,
1203
  username=user.username,
1204
  full_name=display_name,
@@ -3473,18 +3473,94 @@ async def create_broadcast(message: str, type: str = 'info', admin_id: str = Dep
3473
 
3474
  # --- Monetization & Plans ---
3475
 
3476
- def send_welcome_email(to_email: str, username: str, full_name: Optional[str] = None, coupon_code: str = "WELCOME20"):
3477
- """Dispatches a congratulatory welcome email on successful registration."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3478
  if not to_email or "@" not in to_email:
3479
- log_debug(f"EMAIL: Skipped welcome email to invalid address: {to_email}")
3480
  return False
3481
-
3482
- smtp_host = os.getenv("SMTP_HOST", "smtp.gmail.com")
3483
- smtp_port = int(os.getenv("SMTP_PORT", "587"))
3484
- smtp_user = os.getenv("SMTP_USER", "")
3485
- smtp_pass = os.getenv("SMTP_PASS", "")
3486
- smtp_from = os.getenv("SMTP_FROM", f"ArkiTel Automation <{smtp_user or 'arkilostudios@gmail.com'}>")
3487
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3488
  display_name = full_name or username
3489
  subject = "🎉 Welcome to ArkiTel! You're Now an Official Member"
3490
  frontend_url = os.getenv("FRONTEND_URL", "http://localhost:3000")
@@ -3500,8 +3576,8 @@ def send_welcome_email(to_email: str, username: str, full_name: Optional[str] =
3500
  h1 {{ font-size: 26px; font-weight: 800; margin: 20px 0 8px 0; color: #ffffff; letter-spacing: -0.5px; line-height: 1.2; }}
3501
  p {{ color: rgba(255,255,255,0.7); font-size: 14px; line-height: 1.6; margin: 12px 0; }}
3502
  .highlight-box {{ background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.25); border-radius: 16px; padding: 20px; margin: 20px 0; }}
3503
- .coupon-box {{ background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(99,102,241,0.12)); border: 1px dashed #10b981; border-radius: 16px; padding: 18px; margin: 24px 0; text-align: center; }}
3504
- .coupon-code {{ font-family: monospace; font-size: 24px; font-weight: 900; letter-spacing: 3px; color: #34d399; margin: 8px 0; display: inline-block; background: rgba(16,185,129,0.15); padding: 6px 18px; border-radius: 8px; }}
3505
  .feature-item {{ margin: 8px 0; font-size: 13px; color: rgba(255,255,255,0.85); }}
3506
  .btn {{ display: inline-block; background: #6366f1; color: #ffffff !important; text-decoration: none; font-size: 14px; font-weight: 700; padding: 14px 34px; border-radius: 12px; margin-top: 14px; text-align: center; box-shadow: 0 4px 20px rgba(99,102,241,0.4); }}
3507
  .footer {{ margin-top: 32px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 20px; font-size: 11px; color: rgba(255,255,255,0.35); }}
@@ -3511,7 +3587,7 @@ def send_welcome_email(to_email: str, username: str, full_name: Optional[str] =
3511
  <div class="card">
3512
  <span class="badge">Official Membership</span>
3513
  <h1>Welcome to ArkiTel, {display_name}!</h1>
3514
- <p>Congratulations! Your ArkiTel account is created and ready for action. You now have access to our enterprise Telegram outreach & automation suite.</p>
3515
 
3516
  <div class="highlight-box">
3517
  <div style="font-size: 11px; color: #818cf8; font-weight: 700; text-transform: uppercase;">Active Membership Plan</div>
@@ -3530,7 +3606,7 @@ def send_welcome_email(to_email: str, username: str, full_name: Optional[str] =
3530
  <div style="font-size: 11px; font-weight: 700; color: #34d399; text-transform: uppercase; letter-spacing: 1px;">Exclusive Welcome Gift</div>
3531
  <div style="font-size: 15px; font-weight: 700; color: #ffffff; margin-top: 4px;">20% Upgrade Discount Coupon</div>
3532
  <div><span class="coupon-code">{coupon_code}</span></div>
3533
- <div style="font-size: 11px; color: rgba(255,255,255,0.5);">Apply this code at checkout anytime to save 20% on any Basic, Standard, Premium, or Unlimited tier upgrade!</div>
3534
  </div>
3535
 
3536
  <p>Feel free to explore your new dashboard and start setting up your first outreach campaign today.</p>
@@ -3547,49 +3623,16 @@ def send_welcome_email(to_email: str, username: str, full_name: Optional[str] =
3547
  </body>
3548
  </html>"""
3549
 
3550
- if not smtp_user or not smtp_pass:
3551
- log_debug(f"EMAIL [SIMULATED]: Welcome email sent to {to_email} with coupon {coupon_code}.")
3552
- return True
3553
-
3554
- try:
3555
- import smtplib
3556
- from email.mime.multipart import MIMEMultipart
3557
- from email.mime.text import MIMEText
3558
-
3559
- msg = MIMEMultipart("alternative")
3560
- msg["Subject"] = subject
3561
- msg["From"] = smtp_from
3562
- msg["To"] = to_email
3563
-
3564
- part = MIMEText(html_content, "html")
3565
- msg.attach(part)
3566
-
3567
- with smtplib.SMTP(smtp_host, smtp_port, timeout=10) as server:
3568
- server.starttls()
3569
- server.login(smtp_user, smtp_pass)
3570
- server.sendmail(smtp_from, [to_email], msg.as_string())
3571
-
3572
- log_debug(f"EMAIL: Dispatched welcome email to {to_email}")
3573
- return True
3574
- except Exception as e:
3575
- log_debug(f"EMAIL ERROR: Failed sending welcome email to {to_email}: {e}")
3576
- return False
3577
 
 
 
 
 
3578
 
3579
  def send_plan_activation_email(to_email: str, username: str, plan_name: str, expires_at: Optional[str] = None):
3580
  """Dispatches a stylized email to user upon payment verification and plan activation."""
3581
- if not to_email or "@" not in to_email:
3582
- log_debug(f"EMAIL: Skipped sending to invalid email: {to_email}")
3583
- return False
3584
-
3585
- smtp_host = os.getenv("SMTP_HOST", "smtp.gmail.com")
3586
- smtp_port = int(os.getenv("SMTP_PORT", "587"))
3587
- smtp_user = os.getenv("SMTP_USER", "")
3588
- smtp_pass = os.getenv("SMTP_PASS", "")
3589
- smtp_from = os.getenv("SMTP_FROM", f"ArkiTel Automation <{smtp_user or 'arkilostudios@gmail.com'}>")
3590
-
3591
  subject = f"🚀 Payment Verified: Your ArkiTel {plan_name.title()} Plan is Active!"
3592
-
3593
  frontend_url = os.getenv("FRONTEND_URL", "http://localhost:3000")
3594
  formatted_date = expires_at[:10] if expires_at else "30-Day Active Cycle"
3595
 
@@ -3603,7 +3646,7 @@ def send_plan_activation_email(to_email: str, username: str, plan_name: str, exp
3603
  .badge {{ display: inline-block; background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); padding: 6px 14px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }}
3604
  h1 {{ font-size: 24px; font-weight: 800; margin: 20px 0 8px 0; color: #ffffff; letter-spacing: -0.5px; }}
3605
  p {{ color: rgba(255,255,255,0.7); font-size: 14px; line-height: 1.6; margin: 10px 0; }}
3606
- .plan-box {{ background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 20px; margin: 24px 0; }}
3607
  .btn {{ display: inline-block; background: #6366f1; color: #ffffff !important; text-decoration: none; font-size: 13px; font-weight: 700; padding: 14px 32px; border-radius: 12px; margin-top: 14px; text-align: center; }}
3608
  .footer {{ margin-top: 32px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 20px; font-size: 11px; color: rgba(255,255,255,0.35); }}
3609
  </style>
@@ -3613,12 +3656,12 @@ def send_plan_activation_email(to_email: str, username: str, plan_name: str, exp
3613
  <span class="badge">ArkiTel Fleet Verification</span>
3614
  <h1>Payment Verified & Active!</h1>
3615
  <p>Hello <strong>{username}</strong>,</p>
3616
- <p>Your payment has been successfully confirmed and verified by the ArkiTel team. Your account limits have been unlocked.</p>
3617
 
3618
  <div class="plan-box">
3619
  <div style="font-size: 11px; color: #818cf8; font-weight: 700; text-transform: uppercase;">Activated Membership Tier</div>
3620
  <div style="font-size: 22px; font-weight: 900; color: #ffffff; margin-top: 4px;">{plan_name.title()} Plan</div>
3621
- <div style="font-size: 12px; color: rgba(255,255,255,0.45); margin-top: 6px;">Status: Verified | Valid until: {formatted_date}</div>
3622
  </div>
3623
 
3624
  <p>You can now access your Group Scraper, Vault Leads, DM Automation, Multi-Account Fleet, and high-frequency Campaigns without restrictions.</p>
@@ -3635,33 +3678,71 @@ def send_plan_activation_email(to_email: str, username: str, plan_name: str, exp
3635
  </body>
3636
  </html>"""
3637
 
3638
- if not smtp_user or not smtp_pass:
3639
- log_debug(f"EMAIL [SIMULATED]: SMTP_USER/PASS not configured. Notification sent to {to_email} ({plan_name} plan).")
3640
- return True
3641
 
3642
- try:
3643
- import smtplib
3644
- from email.mime.multipart import MIMEMultipart
3645
- from email.mime.text import MIMEText
3646
 
3647
- msg = MIMEMultipart("alternative")
3648
- msg["Subject"] = subject
3649
- msg["From"] = smtp_from
3650
- msg["To"] = to_email
 
 
3651
 
3652
- part = MIMEText(html_content, "html")
3653
- msg.attach(part)
3654
 
3655
- with smtplib.SMTP(smtp_host, smtp_port, timeout=10) as server:
3656
- server.starttls()
3657
- server.login(smtp_user, smtp_pass)
3658
- server.sendmail(smtp_from, [to_email], msg.as_string())
3659
-
3660
- log_debug(f"EMAIL: Dispatched confirmation email to {to_email}")
3661
- return True
3662
- except Exception as e:
3663
- log_debug(f"EMAIL ERROR: Failed sending email to {to_email}: {e}")
3664
- return False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3665
 
3666
  class UserVitalsUpdateRequest(BaseModel):
3667
  plan: str
@@ -3776,7 +3857,7 @@ async def update_user_vitals(uid: str, req: UserVitalsUpdateRequest, admin_id: s
3776
  try:
3777
  to_email = (curr_user["email"] if curr_user and curr_user["email"] else curr_user["username"]) if curr_user else None
3778
  if to_email:
3779
- send_plan_activation_email(to_email, curr_user["username"], req.plan, expires_at)
3780
  except Exception as mail_err:
3781
  log_debug(f"Email dispatch error: {mail_err}")
3782
 
@@ -4254,11 +4335,11 @@ async def approve_payment_request(req_id: int, admin_id: str = Depends(get_curre
4254
  )
4255
  if hasattr(conn, "commit"): conn.commit()
4256
 
4257
- # Send Email Notification
4258
  user_row = conn.execute("SELECT username, email FROM users WHERE id = ?", (uid,)).fetchone()
4259
  if user_row:
4260
  to_email = user_row["email"] or user_row["username"]
4261
- send_plan_activation_email(to_email, user_row["username"], plan_key, exp_date)
4262
 
4263
  return {"status": "success", "message": f"Payment #{req_id} approved and user upgraded to {plan_key}!"}
4264
  finally:
@@ -4342,11 +4423,11 @@ async def verify_paystack(req: PaystackVerifyRequest, user_id: str = Depends(get
4342
  )
4343
  if hasattr(conn, "commit"): conn.commit()
4344
 
4345
- # Send Plan Activation Email
4346
  u_row = conn.execute("SELECT username, email FROM users WHERE id = ?", (user_id,)).fetchone()
4347
  if u_row:
4348
  target_mail = u_row["email"] or u_row["username"]
4349
- send_plan_activation_email(target_mail, u_row["username"], plan_key, exp_date)
4350
  finally:
4351
  if hasattr(conn, "close"): conn.close()
4352
 
@@ -4392,9 +4473,9 @@ async def paystack_webhook(request: Request):
4392
  )
4393
  if hasattr(conn, "commit"): conn.commit()
4394
 
4395
- # Dispatch Plan Activation Email
4396
  target_email = user["email"] or cust_email
4397
- send_plan_activation_email(target_email, user["username"], plan_key, exp_date)
4398
  finally:
4399
  if hasattr(conn, "close"): conn.close()
4400
 
 
1195
  if hasattr(conn, "close"): conn.close()
1196
  print(f"AUTH: Registered new user {user.username} with ID {user_id} (Country: {country_val})")
1197
 
1198
+ # Dispatch Welcome Email with Welcome Coupon (non-blocking)
1199
  welcome_coupon = "WELCOME20"
1200
  try:
1201
+ send_welcome_email_async(
1202
  to_email=email_val,
1203
  username=user.username,
1204
  full_name=display_name,
 
3473
 
3474
  # --- Monetization & Plans ---
3475
 
3476
+ def get_email_credentials() -> Dict[str, Any]:
3477
+ """Fetches SMTP credentials from environment variables or database system_settings."""
3478
+ smtp_host = os.getenv("SMTP_HOST")
3479
+ smtp_port = os.getenv("SMTP_PORT")
3480
+ smtp_user = os.getenv("SMTP_USER")
3481
+ smtp_pass = os.getenv("SMTP_PASS")
3482
+ smtp_from = os.getenv("SMTP_FROM")
3483
+
3484
+ # If credentials missing or partial, query system_settings
3485
+ try:
3486
+ conn = get_db_connection()
3487
+ rows = conn.execute("SELECT key, value FROM system_settings WHERE key LIKE 'smtp_%'").fetchall()
3488
+ settings = {r["key"]: r["value"] for r in rows}
3489
+ if hasattr(conn, "close"): conn.close()
3490
+
3491
+ if not smtp_host and "smtp_host" in settings:
3492
+ smtp_host = settings["smtp_host"]
3493
+ if not smtp_port and "smtp_port" in settings:
3494
+ smtp_port = settings["smtp_port"]
3495
+ if not smtp_user and "smtp_user" in settings:
3496
+ smtp_user = settings["smtp_user"]
3497
+ if not smtp_pass and "smtp_pass" in settings:
3498
+ smtp_pass = settings["smtp_pass"]
3499
+ if not smtp_from and "smtp_from" in settings:
3500
+ smtp_from = settings["smtp_from"]
3501
+ except Exception as e:
3502
+ log_debug(f"EMAIL: Could not load credentials from system_settings: {e}")
3503
+
3504
+ host = (smtp_host or "smtp.gmail.com").strip()
3505
+ try:
3506
+ port = int(str(smtp_port).strip()) if smtp_port else 587
3507
+ except Exception:
3508
+ port = 587
3509
+ user = (smtp_user or "").strip()
3510
+ pwd = (smtp_pass or "").strip()
3511
+ from_addr = (smtp_from or f"ArkiTel Automation <{user or 'arkilostudios@gmail.com'}>").strip()
3512
+
3513
+ return {
3514
+ "host": host,
3515
+ "port": port,
3516
+ "user": user,
3517
+ "pass": pwd,
3518
+ "from": from_addr,
3519
+ "is_configured": bool(user and pwd)
3520
+ }
3521
+
3522
+ def dispatch_smtp_email(to_email: str, subject: str, html_content: str) -> bool:
3523
+ """Dispatches an email via SMTP with full support for port 465 (SSL) and port 587/25 (STARTTLS)."""
3524
  if not to_email or "@" not in to_email:
3525
+ log_debug(f"EMAIL [SKIP]: Invalid recipient address: '{to_email}'")
3526
  return False
 
 
 
 
 
 
3527
 
3528
+ creds = get_email_credentials()
3529
+ if not creds["is_configured"]:
3530
+ log_debug(f"EMAIL [SIMULATED]: SMTP_USER or SMTP_PASS not set in .env or System Settings. Email to '{to_email}' ('{subject}') was not sent.")
3531
+ return True
3532
+
3533
+ try:
3534
+ import smtplib
3535
+ from email.mime.multipart import MIMEMultipart
3536
+ from email.mime.text import MIMEText
3537
+
3538
+ msg = MIMEMultipart("alternative")
3539
+ msg["Subject"] = subject
3540
+ msg["From"] = creds["from"]
3541
+ msg["To"] = to_email
3542
+
3543
+ part = MIMEText(html_content, "html")
3544
+ msg.attach(part)
3545
+
3546
+ if creds["port"] == 465:
3547
+ with smtplib.SMTP_SSL(creds["host"], creds["port"], timeout=12) as server:
3548
+ server.login(creds["user"], creds["pass"])
3549
+ server.sendmail(creds["from"], [to_email], msg.as_string())
3550
+ else:
3551
+ with smtplib.SMTP(creds["host"], creds["port"], timeout=12) as server:
3552
+ server.starttls()
3553
+ server.login(creds["user"], creds["pass"])
3554
+ server.sendmail(creds["from"], [to_email], msg.as_string())
3555
+
3556
+ log_debug(f"EMAIL [SUCCESS]: Dispatched '{subject}' to {to_email}")
3557
+ return True
3558
+ except Exception as e:
3559
+ log_debug(f"EMAIL [ERROR]: Failed sending '{subject}' to {to_email}: {e}")
3560
+ return False
3561
+
3562
+ def send_welcome_email(to_email: str, username: str, full_name: Optional[str] = None, coupon_code: str = "WELCOME20"):
3563
+ """Dispatches a congratulatory welcome email on successful registration."""
3564
  display_name = full_name or username
3565
  subject = "🎉 Welcome to ArkiTel! You're Now an Official Member"
3566
  frontend_url = os.getenv("FRONTEND_URL", "http://localhost:3000")
 
3576
  h1 {{ font-size: 26px; font-weight: 800; margin: 20px 0 8px 0; color: #ffffff; letter-spacing: -0.5px; line-height: 1.2; }}
3577
  p {{ color: rgba(255,255,255,0.7); font-size: 14px; line-height: 1.6; margin: 12px 0; }}
3578
  .highlight-box {{ background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.25); border-radius: 16px; padding: 20px; margin: 20px 0; }}
3579
+ .coupon-box {{ background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(99,102,241,0.15)); border: 1px dashed #10b981; border-radius: 16px; padding: 18px; margin: 24px 0; text-align: center; }}
3580
+ .coupon-code {{ font-family: monospace; font-size: 24px; font-weight: 900; letter-spacing: 3px; color: #34d399; margin: 8px 0; display: inline-block; background: rgba(16,185,129,0.18); padding: 6px 18px; border-radius: 8px; }}
3581
  .feature-item {{ margin: 8px 0; font-size: 13px; color: rgba(255,255,255,0.85); }}
3582
  .btn {{ display: inline-block; background: #6366f1; color: #ffffff !important; text-decoration: none; font-size: 14px; font-weight: 700; padding: 14px 34px; border-radius: 12px; margin-top: 14px; text-align: center; box-shadow: 0 4px 20px rgba(99,102,241,0.4); }}
3583
  .footer {{ margin-top: 32px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 20px; font-size: 11px; color: rgba(255,255,255,0.35); }}
 
3587
  <div class="card">
3588
  <span class="badge">Official Membership</span>
3589
  <h1>Welcome to ArkiTel, {display_name}!</h1>
3590
+ <p>Congratulations! Your ArkiTel workspace is live and ready. You now have access to our enterprise Telegram outreach, lead extraction & automated broadcasting suite.</p>
3591
 
3592
  <div class="highlight-box">
3593
  <div style="font-size: 11px; color: #818cf8; font-weight: 700; text-transform: uppercase;">Active Membership Plan</div>
 
3606
  <div style="font-size: 11px; font-weight: 700; color: #34d399; text-transform: uppercase; letter-spacing: 1px;">Exclusive Welcome Gift</div>
3607
  <div style="font-size: 15px; font-weight: 700; color: #ffffff; margin-top: 4px;">20% Upgrade Discount Coupon</div>
3608
  <div><span class="coupon-code">{coupon_code}</span></div>
3609
+ <div style="font-size: 11px; color: rgba(255,255,255,0.5);">Apply this code at checkout anytime to save 20% on any Basic, Standard, Premium, or Unlimited tier upgrade! This coupon is also saved under Notifications in your dashboard.</div>
3610
  </div>
3611
 
3612
  <p>Feel free to explore your new dashboard and start setting up your first outreach campaign today.</p>
 
3623
  </body>
3624
  </html>"""
3625
 
3626
+ return dispatch_smtp_email(to_email, subject, html_content)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3627
 
3628
+ def send_welcome_email_async(to_email: str, username: str, full_name: Optional[str] = None, coupon_code: str = "WELCOME20"):
3629
+ """Runs welcome email sending in a non-blocking background thread."""
3630
+ t = threading.Thread(target=send_welcome_email, args=(to_email, username, full_name, coupon_code), daemon=True)
3631
+ t.start()
3632
 
3633
  def send_plan_activation_email(to_email: str, username: str, plan_name: str, expires_at: Optional[str] = None):
3634
  """Dispatches a stylized email to user upon payment verification and plan activation."""
 
 
 
 
 
 
 
 
 
 
3635
  subject = f"🚀 Payment Verified: Your ArkiTel {plan_name.title()} Plan is Active!"
 
3636
  frontend_url = os.getenv("FRONTEND_URL", "http://localhost:3000")
3637
  formatted_date = expires_at[:10] if expires_at else "30-Day Active Cycle"
3638
 
 
3646
  .badge {{ display: inline-block; background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); padding: 6px 14px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }}
3647
  h1 {{ font-size: 24px; font-weight: 800; margin: 20px 0 8px 0; color: #ffffff; letter-spacing: -0.5px; }}
3648
  p {{ color: rgba(255,255,255,0.7); font-size: 14px; line-height: 1.6; margin: 10px 0; }}
3649
+ .plan-box {{ background: rgba(255,255,255,0.03); border: 1px solid rgba(99,102,241,0.3); border-radius: 16px; padding: 20px; margin: 24px 0; }}
3650
  .btn {{ display: inline-block; background: #6366f1; color: #ffffff !important; text-decoration: none; font-size: 13px; font-weight: 700; padding: 14px 32px; border-radius: 12px; margin-top: 14px; text-align: center; }}
3651
  .footer {{ margin-top: 32px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 20px; font-size: 11px; color: rgba(255,255,255,0.35); }}
3652
  </style>
 
3656
  <span class="badge">ArkiTel Fleet Verification</span>
3657
  <h1>Payment Verified & Active!</h1>
3658
  <p>Hello <strong>{username}</strong>,</p>
3659
+ <p>Your payment proof has been successfully confirmed and verified by the ArkiTel team. Your account limits have been unlocked.</p>
3660
 
3661
  <div class="plan-box">
3662
  <div style="font-size: 11px; color: #818cf8; font-weight: 700; text-transform: uppercase;">Activated Membership Tier</div>
3663
  <div style="font-size: 22px; font-weight: 900; color: #ffffff; margin-top: 4px;">{plan_name.title()} Plan</div>
3664
+ <div style="font-size: 12px; color: rgba(255,255,255,0.45); margin-top: 6px;">Status: Verified & Approved | Valid until: {formatted_date}</div>
3665
  </div>
3666
 
3667
  <p>You can now access your Group Scraper, Vault Leads, DM Automation, Multi-Account Fleet, and high-frequency Campaigns without restrictions.</p>
 
3678
  </body>
3679
  </html>"""
3680
 
3681
+ return dispatch_smtp_email(to_email, subject, html_content)
 
 
3682
 
3683
+ def send_plan_activation_email_async(to_email: str, username: str, plan_name: str, expires_at: Optional[str] = None):
3684
+ """Runs plan activation email sending in a non-blocking background thread."""
3685
+ t = threading.Thread(target=send_plan_activation_email, args=(to_email, username, plan_name, expires_at), daemon=True)
3686
+ t.start()
3687
 
3688
+ class SmtpSettingsUpdateRequest(BaseModel):
3689
+ smtp_host: str
3690
+ smtp_port: int
3691
+ smtp_user: str
3692
+ smtp_pass: Optional[str] = None
3693
+ smtp_from: Optional[str] = None
3694
 
3695
+ class TestEmailRequest(BaseModel):
3696
+ to_email: str
3697
 
3698
+ @app.get("/api/admin/system/smtp-settings")
3699
+ async def get_admin_smtp_settings(admin_id: str = Depends(get_current_admin)):
3700
+ creds = get_email_credentials()
3701
+ return {
3702
+ "smtp_host": creds["host"],
3703
+ "smtp_port": creds["port"],
3704
+ "smtp_user": creds["user"],
3705
+ "smtp_from": creds["from"],
3706
+ "is_configured": creds["is_configured"],
3707
+ "has_password": bool(creds["pass"])
3708
+ }
3709
+
3710
+ @app.post("/api/admin/system/smtp-settings")
3711
+ async def update_admin_smtp_settings(req: SmtpSettingsUpdateRequest, admin_id: str = Depends(get_current_admin)):
3712
+ conn = get_db_connection()
3713
+ try:
3714
+ conn.execute("INSERT OR REPLACE INTO system_settings (key, value) VALUES ('smtp_host', ?)", (req.smtp_host.strip(),))
3715
+ conn.execute("INSERT OR REPLACE INTO system_settings (key, value) VALUES ('smtp_port', ?)", (str(req.smtp_port).strip(),))
3716
+ conn.execute("INSERT OR REPLACE INTO system_settings (key, value) VALUES ('smtp_user', ?)", (req.smtp_user.strip(),))
3717
+ if req.smtp_pass is not None and req.smtp_pass != "":
3718
+ conn.execute("INSERT OR REPLACE INTO system_settings (key, value) VALUES ('smtp_pass', ?)", (req.smtp_pass.strip(),))
3719
+ if req.smtp_from:
3720
+ conn.execute("INSERT OR REPLACE INTO system_settings (key, value) VALUES ('smtp_from', ?)", (req.smtp_from.strip(),))
3721
+ if hasattr(conn, "commit"): conn.commit()
3722
+ return {"status": "success", "message": "SMTP settings saved successfully"}
3723
+ finally:
3724
+ if hasattr(conn, "close"): conn.close()
3725
+
3726
+ @app.post("/api/admin/system/test-email")
3727
+ async def send_admin_test_email(req: TestEmailRequest, admin_id: str = Depends(get_current_admin)):
3728
+ creds = get_email_credentials()
3729
+ if not creds["is_configured"]:
3730
+ raise HTTPException(status_code=400, detail="SMTP is not fully configured. Please provide both username and password.")
3731
+
3732
+ test_subject = "🧪 ArkiTel SMTP Email Test"
3733
+ test_html = f"""<div style="font-family: sans-serif; background: #0b0c10; color: #fff; padding: 28px; border-radius: 16px; border: 1px solid #222;">
3734
+ <h2 style="color: #818cf8; margin-top: 0;">ArkiTel SMTP Delivery Verified!</h2>
3735
+ <p>This is a live test email sent directly from your ArkiTel Automation Engine.</p>
3736
+ <p><strong>Configured Host:</strong> {creds['host']}:{creds['port']}</p>
3737
+ <p><strong>Sender:</strong> {creds['from']}</p>
3738
+ <p style="color: #34d399; font-weight: bold;">If you received this message, your welcome and payment approval emails will deliver successfully!</p>
3739
+ </div>"""
3740
+
3741
+ success = dispatch_smtp_email(req.to_email, test_subject, test_html)
3742
+ if success:
3743
+ return {"status": "success", "message": f"Test email successfully dispatched to {req.to_email}!"}
3744
+ else:
3745
+ raise HTTPException(status_code=500, detail="Failed to deliver test email. Check server logs and verify your email/app password.")
3746
 
3747
  class UserVitalsUpdateRequest(BaseModel):
3748
  plan: str
 
3857
  try:
3858
  to_email = (curr_user["email"] if curr_user and curr_user["email"] else curr_user["username"]) if curr_user else None
3859
  if to_email:
3860
+ send_plan_activation_email_async(to_email, curr_user["username"], req.plan, expires_at)
3861
  except Exception as mail_err:
3862
  log_debug(f"Email dispatch error: {mail_err}")
3863
 
 
4335
  )
4336
  if hasattr(conn, "commit"): conn.commit()
4337
 
4338
+ # Send Email Notification (non-blocking)
4339
  user_row = conn.execute("SELECT username, email FROM users WHERE id = ?", (uid,)).fetchone()
4340
  if user_row:
4341
  to_email = user_row["email"] or user_row["username"]
4342
+ send_plan_activation_email_async(to_email, user_row["username"], plan_key, exp_date)
4343
 
4344
  return {"status": "success", "message": f"Payment #{req_id} approved and user upgraded to {plan_key}!"}
4345
  finally:
 
4423
  )
4424
  if hasattr(conn, "commit"): conn.commit()
4425
 
4426
+ # Send Plan Activation Email (non-blocking)
4427
  u_row = conn.execute("SELECT username, email FROM users WHERE id = ?", (user_id,)).fetchone()
4428
  if u_row:
4429
  target_mail = u_row["email"] or u_row["username"]
4430
+ send_plan_activation_email_async(target_mail, u_row["username"], plan_key, exp_date)
4431
  finally:
4432
  if hasattr(conn, "close"): conn.close()
4433
 
 
4473
  )
4474
  if hasattr(conn, "commit"): conn.commit()
4475
 
4476
+ # Dispatch Plan Activation Email (non-blocking)
4477
  target_email = user["email"] or cust_email
4478
+ send_plan_activation_email_async(target_email, user["username"], plan_key, exp_date)
4479
  finally:
4480
  if hasattr(conn, "close"): conn.close()
4481
 
frontend/src/app/admin/page.tsx CHANGED
@@ -38,7 +38,9 @@ import {
38
  Layers,
39
  Flame,
40
  Filter,
41
- Check
 
 
42
  } from 'lucide-react';
43
  import { Preloader } from '@/components/Preloader';
44
  import ComparePage from '@/app/compare/page';
@@ -101,6 +103,22 @@ export default function AdminDashboard() {
101
  const [vpsAutoRefresh, setVpsAutoRefresh] = useState(true);
102
  const [vpsLoading, setVpsLoading] = useState(false);
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  // --- Pagination & Search States ---
105
  // 1. Manage Users (Strictly 15 per page as requested)
106
  const [usersPage, setUsersPage] = useState(1);
@@ -143,6 +161,35 @@ export default function AdminDashboard() {
143
  return () => clearInterval(t);
144
  }, []);
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  const fetchKeywordLogs = async () => {
147
  try {
148
  const res = await apiFetch('/api/admin/keyword-logs');
@@ -3112,6 +3159,177 @@ export default function AdminDashboard() {
3112
  </button>
3113
  </div>
3114
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3115
  </div>
3116
  )}
3117
 
 
38
  Layers,
39
  Flame,
40
  Filter,
41
+ Check,
42
+ Mail,
43
+ Send
44
  } from 'lucide-react';
45
  import { Preloader } from '@/components/Preloader';
46
  import ComparePage from '@/app/compare/page';
 
103
  const [vpsAutoRefresh, setVpsAutoRefresh] = useState(true);
104
  const [vpsLoading, setVpsLoading] = useState(false);
105
 
106
+ // --- SMTP & Email Gateway States ---
107
+ const [smtpConfig, setSmtpConfig] = useState({
108
+ smtp_host: 'smtp.gmail.com',
109
+ smtp_port: 587,
110
+ smtp_user: '',
111
+ smtp_pass: '',
112
+ smtp_from: '',
113
+ is_configured: false,
114
+ has_password: false
115
+ });
116
+ const [loadingSmtp, setLoadingSmtp] = useState(false);
117
+ const [savingSmtp, setSavingSmtp] = useState(false);
118
+ const [testEmailRecipient, setTestEmailRecipient] = useState('');
119
+ const [testingEmail, setTestingEmail] = useState(false);
120
+ const [smtpStatusMsg, setSmtpStatusMsg] = useState('');
121
+
122
  // --- Pagination & Search States ---
123
  // 1. Manage Users (Strictly 15 per page as requested)
124
  const [usersPage, setUsersPage] = useState(1);
 
161
  return () => clearInterval(t);
162
  }, []);
163
 
164
+ const fetchSmtpSettings = async () => {
165
+ try {
166
+ setLoadingSmtp(true);
167
+ const res = await apiFetch('/api/admin/system/smtp-settings');
168
+ if (res.ok) {
169
+ const data = await res.json();
170
+ setSmtpConfig(prev => ({
171
+ ...prev,
172
+ smtp_host: data.smtp_host || 'smtp.gmail.com',
173
+ smtp_port: data.smtp_port || 587,
174
+ smtp_user: data.smtp_user || '',
175
+ smtp_from: data.smtp_from || '',
176
+ is_configured: data.is_configured,
177
+ has_password: data.has_password
178
+ }));
179
+ }
180
+ } catch (e) {
181
+ console.error("Failed to load SMTP settings");
182
+ } finally {
183
+ setLoadingSmtp(false);
184
+ }
185
+ };
186
+
187
+ useEffect(() => {
188
+ if (activeTab === 'settings') {
189
+ fetchSmtpSettings();
190
+ }
191
+ }, [activeTab]);
192
+
193
  const fetchKeywordLogs = async () => {
194
  try {
195
  const res = await apiFetch('/api/admin/keyword-logs');
 
3159
  </button>
3160
  </div>
3161
  </div>
3162
+
3163
+ {/* Email & SMTP Gateway Configuration Card */}
3164
+ <div className="col-span-1 md:col-span-2 bg-[#0e111a] border border-white/10 p-8 rounded-3xl space-y-6 shadow-2xl relative overflow-hidden">
3165
+ <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4 pb-4 border-b border-white/10">
3166
+ <div className="flex items-center gap-3">
3167
+ <div className="p-3 rounded-2xl bg-indigo-500/10 text-indigo-400 border border-indigo-500/20">
3168
+ <Mail size={24} />
3169
+ </div>
3170
+ <div>
3171
+ <h2 className="text-xl font-bold text-white">Email & SMTP Delivery Gateway</h2>
3172
+ <p className="text-xs text-foreground/45 mt-0.5">Powers welcome onboarding emails, coupon delivery, and payment proof activation notices</p>
3173
+ </div>
3174
+ </div>
3175
+ <div className="flex items-center gap-2">
3176
+ <span className={`px-3 py-1 rounded-full text-xs font-bold font-mono border ${
3177
+ smtpConfig.is_configured
3178
+ ? 'bg-emerald-500/10 text-emerald-400 border-emerald-500/30'
3179
+ : 'bg-amber-500/10 text-amber-400 border-amber-500/30'
3180
+ }`}>
3181
+ {smtpConfig.is_configured ? '● SMTP Configured & Active' : '○ SMTP Not Configured'}
3182
+ </span>
3183
+ </div>
3184
+ </div>
3185
+
3186
+ {smtpStatusMsg && (
3187
+ <div className={`p-3.5 rounded-2xl text-xs font-semibold ${
3188
+ smtpStatusMsg.startsWith('✅') ? 'bg-emerald-500/10 border border-emerald-500/30 text-emerald-300' : 'bg-rose-500/10 border border-rose-500/30 text-rose-300'
3189
+ }`}>
3190
+ {smtpStatusMsg}
3191
+ </div>
3192
+ )}
3193
+
3194
+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
3195
+ <div className="space-y-1.5">
3196
+ <label className="text-[11px] font-bold uppercase tracking-wider text-foreground/50">SMTP Host</label>
3197
+ <input
3198
+ type="text"
3199
+ value={smtpConfig.smtp_host}
3200
+ onChange={(e) => setSmtpConfig({ ...smtpConfig, smtp_host: e.target.value })}
3201
+ placeholder="smtp.gmail.com"
3202
+ className="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-xs text-foreground focus:outline-none focus:border-indigo-500"
3203
+ />
3204
+ </div>
3205
+
3206
+ <div className="space-y-1.5">
3207
+ <label className="text-[11px] font-bold uppercase tracking-wider text-foreground/50">SMTP Port (587 TLS or 465 SSL)</label>
3208
+ <input
3209
+ type="number"
3210
+ value={smtpConfig.smtp_port}
3211
+ onChange={(e) => setSmtpConfig({ ...smtpConfig, smtp_port: Number(e.target.value) })}
3212
+ placeholder="587"
3213
+ className="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-xs text-foreground focus:outline-none focus:border-indigo-500"
3214
+ />
3215
+ </div>
3216
+
3217
+ <div className="space-y-1.5">
3218
+ <label className="text-[11px] font-bold uppercase tracking-wider text-foreground/50">SMTP Username / Email</label>
3219
+ <input
3220
+ type="text"
3221
+ value={smtpConfig.smtp_user}
3222
+ onChange={(e) => setSmtpConfig({ ...smtpConfig, smtp_user: e.target.value })}
3223
+ placeholder="arkilostudios@gmail.com"
3224
+ className="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-xs text-foreground focus:outline-none focus:border-indigo-500"
3225
+ />
3226
+ </div>
3227
+
3228
+ <div className="space-y-1.5">
3229
+ <label className="text-[11px] font-bold uppercase tracking-wider text-foreground/50">
3230
+ App Password {smtpConfig.has_password && <span className="text-emerald-400 font-normal">(Saved)</span>}
3231
+ </label>
3232
+ <input
3233
+ type="password"
3234
+ value={smtpConfig.smtp_pass}
3235
+ onChange={(e) => setSmtpConfig({ ...smtpConfig, smtp_pass: e.target.value })}
3236
+ placeholder={smtpConfig.has_password ? "•••••••••••••••• (Leave blank to keep current)" : "16-char Gmail App Password"}
3237
+ className="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-xs text-foreground focus:outline-none focus:border-indigo-500"
3238
+ />
3239
+ </div>
3240
+
3241
+ <div className="sm:col-span-2 space-y-1.5">
3242
+ <label className="text-[11px] font-bold uppercase tracking-wider text-foreground/50">Sender Display Header (From)</label>
3243
+ <input
3244
+ type="text"
3245
+ value={smtpConfig.smtp_from}
3246
+ onChange={(e) => setSmtpConfig({ ...smtpConfig, smtp_from: e.target.value })}
3247
+ placeholder="ArkiTel Automation <arkilostudios@gmail.com>"
3248
+ className="w-full bg-white/5 border border-white/10 rounded-xl px-4 py-3 text-xs text-foreground focus:outline-none focus:border-indigo-500"
3249
+ />
3250
+ </div>
3251
+ </div>
3252
+
3253
+ <div className="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-4 pt-3 border-t border-white/10">
3254
+ <button
3255
+ type="button"
3256
+ onClick={async () => {
3257
+ setSavingSmtp(true);
3258
+ setSmtpStatusMsg('');
3259
+ try {
3260
+ const res = await apiFetch('/api/admin/system/smtp-settings', {
3261
+ method: 'POST',
3262
+ body: JSON.stringify({
3263
+ smtp_host: smtpConfig.smtp_host,
3264
+ smtp_port: Number(smtpConfig.smtp_port),
3265
+ smtp_user: smtpConfig.smtp_user,
3266
+ smtp_pass: smtpConfig.smtp_pass || undefined,
3267
+ smtp_from: smtpConfig.smtp_from || undefined
3268
+ })
3269
+ });
3270
+ if (res.ok) {
3271
+ setSuccessMsg('SMTP credentials saved successfully!');
3272
+ setTimeout(() => setSuccessMsg(''), 4000);
3273
+ fetchSmtpSettings();
3274
+ } else {
3275
+ const data = await res.json();
3276
+ setErrorMsg(data.detail || 'Failed to save SMTP');
3277
+ setTimeout(() => setErrorMsg(''), 4000);
3278
+ }
3279
+ } finally {
3280
+ setSavingSmtp(false);
3281
+ }
3282
+ }}
3283
+ disabled={savingSmtp || !smtpConfig.smtp_user}
3284
+ className="px-6 py-3 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-xs transition-all shadow-lg shadow-indigo-600/25 active:scale-95 disabled:opacity-40 cursor-pointer"
3285
+ >
3286
+ {savingSmtp ? 'Saving Credentials...' : 'Save SMTP Credentials'}
3287
+ </button>
3288
+
3289
+ {/* Live Test Email Tool */}
3290
+ <div className="flex items-center gap-2">
3291
+ <input
3292
+ type="email"
3293
+ value={testEmailRecipient}
3294
+ onChange={(e) => setTestEmailRecipient(e.target.value)}
3295
+ placeholder="test-recipient@gmail.com"
3296
+ className="bg-white/5 border border-white/10 rounded-xl px-3.5 py-2.5 text-xs text-foreground focus:outline-none focus:border-emerald-500 min-w-[200px]"
3297
+ />
3298
+ <button
3299
+ type="button"
3300
+ onClick={async () => {
3301
+ if (!testEmailRecipient || !testEmailRecipient.includes('@')) {
3302
+ alert('Please enter a recipient email to send the test message to.');
3303
+ return;
3304
+ }
3305
+ setTestingEmail(true);
3306
+ setSmtpStatusMsg('');
3307
+ try {
3308
+ const res = await apiFetch('/api/admin/system/test-email', {
3309
+ method: 'POST',
3310
+ body: JSON.stringify({ to_email: testEmailRecipient })
3311
+ });
3312
+ const data = await res.json();
3313
+ if (res.ok) {
3314
+ setSmtpStatusMsg(`✅ Test email successfully dispatched to ${testEmailRecipient}!`);
3315
+ } else {
3316
+ setSmtpStatusMsg(`❌ Delivery Failed: ${data.detail || 'Could not send test email'}`);
3317
+ }
3318
+ } catch (e: any) {
3319
+ setSmtpStatusMsg(`❌ Connection Error: ${e.message}`);
3320
+ } finally {
3321
+ setTestingEmail(false);
3322
+ }
3323
+ }}
3324
+ disabled={testingEmail}
3325
+ className="px-4 py-2.5 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs transition-all shadow-md shadow-emerald-600/20 active:scale-95 disabled:opacity-40 flex items-center gap-1.5 cursor-pointer"
3326
+ >
3327
+ <Send size={13} />
3328
+ <span>{testingEmail ? 'Sending...' : 'Send Test'}</span>
3329
+ </button>
3330
+ </div>
3331
+ </div>
3332
+ </div>
3333
  </div>
3334
  )}
3335
 
frontend/src/app/get-started/page.tsx CHANGED
@@ -14,69 +14,89 @@ import {
14
  Eye,
15
  EyeOff,
16
  Loader2,
17
- CheckCircle2
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  } from "lucide-react";
19
  import { setToken, getApiBase } from "@/lib/auth";
20
 
21
  const COUNTRIES = [
22
- { code: "NG", name: "Nigeria" },
23
- { code: "US", name: "United States" },
24
- { code: "GB", name: "United Kingdom" },
25
- { code: "DE", name: "Germany" },
26
- { code: "FR", name: "France" },
27
- { code: "CA", name: "Canada" },
28
- { code: "AU", name: "Australia" },
29
- { code: "ZA", name: "South Africa" },
30
- { code: "GH", name: "Ghana" },
31
- { code: "KE", name: "Kenya" },
32
- { code: "AE", name: "United Arab Emirates" },
33
- { code: "IN", name: "India" },
34
- { code: "OTHER", name: "Other / International" }
35
  ];
36
 
37
  const BUSINESS_TYPES = [
38
- { id: "crypto", label: "Web3 / Crypto & Token Project", icon: "🚀" },
39
- { id: "agency", label: "Growth Agency & Marketing", icon: "💼" },
40
- { id: "ecommerce", label: "E-Commerce & Dropshipping", icon: "🛍️" },
41
- { id: "realestate", label: "Real Estate & High-Ticket", icon: "🏡" },
42
- { id: "community", label: "Telegram Community Admin", icon: "🌐" },
43
- { id: "affiliate", label: "Affiliate & Solo Creator", icon: "🎯" },
 
44
  ];
45
 
 
 
46
  const GOALS = [
47
  {
48
  id: "broadcast",
49
  title: "High-Volume Broadcasting",
50
- desc: "Automate scheduled outreach to groups with Spintax rotation.",
51
- icon: "📢"
 
52
  },
53
  {
54
  id: "scraper",
55
  title: "Group & Lead Scraping",
56
- desc: "Extract niche discussion groups and active leads into your vault.",
57
- icon: "🎯"
 
58
  },
59
  {
60
  id: "dm",
61
  title: "1-on-1 Direct Messaging",
62
- desc: "Reach out to high-intent members with personalized templates.",
63
- icon: "💬"
 
64
  },
65
  {
66
  id: "fleet",
67
  title: "Multi-Account Fleet",
68
- desc: "Rotate Telegram sessions safely with anti-ban cooldowns.",
69
- icon: "🛡️"
 
70
  }
71
  ];
72
 
73
  const DISCOVERY_SOURCES = [
74
- { id: "tg", label: "Telegram Group / Channel" },
75
- { id: "x", label: "Twitter / X" },
76
- { id: "yt", label: "YouTube" },
77
- { id: "friend", label: "Friend or Referral" },
78
- { id: "google", label: "Google Search" },
79
- { id: "other", label: "Other" }
80
  ];
81
 
82
  export default function GetStartedPage() {
@@ -90,7 +110,9 @@ export default function GetStartedPage() {
90
  const [profilePreview, setProfilePreview] = useState<string | null>(null);
91
  const [isUploadingPhoto, setIsUploadingPhoto] = useState(false);
92
 
 
93
  const [businessType, setBusinessType] = useState("crypto");
 
94
  const [companyName, setCompanyName] = useState("");
95
 
96
  const [platformGoal, setPlatformGoal] = useState("broadcast");
@@ -107,9 +129,11 @@ export default function GetStartedPage() {
107
  const [loading, setLoading] = useState(false);
108
  const [error, setError] = useState("");
109
  const [isSuccess, setIsSuccess] = useState(false);
110
- const [assignedCoupon, setAssignedCoupon] = useState("WELCOME20");
 
111
 
112
  const nameInputRef = useRef<HTMLInputElement>(null);
 
113
 
114
  useEffect(() => {
115
  if (step === 1 && nameInputRef.current) {
@@ -117,12 +141,38 @@ export default function GetStartedPage() {
117
  }
118
  }, [step]);
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  const handleNext = () => {
121
  setError("");
122
  if (step === 1 && !fullName.trim()) {
123
  setError("Please enter your name to continue");
124
  return;
125
  }
 
 
 
 
126
  if (step < totalSteps) {
127
  setStep(prev => prev + 1);
128
  }
@@ -173,7 +223,7 @@ export default function GetStartedPage() {
173
  const data = await res.json();
174
  setProfilePictureUrl(data.url);
175
  } else {
176
- console.warn("Avatar upload failed, will continue without image");
177
  }
178
  } catch (err) {
179
  console.warn("Could not upload avatar immediately", err);
@@ -182,6 +232,17 @@ export default function GetStartedPage() {
182
  }
183
  };
184
 
 
 
 
 
 
 
 
 
 
 
 
185
  // Submit Final Assessment & Credentials
186
  const handleSubmitAssessment = async (e: React.FormEvent) => {
187
  e.preventDefault();
@@ -202,15 +263,18 @@ export default function GetStartedPage() {
202
  try {
203
  const apiBase = getApiBase();
204
  const finalUsername = username.trim() || email.split("@")[0].toLowerCase();
 
 
 
205
 
206
  const payload = {
207
  username: finalUsername,
208
  password,
209
- email,
210
  country,
211
  full_name: fullName.trim(),
212
- profile_picture: profilePictureUrl || null,
213
- business_type: businessType,
214
  company_name: companyName.trim() || null,
215
  platform_goal: platformGoal,
216
  heard_about: heardAbout,
@@ -228,17 +292,16 @@ export default function GetStartedPage() {
228
  if (data.access_token) {
229
  setToken(data.access_token);
230
  }
231
- setAssignedCoupon("WELCOME20");
232
  setIsSuccess(true);
233
 
234
  setTimeout(() => {
235
  router.push("/");
236
- }, 2200);
237
  } else {
238
  setError(data.detail || "Registration failed. Username or email may already be in use.");
239
  }
240
  } catch (err) {
241
- setError("Connection to server failed. Please try again.");
242
  } finally {
243
  setLoading(false);
244
  }
@@ -246,168 +309,299 @@ export default function GetStartedPage() {
246
 
247
  const progressPercent = Math.round((step / totalSteps) * 100);
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  return (
250
- <div className="h-screen max-h-screen overflow-hidden bg-background text-foreground selection:bg-indigo-500/30 font-sans flex flex-col justify-between">
251
 
 
 
 
 
 
 
 
 
252
  {/* Top Navbar */}
253
- <header className="w-full px-5 sm:px-8 py-3.5 flex items-center justify-between border-b border-border/60 shrink-0">
254
- <Link href="/" className="flex items-center gap-2 group">
255
- <div className="w-7 h-7 rounded-lg bg-indigo-600 flex items-center justify-center shadow-md">
256
- <svg className="w-3.5 h-3.5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
257
  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2.5} d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />
258
  </svg>
259
  </div>
260
- <span className="text-xs font-black tracking-wider text-foreground">ARKITEL</span>
 
 
 
261
  </Link>
262
 
263
  {/* Step Progress & Sign-in Link */}
264
- <div className="flex items-center gap-4">
265
- <div className="flex items-center gap-2">
266
- <span className="text-[11px] font-mono text-foreground/40">Step {step}/{totalSteps}</span>
267
- <div className="w-20 sm:w-28 h-1 bg-foreground/10 rounded-full overflow-hidden">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  <div
269
- className="h-full bg-indigo-500 transition-all duration-300"
270
  style={{ width: `${progressPercent}%` }}
271
  />
272
  </div>
273
  </div>
274
- <Link href="/login" className="text-xs text-indigo-400 hover:text-indigo-300 font-semibold transition-colors">
 
 
 
 
 
 
275
  Sign In
276
  </Link>
277
  </div>
278
  </header>
279
 
280
- {/* Main Assessment Container (Centered, No Scroll) */}
281
- <main className="flex-1 flex items-center justify-center p-4">
282
- <div className="w-full max-w-lg mx-auto">
283
 
284
- {/* Success View */}
285
  {isSuccess ? (
286
- <div className="p-6 sm:p-8 rounded-2xl bg-card border border-emerald-500/40 text-center space-y-4 shadow-2xl relative overflow-hidden animate-in zoom-in-95 duration-300">
287
- <div className="absolute top-0 left-1/2 -translate-x-1/2 w-1/2 h-[2px] bg-gradient-to-r from-transparent via-emerald-500 to-transparent"></div>
288
- <div className="w-12 h-12 rounded-2xl bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 flex items-center justify-center mx-auto">
289
- <CheckCircle2 size={28} />
 
290
  </div>
291
 
292
- <div>
293
- <span className="px-2.5 py-0.5 rounded-full bg-emerald-500/10 text-emerald-300 text-[10px] font-black uppercase tracking-wider">
294
- MEMBERSHIP ACTIVE
 
295
  </span>
296
- <h2 className="text-xl sm:text-2xl font-bold text-foreground mt-2">
297
  Welcome to ArkiTel, {fullName || username}!
298
  </h2>
299
- <p className="text-xs text-foreground/60 mt-1">
300
- Your Free Starter Plan is ready. We&apos;ve sent your welcome email with coupon details.
301
  </p>
302
  </div>
303
 
304
  {/* Coupon Gift Box */}
305
- <div className="p-3 rounded-xl bg-input/40 border border-dashed border-emerald-500/40 text-center space-y-0.5">
306
- <div className="text-[9px] uppercase font-bold text-emerald-400">Exclusive 20% Upgrade Coupon</div>
307
- <div className="text-xl font-mono font-black text-foreground tracking-widest">{assignedCoupon}</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  </div>
309
 
310
- <div className="flex items-center justify-center gap-2 text-xs font-mono text-indigo-400 animate-pulse pt-1">
311
- <Loader2 size={13} className="animate-spin" />
312
  <span>Redirecting to your dashboard...</span>
313
  </div>
314
  </div>
315
  ) : (
316
- <div className="p-5 sm:p-7 rounded-2xl bg-card border border-border/80 shadow-2xl relative space-y-5 overflow-hidden">
317
- <div className="absolute top-0 left-1/2 -translate-x-1/2 w-1/2 h-[2px] bg-gradient-to-r from-transparent via-indigo-500 to-transparent"></div>
318
 
 
319
  {error && (
320
- <div className="p-2.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-300 text-xs text-center animate-in fade-in">
321
  {error}
322
  </div>
323
  )}
324
 
325
  {/* STEP 1: Full Name */}
326
  {step === 1 && (
327
- <div className="space-y-4 animate-in fade-in duration-200">
328
- <div>
329
- <span className="text-[10px] font-bold text-indigo-400 uppercase tracking-widest">
330
- Step 1 of 6
331
- </span>
332
- <h2 className="text-xl font-bold text-foreground mt-1">
 
333
  What is your full name?
334
  </h2>
335
- <p className="text-xs text-foreground/50 mt-0.5">
336
- Personalize your ArkiTel fleet workspace.
337
  </p>
338
  </div>
339
 
340
- <input
341
- ref={nameInputRef}
342
- type="text"
343
- value={fullName}
344
- onChange={(e) => setFullName(e.target.value)}
345
- onKeyDown={handleKeyDown}
346
- placeholder="e.g. Alexander Vance"
347
- className="w-full bg-input border border-border/70 focus:border-indigo-500 rounded-xl px-4 py-3 text-sm text-foreground placeholder:text-foreground/30 outline-none transition-all font-medium"
348
- />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  </div>
350
  )}
351
 
352
  {/* STEP 2: Profile Photo */}
353
  {step === 2 && (
354
- <div className="space-y-4 animate-in fade-in duration-200">
355
- <div>
356
- <span className="text-[10px] font-bold text-indigo-400 uppercase tracking-widest">
357
- Step 2 of 6
358
- </span>
359
- <h2 className="text-xl font-bold text-foreground mt-1">
 
360
  Upload your profile photo
361
  </h2>
362
- <p className="text-xs text-foreground/50 mt-0.5">
363
- Optional — you can add or change it later in settings.
364
  </p>
365
  </div>
366
 
367
- <div className="flex items-center gap-4 p-4 rounded-xl bg-input/40 border border-border/70">
368
- <div className="relative w-16 h-16 rounded-full overflow-hidden bg-indigo-600/30 border border-indigo-500/40 flex items-center justify-center shrink-0">
369
  {profilePreview ? (
370
- <img src={profilePreview} alt="Preview" className="w-full h-full object-cover" />
 
 
 
 
371
  ) : (
372
- <User size={26} className="text-foreground/50" />
 
 
373
  )}
 
374
  {isUploadingPhoto && (
375
- <div className="absolute inset-0 bg-black/60 flex items-center justify-center">
376
- <Loader2 size={16} className="animate-spin text-white" />
377
  </div>
378
  )}
379
  </div>
380
 
381
- <div className="flex-1 space-y-1">
382
- <label className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-500 hover:bg-indigo-600 text-white text-xs font-semibold transition-all cursor-pointer">
383
- <Upload size={12} />
384
- <span>Choose Photo</span>
385
- <input
386
- type="file"
387
- accept="image/*"
388
- onChange={handlePhotoSelect}
389
- className="hidden"
390
- />
391
- </label>
392
- <p className="text-[10px] text-foreground/40">PNG, JPG or WebP (max 5MB)</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  </div>
394
  </div>
395
  </div>
396
  )}
397
 
398
- {/* STEP 3: Business Type */}
399
  {step === 3 && (
400
- <div className="space-y-3 animate-in fade-in duration-200">
401
- <div>
402
- <span className="text-[10px] font-bold text-indigo-400 uppercase tracking-widest">
403
- Step 3 of 6
404
- </span>
405
- <h2 className="text-xl font-bold text-foreground mt-1">
 
406
  What is your business type?
407
  </h2>
 
 
 
408
  </div>
409
 
410
- <div className="grid grid-cols-2 gap-2">
 
411
  {BUSINESS_TYPES.map((b) => {
412
  const isSelected = businessType === b.id;
413
  return (
@@ -415,34 +609,69 @@ export default function GetStartedPage() {
415
  key={b.id}
416
  type="button"
417
  onClick={() => setBusinessType(b.id)}
418
- className={`p-2.5 rounded-xl border text-left text-xs transition-all flex items-center gap-2 cursor-pointer ${
419
  isSelected
420
- ? "bg-indigo-500/15 border-indigo-500 text-foreground font-bold"
421
- : "bg-input/50 border-border/70 text-foreground/70 hover:text-foreground hover:bg-input/80 hover:border-border"
422
  }`}
423
  >
424
- <span className="text-sm shrink-0">{b.icon}</span>
425
- <span className="truncate">{b.label}</span>
 
 
 
 
 
 
426
  </button>
427
  );
428
  })}
429
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  </div>
431
  )}
432
 
433
  {/* STEP 4: Platform Goal */}
434
  {step === 4 && (
435
- <div className="space-y-3 animate-in fade-in duration-200">
436
- <div>
437
- <span className="text-[10px] font-bold text-indigo-400 uppercase tracking-widest">
438
- Step 4 of 6
439
- </span>
440
- <h2 className="text-xl font-bold text-foreground mt-1">
 
441
  What is your primary goal?
442
  </h2>
 
 
 
443
  </div>
444
 
445
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
446
  {GOALS.map((g) => {
447
  const isSelected = platformGoal === g.id;
448
  return (
@@ -450,17 +679,22 @@ export default function GetStartedPage() {
450
  key={g.id}
451
  type="button"
452
  onClick={() => setPlatformGoal(g.id)}
453
- className={`p-3 rounded-xl border text-left transition-all cursor-pointer ${
454
  isSelected
455
- ? "bg-indigo-500/15 border-indigo-500 text-foreground"
456
- : "bg-input/50 border-border/70 text-foreground/70 hover:text-foreground hover:bg-input/80"
457
  }`}
458
  >
459
- <div className="flex items-center gap-2">
460
- <span>{g.icon}</span>
461
- <span className="text-xs font-bold text-foreground truncate">{g.title}</span>
 
 
 
 
 
462
  </div>
463
- <p className="text-[10px] text-foreground/50 mt-1 line-clamp-2 leading-relaxed">
464
  {g.desc}
465
  </p>
466
  </button>
@@ -472,17 +706,21 @@ export default function GetStartedPage() {
472
 
473
  {/* STEP 5: Discovery Source */}
474
  {step === 5 && (
475
- <div className="space-y-3 animate-in fade-in duration-200">
476
- <div>
477
- <span className="text-[10px] font-bold text-indigo-400 uppercase tracking-widest">
478
- Step 5 of 6
479
- </span>
480
- <h2 className="text-xl font-bold text-foreground mt-1">
 
481
  Where did you hear about us?
482
  </h2>
 
 
 
483
  </div>
484
 
485
- <div className="grid grid-cols-2 gap-2">
486
  {DISCOVERY_SOURCES.map((s) => {
487
  const isSelected = heardAbout === s.id;
488
  return (
@@ -490,13 +728,15 @@ export default function GetStartedPage() {
490
  key={s.id}
491
  type="button"
492
  onClick={() => setHeardAbout(s.id)}
493
- className={`p-2.5 rounded-xl border text-left text-xs transition-all cursor-pointer ${
494
  isSelected
495
- ? "bg-indigo-500/15 border-indigo-500 text-foreground font-bold"
496
- : "bg-input/50 border-border/70 text-foreground/70 hover:text-foreground hover:bg-input/80"
497
  }`}
498
  >
499
- {s.label}
 
 
500
  </button>
501
  );
502
  })}
@@ -504,97 +744,199 @@ export default function GetStartedPage() {
504
  </div>
505
  )}
506
 
507
- {/* STEP 6: Credentials */}
508
  {step === 6 && (
509
- <form onSubmit={handleSubmitAssessment} className="space-y-3 animate-in fade-in duration-200">
510
- <div>
511
- <span className="text-[10px] font-bold text-indigo-400 uppercase tracking-widest">
512
- Step 6 of 6 • Create Account
513
- </span>
514
- <h2 className="text-xl font-bold text-foreground mt-0.5">
 
515
  Set up your credentials
516
  </h2>
 
 
 
517
  </div>
518
 
519
- <div className="space-y-2">
520
- <input
521
- type="email"
522
- value={email}
523
- onChange={(e) => setEmail(e.target.value)}
524
- placeholder="Work Email Address"
525
- required
526
- className="w-full bg-input border border-border/70 focus:border-indigo-500 rounded-xl px-3.5 py-2.5 text-xs text-foreground placeholder:text-foreground/30 outline-none"
527
- />
528
-
529
- <div className="grid grid-cols-2 gap-2">
530
- <input
531
- type="text"
532
- value={username}
533
- onChange={(e) => setUsername(e.target.value)}
534
- placeholder="Username"
535
- className="w-full bg-input border border-border/70 focus:border-indigo-500 rounded-xl px-3.5 py-2.5 text-xs text-foreground placeholder:text-foreground/30 outline-none"
536
- />
537
-
538
- <select
539
- value={country}
540
- onChange={(e) => setCountry(e.target.value)}
541
- className="w-full bg-input border border-border/70 focus:border-indigo-500 rounded-xl px-3 py-2.5 text-xs text-foreground outline-none"
542
- >
543
- {COUNTRIES.map(c => (
544
- <option key={c.code} value={c.name} className="bg-card text-foreground">
545
- {c.name}
546
- </option>
547
- ))}
548
- </select>
549
  </div>
 
 
 
 
550
 
551
- <div className="relative">
 
 
 
 
 
 
 
 
 
 
552
  <input
553
- type={showPassword ? "text" : "password"}
554
- value={password}
555
- onChange={(e) => setPassword(e.target.value)}
556
- placeholder="Create Password (min 6 chars)"
557
  required
558
- className="w-full bg-input border border-border/70 focus:border-indigo-500 rounded-xl px-3.5 py-2.5 pr-9 text-xs text-foreground placeholder:text-foreground/30 outline-none"
559
  />
560
- <button
561
- type="button"
562
- onClick={() => setShowPassword(!showPassword)}
563
- className="absolute right-3 top-1/2 -translate-y-1/2 text-foreground/40 hover:text-foreground"
564
- >
565
- {showPassword ? <EyeOff size={14} /> : <Eye size={14} />}
566
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
567
  </div>
568
  </div>
569
 
 
570
  <button
571
  type="submit"
572
  disabled={loading}
573
- className="w-full py-2.5 rounded-xl bg-indigo-500 hover:bg-indigo-600 text-white text-xs font-bold transition-all shadow-md flex items-center justify-center gap-1.5 cursor-pointer disabled:opacity-50"
574
  >
575
  {loading ? (
576
  <>
577
- <Loader2 size={13} className="animate-spin" />
578
- <span>Creating Workspace...</span>
579
  </>
580
  ) : (
581
  <>
 
582
  <span>Launch ArkiTel Workspace</span>
583
- <ArrowRight size={13} />
584
  </>
585
  )}
586
  </button>
 
 
 
 
 
 
 
 
 
587
  </form>
588
  )}
589
 
590
- {/* Inline Navigation Buttons for Steps 1-5 */}
591
  {step < 6 && (
592
- <div className="flex items-center justify-between pt-2 border-t border-border/50">
593
  {step > 1 ? (
594
  <button
595
  type="button"
596
  onClick={handleBack}
597
- className="px-3 py-1.5 rounded-lg text-xs font-semibold text-foreground/60 hover:text-foreground hover:bg-foreground/5 transition-all flex items-center gap-1 cursor-pointer"
598
  >
599
  <ArrowLeft size={13} />
600
  <span>Back</span>
@@ -604,10 +946,10 @@ export default function GetStartedPage() {
604
  <button
605
  type="button"
606
  onClick={handleNext}
607
- className="px-4 py-2 rounded-xl bg-indigo-500 hover:bg-indigo-600 text-white text-xs font-bold transition-all flex items-center gap-1.5 cursor-pointer shadow-sm active:scale-95"
608
  >
609
  <span>{step === 2 && !profilePreview ? "Skip for now" : "Continue"}</span>
610
- <ArrowRight size={13} />
611
  </button>
612
  </div>
613
  )}
@@ -619,8 +961,10 @@ export default function GetStartedPage() {
619
  </main>
620
 
621
  {/* Footer Branding */}
622
- <footer className="w-full py-3 text-center text-[10px] text-white/30 border-t border-border/40 shrink-0">
623
- ArkiTel Automation Engine • Enterprise Telegram Growth
 
 
624
  </footer>
625
 
626
  </div>
 
14
  Eye,
15
  EyeOff,
16
  Loader2,
17
+ CheckCircle2,
18
+ ShieldCheck,
19
+ Globe,
20
+ Sparkles,
21
+ Copy,
22
+ CheckCheck,
23
+ Briefcase,
24
+ Target,
25
+ Compass,
26
+ PenTool,
27
+ Zap,
28
+ Layers,
29
+ MessageSquare,
30
+ Bot
31
  } from "lucide-react";
32
  import { setToken, getApiBase } from "@/lib/auth";
33
 
34
  const COUNTRIES = [
35
+ { code: "NG", name: "Nigeria", flag: "🇳🇬" },
36
+ { code: "US", name: "United States", flag: "🇺🇸" },
37
+ { code: "GB", name: "United Kingdom", flag: "🇬🇧" },
38
+ { code: "CA", name: "Canada", flag: "🇨🇦" },
39
+ { code: "DE", name: "Germany", flag: "🇩🇪" },
40
+ { code: "FR", name: "France", flag: "🇫🇷" },
41
+ { code: "AU", name: "Australia", flag: "🇦🇺" },
42
+ { code: "ZA", name: "South Africa", flag: "🇿🇦" },
43
+ { code: "GH", name: "Ghana", flag: "🇬🇭" },
44
+ { code: "KE", name: "Kenya", flag: "🇰🇪" },
45
+ { code: "AE", name: "United Arab Emirates", flag: "🇦🇪" },
46
+ { code: "IN", name: "India", flag: "🇮🇳" },
47
+ { code: "OTHER", name: "Other / International", flag: "🌐" }
48
  ];
49
 
50
  const BUSINESS_TYPES = [
51
+ { id: "crypto", label: "Web3 / Crypto & Token Project", icon: "🚀", desc: "Shilling, community growth & token launches" },
52
+ { id: "agency", label: "Growth Agency & Marketing", icon: "💼", desc: "Client lead gen & outreach pipelines" },
53
+ { id: "ecommerce", label: "E-Commerce & Dropshipping", icon: "🛍️", desc: "Customer acquisition & flash deals" },
54
+ { id: "realestate", label: "Real Estate & High-Ticket", icon: "🏡", desc: "High-net-worth investor acquisition" },
55
+ { id: "community", label: "Telegram Community Admin", icon: "🌐", desc: "Automated group growth & engagement" },
56
+ { id: "affiliate", label: "Affiliate & Solo Creator", icon: "🎯", desc: "Direct traffic & niche conversion funnels" },
57
+ { id: "custom", label: "Other / Custom Industry", icon: "✍️", desc: "Type your own specific business or niche" },
58
  ];
59
 
60
+ const PRESET_AVATARS = ["🚀", "👑", "⚡", "💎", "🤖", "🎯"];
61
+
62
  const GOALS = [
63
  {
64
  id: "broadcast",
65
  title: "High-Volume Broadcasting",
66
+ badge: "Most Popular",
67
+ desc: "Automate scheduled outreach to groups with Spintax rotation and anti-ban delays.",
68
+ icon: <Zap className="text-amber-400" size={18} />
69
  },
70
  {
71
  id: "scraper",
72
  title: "Group & Lead Scraping",
73
+ badge: "High Throughput",
74
+ desc: "Extract niche discussion groups and active members into your exportable lead vault.",
75
+ icon: <Target className="text-indigo-400" size={18} />
76
  },
77
  {
78
  id: "dm",
79
  title: "1-on-1 Direct Messaging",
80
+ badge: "Direct Sales",
81
+ desc: "Reach out to high-intent Telegram users with personalized Spintax templates.",
82
+ icon: <MessageSquare className="text-emerald-400" size={18} />
83
  },
84
  {
85
  id: "fleet",
86
  title: "Multi-Account Fleet",
87
+ badge: "Scale & Safety",
88
+ desc: "Rotate multiple Telegram sessions automatically with distributed cooldown protection.",
89
+ icon: <Layers className="text-cyan-400" size={18} />
90
  }
91
  ];
92
 
93
  const DISCOVERY_SOURCES = [
94
+ { id: "tg", label: "Telegram Group / Channel", icon: "✈️" },
95
+ { id: "x", label: "Twitter / X", icon: "𝕏" },
96
+ { id: "yt", label: "YouTube", icon: "▶️" },
97
+ { id: "friend", label: "Friend or Referral", icon: "🤝" },
98
+ { id: "google", label: "Google Search", icon: "🔍" },
99
+ { id: "other", label: "Other Channels", icon: "🌐" }
100
  ];
101
 
102
  export default function GetStartedPage() {
 
110
  const [profilePreview, setProfilePreview] = useState<string | null>(null);
111
  const [isUploadingPhoto, setIsUploadingPhoto] = useState(false);
112
 
113
+ // Business Type State (including custom option)
114
  const [businessType, setBusinessType] = useState("crypto");
115
+ const [customBusinessType, setCustomBusinessType] = useState("");
116
  const [companyName, setCompanyName] = useState("");
117
 
118
  const [platformGoal, setPlatformGoal] = useState("broadcast");
 
129
  const [loading, setLoading] = useState(false);
130
  const [error, setError] = useState("");
131
  const [isSuccess, setIsSuccess] = useState(false);
132
+ const [assignedCoupon] = useState("WELCOME20");
133
+ const [copiedCoupon, setCopiedCoupon] = useState(false);
134
 
135
  const nameInputRef = useRef<HTMLInputElement>(null);
136
+ const customBusinessRef = useRef<HTMLInputElement>(null);
137
 
138
  useEffect(() => {
139
  if (step === 1 && nameInputRef.current) {
 
141
  }
142
  }, [step]);
143
 
144
+ useEffect(() => {
145
+ if (step === 3 && businessType === "custom" && customBusinessRef.current) {
146
+ customBusinessRef.current.focus();
147
+ }
148
+ }, [step, businessType]);
149
+
150
+ // Password strength calculation
151
+ const getPasswordStrength = (pass: string) => {
152
+ if (!pass) return { score: 0, label: "Too Short", color: "bg-white/10" };
153
+ if (pass.length < 6) return { score: 1, label: "Weak (min 6 chars)", color: "bg-rose-500" };
154
+ let score = 1;
155
+ if (pass.length >= 8) score++;
156
+ if (/[A-Z]/.test(pass) && /[0-9]/.test(pass)) score++;
157
+ if (/[^A-Za-z0-9]/.test(pass)) score++;
158
+
159
+ if (score === 2) return { score: 2, label: "Fair", color: "bg-amber-500" };
160
+ if (score === 3) return { score: 3, label: "Good", color: "bg-indigo-400" };
161
+ return { score: 4, label: "Strong & Secure", color: "bg-emerald-400" };
162
+ };
163
+
164
+ const passwordStrength = getPasswordStrength(password);
165
+
166
  const handleNext = () => {
167
  setError("");
168
  if (step === 1 && !fullName.trim()) {
169
  setError("Please enter your name to continue");
170
  return;
171
  }
172
+ if (step === 3 && businessType === "custom" && !customBusinessType.trim()) {
173
+ setError("Please type your custom business or industry name, or pick an option above");
174
+ return;
175
+ }
176
  if (step < totalSteps) {
177
  setStep(prev => prev + 1);
178
  }
 
223
  const data = await res.json();
224
  setProfilePictureUrl(data.url);
225
  } else {
226
+ console.warn("Avatar upload failed, will continue with preview");
227
  }
228
  } catch (err) {
229
  console.warn("Could not upload avatar immediately", err);
 
232
  }
233
  };
234
 
235
+ const handlePresetAvatar = (emoji: string) => {
236
+ setProfilePictureUrl("");
237
+ setProfilePreview(emoji);
238
+ };
239
+
240
+ const handleCopyCoupon = () => {
241
+ navigator.clipboard.writeText(assignedCoupon);
242
+ setCopiedCoupon(true);
243
+ setTimeout(() => setCopiedCoupon(false), 2500);
244
+ };
245
+
246
  // Submit Final Assessment & Credentials
247
  const handleSubmitAssessment = async (e: React.FormEvent) => {
248
  e.preventDefault();
 
263
  try {
264
  const apiBase = getApiBase();
265
  const finalUsername = username.trim() || email.split("@")[0].toLowerCase();
266
+ const resolvedBusinessType = businessType === "custom"
267
+ ? (customBusinessType.trim() || "Custom Business")
268
+ : businessType;
269
 
270
  const payload = {
271
  username: finalUsername,
272
  password,
273
+ email: email.trim(),
274
  country,
275
  full_name: fullName.trim(),
276
+ profile_picture: profilePictureUrl || (profilePreview && !profilePreview.startsWith("blob:") ? profilePreview : null),
277
+ business_type: resolvedBusinessType,
278
  company_name: companyName.trim() || null,
279
  platform_goal: platformGoal,
280
  heard_about: heardAbout,
 
292
  if (data.access_token) {
293
  setToken(data.access_token);
294
  }
 
295
  setIsSuccess(true);
296
 
297
  setTimeout(() => {
298
  router.push("/");
299
+ }, 2600);
300
  } else {
301
  setError(data.detail || "Registration failed. Username or email may already be in use.");
302
  }
303
  } catch (err) {
304
+ setError("Connection to server failed. Please check your network and try again.");
305
  } finally {
306
  setLoading(false);
307
  }
 
309
 
310
  const progressPercent = Math.round((step / totalSteps) * 100);
311
 
312
+ // Selected business label helper
313
+ const getSelectedBusinessLabel = () => {
314
+ if (businessType === "custom") {
315
+ return customBusinessType.trim() || "Custom Industry";
316
+ }
317
+ const found = BUSINESS_TYPES.find(b => b.id === businessType);
318
+ return found ? found.label : "Web3 / Crypto";
319
+ };
320
+
321
+ // Initials for avatar
322
+ const getInitials = (name: string) => {
323
+ if (!name) return "AK";
324
+ const parts = name.trim().split(" ");
325
+ if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
326
+ return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
327
+ };
328
+
329
  return (
330
+ <div className="min-h-screen relative overflow-x-hidden bg-[#07090e] text-foreground font-sans flex flex-col justify-between selection:bg-indigo-500/30">
331
 
332
+ {/* Background Decorative Mesh & Glow Orbs */}
333
+ <div className="fixed inset-0 pointer-events-none z-0 overflow-hidden">
334
+ <div className="absolute -top-40 -left-40 w-96 h-96 bg-indigo-600/15 rounded-full blur-[120px]" />
335
+ <div className="absolute top-1/3 -right-40 w-96 h-96 bg-violet-600/15 rounded-full blur-[140px]" />
336
+ <div className="absolute -bottom-40 left-1/3 w-96 h-96 bg-emerald-600/10 rounded-full blur-[140px]" />
337
+ <div className="absolute inset-0 bg-[linear-gradient(to_right,#ffffff05_1px,transparent_1px),linear-gradient(to_bottom,#ffffff05_1px,transparent_1px)] bg-[size:3rem_3rem] [mask-image:radial-gradient(ellipse_60%_50%_at_50%_50%,#000_70%,transparent_100%)] opacity-30" />
338
+ </div>
339
+
340
  {/* Top Navbar */}
341
+ <header className="relative z-10 w-full px-5 sm:px-10 py-4 flex items-center justify-between border-b border-white/[0.07] bg-[#07090e]/80 backdrop-blur-md shrink-0">
342
+ <Link href="/" className="flex items-center gap-2.5 group">
343
+ <div className="w-8 h-8 rounded-xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center shadow-lg shadow-indigo-500/25 group-hover:scale-105 transition-transform">
344
+ <svg className="w-4 h-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
345
  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2.5} d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />
346
  </svg>
347
  </div>
348
+ <div className="flex flex-col">
349
+ <span className="text-xs font-black tracking-widest text-white">ARKITEL</span>
350
+ <span className="text-[9px] font-mono text-indigo-400 font-bold uppercase tracking-wider">Growth Engine</span>
351
+ </div>
352
  </Link>
353
 
354
  {/* Step Progress & Sign-in Link */}
355
+ <div className="flex items-center gap-5">
356
+ <div className="flex items-center gap-3">
357
+ <div className="hidden sm:flex items-center gap-1.5">
358
+ {[1, 2, 3, 4, 5, 6].map((s) => (
359
+ <div
360
+ key={s}
361
+ className={`w-2 h-2 rounded-full transition-all duration-300 ${
362
+ s < step
363
+ ? "bg-emerald-400 w-3"
364
+ : s === step
365
+ ? "bg-indigo-500 w-5 shadow-[0_0_8px_rgba(99,102,241,0.8)]"
366
+ : "bg-white/15"
367
+ }`}
368
+ />
369
+ ))}
370
+ </div>
371
+ <span className="text-xs font-mono font-bold text-white/50">
372
+ Step <span className="text-indigo-400 font-bold">{step}</span>/{totalSteps}
373
+ </span>
374
+ <div className="w-16 sm:w-24 h-1.5 bg-white/10 rounded-full overflow-hidden p-[1px]">
375
  <div
376
+ className="h-full bg-gradient-to-r from-indigo-500 via-violet-400 to-emerald-400 rounded-full transition-all duration-300 shadow-[0_0_10px_rgba(99,102,241,0.5)]"
377
  style={{ width: `${progressPercent}%` }}
378
  />
379
  </div>
380
  </div>
381
+
382
+ <div className="h-4 w-[1px] bg-white/10" />
383
+
384
+ <Link
385
+ href="/login"
386
+ className="text-xs font-semibold text-white/70 hover:text-white px-3 py-1.5 rounded-lg border border-white/10 hover:border-white/20 hover:bg-white/5 transition-all"
387
+ >
388
  Sign In
389
  </Link>
390
  </div>
391
  </header>
392
 
393
+ {/* Main Assessment Container (Centered Card) */}
394
+ <main className="relative z-10 flex-1 flex items-center justify-center p-4 sm:p-6 my-auto">
395
+ <div className="w-full max-w-xl mx-auto">
396
 
397
+ {/* Success Celebration View */}
398
  {isSuccess ? (
399
+ <div className="p-8 sm:p-10 rounded-3xl bg-[#0d1017]/95 border border-emerald-500/40 text-center space-y-6 shadow-2xl relative overflow-hidden animate-in zoom-in-95 duration-300 backdrop-blur-xl">
400
+ <div className="absolute top-0 left-0 right-0 h-[2px] bg-gradient-to-r from-transparent via-emerald-400 to-transparent" />
401
+
402
+ <div className="relative mx-auto w-16 h-16 rounded-2xl bg-gradient-to-tr from-emerald-500/20 to-indigo-500/20 border border-emerald-500/30 text-emerald-400 flex items-center justify-center shadow-lg shadow-emerald-500/20">
403
+ <CheckCircle2 size={36} className="text-emerald-400 animate-pulse" />
404
  </div>
405
 
406
+ <div className="space-y-1.5">
407
+ <span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 text-[10px] font-black uppercase tracking-widest">
408
+ <Sparkles size={11} />
409
+ MEMBERSHIP UNLOCKED
410
  </span>
411
+ <h2 className="text-2xl sm:text-3xl font-black text-white tracking-tight">
412
  Welcome to ArkiTel, {fullName || username}!
413
  </h2>
414
+ <p className="text-xs sm:text-sm text-white/60 max-w-md mx-auto leading-relaxed">
415
+ Your Free Starter Plan has been activated. A welcome message containing your coupon code has been dispatched to your email.
416
  </p>
417
  </div>
418
 
419
  {/* Coupon Gift Box */}
420
+ <div className="p-4 rounded-2xl bg-gradient-to-br from-[#121622] to-[#0a0d14] border border-emerald-500/30 text-center space-y-2 relative overflow-hidden group">
421
+ <div className="flex items-center justify-center gap-1.5 text-[10px] uppercase font-bold text-emerald-400 tracking-wider">
422
+ <Sparkles size={12} />
423
+ <span>Exclusive Welcome Gift (20% Off Upgrades)</span>
424
+ </div>
425
+
426
+ <div className="flex items-center justify-center gap-2">
427
+ <div className="text-2xl sm:text-3xl font-mono font-black text-white tracking-widest bg-emerald-500/10 px-4 py-1.5 rounded-xl border border-emerald-500/20">
428
+ {assignedCoupon}
429
+ </div>
430
+ <button
431
+ type="button"
432
+ onClick={handleCopyCoupon}
433
+ className="p-2.5 rounded-xl bg-white/5 hover:bg-white/10 text-white/70 hover:text-white border border-white/10 transition-all flex items-center gap-1 text-xs font-semibold"
434
+ title="Copy coupon code"
435
+ >
436
+ {copiedCoupon ? <CheckCheck size={16} className="text-emerald-400" /> : <Copy size={16} />}
437
+ </button>
438
+ </div>
439
+
440
+ <p className="text-[11px] text-white/45">
441
+ Saved under notifications in your dashboard. Valid for Basic, Standard, Premium, and Unlimited tiers!
442
+ </p>
443
  </div>
444
 
445
+ <div className="flex items-center justify-center gap-2.5 text-xs font-mono text-indigo-400 animate-pulse pt-2">
446
+ <Loader2 size={15} className="animate-spin" />
447
  <span>Redirecting to your dashboard...</span>
448
  </div>
449
  </div>
450
  ) : (
451
+ <div className="p-6 sm:p-8 rounded-3xl bg-[#0d1017]/95 border border-white/[0.08] shadow-[0_0_50px_-10px_rgba(99,102,241,0.18)] relative space-y-6 overflow-hidden backdrop-blur-xl">
452
+ <div className="absolute top-0 left-0 right-0 h-[2px] bg-gradient-to-r from-transparent via-indigo-500 to-transparent" />
453
 
454
+ {/* Error Alert */}
455
  {error && (
456
+ <div className="p-3.5 rounded-2xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-xs font-medium text-center animate-in fade-in duration-200">
457
  {error}
458
  </div>
459
  )}
460
 
461
  {/* STEP 1: Full Name */}
462
  {step === 1 && (
463
+ <div className="space-y-5 animate-in fade-in duration-200">
464
+ <div className="space-y-1">
465
+ <div className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-indigo-500/10 border border-indigo-500/25 text-indigo-300 text-[10px] font-bold uppercase tracking-widest">
466
+ <User size={11} />
467
+ Step 1 of 6 • Identity
468
+ </div>
469
+ <h2 className="text-2xl font-black text-white tracking-tight">
470
  What is your full name?
471
  </h2>
472
+ <p className="text-xs text-white/50 leading-relaxed">
473
+ Personalize your ArkiTel workspace, automation fleet signatures, and dashboard greetings.
474
  </p>
475
  </div>
476
 
477
+ <div className="space-y-3">
478
+ <div className="relative group">
479
+ <div className="absolute left-4 top-1/2 -translate-y-1/2 text-white/30 group-focus-within:text-indigo-400 transition-colors">
480
+ <User size={18} />
481
+ </div>
482
+ <input
483
+ ref={nameInputRef}
484
+ type="text"
485
+ value={fullName}
486
+ onChange={(e) => setFullName(e.target.value)}
487
+ onKeyDown={handleKeyDown}
488
+ placeholder="e.g. Alexander Vance"
489
+ className="w-full bg-[#11141d] border border-white/10 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 rounded-2xl pl-11 pr-4 py-3.5 text-sm text-white placeholder:text-white/25 outline-none transition-all font-medium"
490
+ />
491
+ </div>
492
+
493
+ {fullName.trim() && (
494
+ <div className="p-3 rounded-xl bg-indigo-500/10 border border-indigo-500/20 text-xs text-indigo-300 flex items-center gap-2 animate-in fade-in">
495
+ <Sparkles size={14} className="text-indigo-400 shrink-0" />
496
+ <span>Welcome aboard, <strong className="text-white">{fullName}</strong>! Press Enter ↵ or click Continue.</span>
497
+ </div>
498
+ )}
499
+ </div>
500
  </div>
501
  )}
502
 
503
  {/* STEP 2: Profile Photo */}
504
  {step === 2 && (
505
+ <div className="space-y-5 animate-in fade-in duration-200">
506
+ <div className="space-y-1">
507
+ <div className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-indigo-500/10 border border-indigo-500/25 text-indigo-300 text-[10px] font-bold uppercase tracking-widest">
508
+ <Upload size={11} />
509
+ Step 2 of 6 • Profile Avatar
510
+ </div>
511
+ <h2 className="text-2xl font-black text-white tracking-tight">
512
  Upload your profile photo
513
  </h2>
514
+ <p className="text-xs text-white/50 leading-relaxed">
515
+ Optional — you can upload your custom photo, choose a preset avatar, or skip this step.
516
  </p>
517
  </div>
518
 
519
+ <div className="flex flex-col sm:flex-row items-center gap-5 p-5 rounded-2xl bg-[#11141d] border border-white/10">
520
+ <div className="relative w-20 h-20 rounded-2xl overflow-hidden bg-gradient-to-tr from-indigo-600/30 to-violet-600/30 border-2 border-indigo-500/40 flex items-center justify-center shrink-0 shadow-lg shadow-indigo-500/10">
521
  {profilePreview ? (
522
+ profilePreview.startsWith("blob:") || profilePreview.startsWith("http") ? (
523
+ <img src={profilePreview} alt="Preview" className="w-full h-full object-cover" />
524
+ ) : (
525
+ <span className="text-3xl">{profilePreview}</span>
526
+ )
527
  ) : (
528
+ <span className="text-xl font-bold font-mono text-indigo-300">
529
+ {getInitials(fullName)}
530
+ </span>
531
  )}
532
+
533
  {isUploadingPhoto && (
534
+ <div className="absolute inset-0 bg-black/70 flex items-center justify-center">
535
+ <Loader2 size={20} className="animate-spin text-indigo-400" />
536
  </div>
537
  )}
538
  </div>
539
 
540
+ <div className="flex-1 space-y-2.5 text-center sm:text-left">
541
+ <div className="flex flex-wrap items-center justify-center sm:justify-start gap-2">
542
+ <label className="inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-bold transition-all cursor-pointer shadow-md shadow-indigo-600/25 active:scale-95">
543
+ <Upload size={14} />
544
+ <span>Choose Photo</span>
545
+ <input
546
+ type="file"
547
+ accept="image/*"
548
+ onChange={handlePhotoSelect}
549
+ className="hidden"
550
+ />
551
+ </label>
552
+ {profilePreview && (
553
+ <button
554
+ type="button"
555
+ onClick={() => { setProfilePreview(null); setProfilePictureUrl(""); }}
556
+ className="text-xs text-white/40 hover:text-rose-400 font-semibold px-2 py-1 transition-colors"
557
+ >
558
+ Remove
559
+ </button>
560
+ )}
561
+ </div>
562
+
563
+ <div className="space-y-1">
564
+ <div className="text-[11px] text-white/40">Or pick a preset avatar:</div>
565
+ <div className="flex items-center justify-center sm:justify-start gap-1.5">
566
+ {PRESET_AVATARS.map((emoji) => (
567
+ <button
568
+ key={emoji}
569
+ type="button"
570
+ onClick={() => handlePresetAvatar(emoji)}
571
+ className={`w-7 h-7 rounded-lg text-sm flex items-center justify-center transition-all ${
572
+ profilePreview === emoji
573
+ ? "bg-indigo-500/30 border border-indigo-400 scale-110"
574
+ : "bg-white/5 hover:bg-white/10 border border-white/5"
575
+ }`}
576
+ >
577
+ {emoji}
578
+ </button>
579
+ ))}
580
+ </div>
581
+ </div>
582
  </div>
583
  </div>
584
  </div>
585
  )}
586
 
587
+ {/* STEP 3: Business Type + Custom Input Option */}
588
  {step === 3 && (
589
+ <div className="space-y-4 animate-in fade-in duration-200">
590
+ <div className="space-y-1">
591
+ <div className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-indigo-500/10 border border-indigo-500/25 text-indigo-300 text-[10px] font-bold uppercase tracking-widest">
592
+ <Briefcase size={11} />
593
+ Step 3 of 6 • Industry & Niche
594
+ </div>
595
+ <h2 className="text-2xl font-black text-white tracking-tight">
596
  What is your business type?
597
  </h2>
598
+ <p className="text-xs text-white/50 leading-relaxed">
599
+ Select your niche below, or choose &quot;Other / Custom Industry&quot; to type your own if not listed.
600
+ </p>
601
  </div>
602
 
603
+ {/* Business Type Grid */}
604
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-2 max-h-[260px] overflow-y-auto pr-1">
605
  {BUSINESS_TYPES.map((b) => {
606
  const isSelected = businessType === b.id;
607
  return (
 
609
  key={b.id}
610
  type="button"
611
  onClick={() => setBusinessType(b.id)}
612
+ className={`p-3 rounded-2xl border text-left transition-all flex items-start gap-2.5 cursor-pointer relative group ${
613
  isSelected
614
+ ? "bg-gradient-to-r from-indigo-600/20 to-violet-600/15 border-indigo-500 shadow-md shadow-indigo-500/10"
615
+ : "bg-[#11141d]/70 border-white/[0.08] hover:border-white/20 hover:bg-[#11141d]"
616
  }`}
617
  >
618
+ <span className="text-lg shrink-0 p-1 rounded-lg bg-white/5 border border-white/5">{b.icon}</span>
619
+ <div className="flex-1 min-w-0">
620
+ <div className="text-xs font-bold text-white truncate flex items-center justify-between">
621
+ <span>{b.label}</span>
622
+ {isSelected && <Check size={13} className="text-indigo-400 shrink-0 ml-1" />}
623
+ </div>
624
+ <p className="text-[10px] text-white/45 truncate mt-0.5">{b.desc}</p>
625
+ </div>
626
  </button>
627
  );
628
  })}
629
  </div>
630
+
631
+ {/* CUSTOM TEXT INPUT FIELD: Triggered if "custom" is selected or user wants custom */}
632
+ {businessType === "custom" && (
633
+ <div className="p-3.5 rounded-2xl bg-indigo-500/10 border border-indigo-500/30 space-y-2 animate-in fade-in slide-in-from-top-2 duration-200">
634
+ <div className="flex items-center justify-between text-[11px] font-bold text-indigo-300">
635
+ <span className="flex items-center gap-1.5">
636
+ <PenTool size={12} />
637
+ Type your custom business / niche
638
+ </span>
639
+ <span className="text-[10px] text-white/40 font-mono">Custom Input</span>
640
+ </div>
641
+ <input
642
+ ref={customBusinessRef}
643
+ type="text"
644
+ value={customBusinessType}
645
+ onChange={(e) => setCustomBusinessType(e.target.value)}
646
+ onKeyDown={handleKeyDown}
647
+ placeholder="e.g. EdTech & Online Courses, SaaS Software, FinTech, Forex..."
648
+ className="w-full bg-[#0a0d14] border border-indigo-500/40 focus:border-indigo-400 rounded-xl px-3.5 py-2.5 text-xs text-white placeholder:text-white/25 outline-none transition-all"
649
+ />
650
+ <p className="text-[10px] text-white/40">
651
+ Your custom business niche will be saved to your profile and used to calibrate AI Spintax and leads.
652
+ </p>
653
+ </div>
654
+ )}
655
  </div>
656
  )}
657
 
658
  {/* STEP 4: Platform Goal */}
659
  {step === 4 && (
660
+ <div className="space-y-4 animate-in fade-in duration-200">
661
+ <div className="space-y-1">
662
+ <div className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-indigo-500/10 border border-indigo-500/25 text-indigo-300 text-[10px] font-bold uppercase tracking-widest">
663
+ <Target size={11} />
664
+ Step 4 of 6 • Automation Objective
665
+ </div>
666
+ <h2 className="text-2xl font-black text-white tracking-tight">
667
  What is your primary goal?
668
  </h2>
669
+ <p className="text-xs text-white/50 leading-relaxed">
670
+ Select what you want to achieve first. You can access all tools in your dashboard.
671
+ </p>
672
  </div>
673
 
674
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-2.5">
675
  {GOALS.map((g) => {
676
  const isSelected = platformGoal === g.id;
677
  return (
 
679
  key={g.id}
680
  type="button"
681
  onClick={() => setPlatformGoal(g.id)}
682
+ className={`p-3.5 rounded-2xl border text-left transition-all cursor-pointer relative group ${
683
  isSelected
684
+ ? "bg-gradient-to-br from-indigo-600/20 to-violet-600/15 border-indigo-500 shadow-md shadow-indigo-500/10"
685
+ : "bg-[#11141d]/70 border-white/[0.08] hover:border-white/20 hover:bg-[#11141d]"
686
  }`}
687
  >
688
+ <div className="flex items-center justify-between mb-1.5">
689
+ <div className="flex items-center gap-2">
690
+ <div className="p-1 rounded-lg bg-white/5 border border-white/5">{g.icon}</div>
691
+ <span className="text-xs font-bold text-white">{g.title}</span>
692
+ </div>
693
+ <span className="text-[9px] font-mono font-semibold px-2 py-0.5 rounded-full bg-white/5 text-white/60 border border-white/5">
694
+ {g.badge}
695
+ </span>
696
  </div>
697
+ <p className="text-[11px] text-white/45 leading-relaxed line-clamp-2">
698
  {g.desc}
699
  </p>
700
  </button>
 
706
 
707
  {/* STEP 5: Discovery Source */}
708
  {step === 5 && (
709
+ <div className="space-y-4 animate-in fade-in duration-200">
710
+ <div className="space-y-1">
711
+ <div className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-indigo-500/10 border border-indigo-500/25 text-indigo-300 text-[10px] font-bold uppercase tracking-widest">
712
+ <Compass size={11} />
713
+ Step 5 of 6 • Discovery Channel
714
+ </div>
715
+ <h2 className="text-2xl font-black text-white tracking-tight">
716
  Where did you hear about us?
717
  </h2>
718
+ <p className="text-xs text-white/50 leading-relaxed">
719
+ Helps our growth engineers identify the most helpful community channels.
720
+ </p>
721
  </div>
722
 
723
+ <div className="grid grid-cols-2 gap-2.5">
724
  {DISCOVERY_SOURCES.map((s) => {
725
  const isSelected = heardAbout === s.id;
726
  return (
 
728
  key={s.id}
729
  type="button"
730
  onClick={() => setHeardAbout(s.id)}
731
+ className={`p-3 rounded-2xl border text-left text-xs transition-all cursor-pointer flex items-center gap-2.5 ${
732
  isSelected
733
+ ? "bg-gradient-to-r from-indigo-600/20 to-violet-600/15 border-indigo-500 text-white font-bold shadow-md shadow-indigo-500/10"
734
+ : "bg-[#11141d]/70 border-white/[0.08] text-white/70 hover:text-white hover:bg-[#11141d] hover:border-white/20"
735
  }`}
736
  >
737
+ <span className="text-base">{s.icon}</span>
738
+ <span className="truncate">{s.label}</span>
739
+ {isSelected && <Check size={13} className="text-indigo-400 ml-auto shrink-0" />}
740
  </button>
741
  );
742
  })}
 
744
  </div>
745
  )}
746
 
747
+ {/* STEP 6: REDESIGNED CREDENTIALS MODAL */}
748
  {step === 6 && (
749
+ <form onSubmit={handleSubmitAssessment} className="space-y-4 animate-in fade-in duration-200">
750
+ <div className="space-y-1">
751
+ <div className="inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-emerald-500/10 border border-emerald-500/25 text-emerald-300 text-[10px] font-bold uppercase tracking-widest">
752
+ <ShieldCheck size={11} />
753
+ Step 6 of 6 • Security & Credentials
754
+ </div>
755
+ <h2 className="text-2xl font-black text-white tracking-tight">
756
  Set up your credentials
757
  </h2>
758
+ <p className="text-xs text-white/50 leading-relaxed">
759
+ Create your login credentials to unlock your Free Starter tier and claim your welcome coupon.
760
+ </p>
761
  </div>
762
 
763
+ {/* Summary Identity Pill */}
764
+ <div className="p-2.5 rounded-2xl bg-white/[0.03] border border-white/[0.08] flex items-center justify-between text-xs">
765
+ <div className="flex items-center gap-2.5 min-w-0">
766
+ <div className="w-8 h-8 rounded-xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center font-bold text-white shrink-0 text-xs">
767
+ {profilePreview && (profilePreview.startsWith("blob:") || profilePreview.startsWith("http")) ? (
768
+ <img src={profilePreview} alt="avatar" className="w-full h-full object-cover rounded-xl" />
769
+ ) : profilePreview ? (
770
+ profilePreview
771
+ ) : (
772
+ getInitials(fullName)
773
+ )}
774
+ </div>
775
+ <div className="min-w-0">
776
+ <div className="text-xs font-bold text-white truncate">{fullName || "New Founder"}</div>
777
+ <div className="text-[10px] text-white/40 truncate">{getSelectedBusinessLabel()}</div>
778
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
779
  </div>
780
+ <span className="px-2 py-0.5 rounded-full bg-emerald-500/10 text-emerald-300 border border-emerald-500/20 text-[10px] font-bold font-mono shrink-0">
781
+ Free Starter Tier
782
+ </span>
783
+ </div>
784
 
785
+ {/* Form Inputs */}
786
+ <div className="space-y-2.5">
787
+ {/* Work Email */}
788
+ <div className="space-y-1">
789
+ <label className="text-[11px] font-bold text-white/70 flex items-center justify-between">
790
+ <span className="flex items-center gap-1.5">
791
+ <Mail size={12} className="text-indigo-400" />
792
+ Work Email Address
793
+ </span>
794
+ <span className="text-[9px] text-emerald-400 font-medium">Delivers welcome email & coupon</span>
795
+ </label>
796
  <input
797
+ type="email"
798
+ value={email}
799
+ onChange={(e) => setEmail(e.target.value)}
800
+ placeholder="alexander@company.com"
801
  required
802
+ className="w-full bg-[#11141d] border border-white/10 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 rounded-xl px-3.5 py-2.5 text-xs text-white placeholder:text-white/25 outline-none transition-all"
803
  />
804
+ </div>
805
+
806
+ {/* Username & Country Row */}
807
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-2.5">
808
+ <div className="space-y-1">
809
+ <label className="text-[11px] font-bold text-white/70 flex items-center gap-1.5">
810
+ <User size={12} className="text-indigo-400" />
811
+ Username
812
+ </label>
813
+ <input
814
+ type="text"
815
+ value={username}
816
+ onChange={(e) => setUsername(e.target.value)}
817
+ placeholder="e.g. alexander"
818
+ className="w-full bg-[#11141d] border border-white/10 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 rounded-xl px-3.5 py-2.5 text-xs text-white placeholder:text-white/25 outline-none transition-all"
819
+ />
820
+ </div>
821
+
822
+ <div className="space-y-1">
823
+ <label className="text-[11px] font-bold text-white/70 flex items-center gap-1.5">
824
+ <Globe size={12} className="text-indigo-400" />
825
+ Country
826
+ </label>
827
+ <select
828
+ value={country}
829
+ onChange={(e) => setCountry(e.target.value)}
830
+ className="w-full bg-[#11141d] border border-white/10 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 rounded-xl px-3 py-2.5 text-xs text-white outline-none cursor-pointer"
831
+ >
832
+ {COUNTRIES.map(c => (
833
+ <option key={c.code} value={c.name} className="bg-[#11141d] text-white">
834
+ {c.flag} {c.name}
835
+ </option>
836
+ ))}
837
+ </select>
838
+ </div>
839
+ </div>
840
+
841
+ {/* Password + Security Strength */}
842
+ <div className="space-y-1">
843
+ <div className="flex items-center justify-between text-[11px] font-bold text-white/70">
844
+ <span className="flex items-center gap-1.5">
845
+ <Lock size={12} className="text-indigo-400" />
846
+ Password
847
+ </span>
848
+ {password && (
849
+ <span className="text-[10px] font-mono text-white/50">
850
+ {passwordStrength.label}
851
+ </span>
852
+ )}
853
+ </div>
854
+
855
+ <div className="relative">
856
+ <input
857
+ type={showPassword ? "text" : "password"}
858
+ value={password}
859
+ onChange={(e) => setPassword(e.target.value)}
860
+ placeholder="Create secure password (min 6 chars)"
861
+ required
862
+ className="w-full bg-[#11141d] border border-white/10 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 rounded-xl px-3.5 py-2.5 pr-10 text-xs text-white placeholder:text-white/25 outline-none transition-all"
863
+ />
864
+ <button
865
+ type="button"
866
+ onClick={() => setShowPassword(!showPassword)}
867
+ className="absolute right-3 top-1/2 -translate-y-1/2 text-white/40 hover:text-white transition-colors"
868
+ >
869
+ {showPassword ? <EyeOff size={15} /> : <Eye size={15} />}
870
+ </button>
871
+ </div>
872
+
873
+ {/* Password Strength Progress Bar */}
874
+ {password && (
875
+ <div className="flex items-center gap-1 pt-1">
876
+ {[1, 2, 3, 4].map((idx) => (
877
+ <div
878
+ key={idx}
879
+ className={`h-1 flex-1 rounded-full transition-all duration-300 ${
880
+ idx <= passwordStrength.score ? passwordStrength.color : "bg-white/10"
881
+ }`}
882
+ />
883
+ ))}
884
+ </div>
885
+ )}
886
+ </div>
887
+ </div>
888
+
889
+ {/* Welcome Coupon & Perk Card */}
890
+ <div className="p-3 rounded-2xl bg-gradient-to-r from-emerald-500/10 via-indigo-500/10 to-violet-500/10 border border-emerald-500/25 flex items-center justify-between gap-2">
891
+ <div className="flex items-center gap-2">
892
+ <span className="text-base">🎁</span>
893
+ <div className="text-[11px]">
894
+ <span className="font-bold text-white">Welcome Gift Included: </span>
895
+ <span className="text-emerald-300 font-mono font-bold">WELCOME20</span>
896
+ <div className="text-[10px] text-white/50">20% off all tier upgrades, sent to your inbox.</div>
897
+ </div>
898
  </div>
899
  </div>
900
 
901
+ {/* Submit Button */}
902
  <button
903
  type="submit"
904
  disabled={loading}
905
+ className="w-full py-3.5 rounded-2xl bg-gradient-to-r from-indigo-600 via-indigo-500 to-violet-600 hover:from-indigo-500 hover:to-violet-500 text-white text-xs font-bold transition-all shadow-lg shadow-indigo-600/30 flex items-center justify-center gap-2 cursor-pointer disabled:opacity-50 active:scale-[0.98]"
906
  >
907
  {loading ? (
908
  <>
909
+ <Loader2 size={15} className="animate-spin" />
910
+ <span>Initializing ArkiTel Workspace...</span>
911
  </>
912
  ) : (
913
  <>
914
+ <ShieldCheck size={16} />
915
  <span>Launch ArkiTel Workspace</span>
916
+ <ArrowRight size={15} />
917
  </>
918
  )}
919
  </button>
920
+
921
+ {/* Security Reassurance Footer */}
922
+ <div className="flex items-center justify-center gap-4 text-[10px] font-medium text-white/40 pt-1">
923
+ <span>🔒 256-Bit SSL Secured</span>
924
+ <span>•</span>
925
+ <span>⚡ Instant Free Access</span>
926
+ <span>•</span>
927
+ <span>🛡️ Zero Card Required</span>
928
+ </div>
929
  </form>
930
  )}
931
 
932
+ {/* Navigation Bar for Steps 1-5 */}
933
  {step < 6 && (
934
+ <div className="flex items-center justify-between pt-3 border-t border-white/[0.08]">
935
  {step > 1 ? (
936
  <button
937
  type="button"
938
  onClick={handleBack}
939
+ className="px-3.5 py-2 rounded-xl text-xs font-semibold text-white/60 hover:text-white hover:bg-white/5 transition-all flex items-center gap-1.5 cursor-pointer border border-transparent hover:border-white/10"
940
  >
941
  <ArrowLeft size={13} />
942
  <span>Back</span>
 
946
  <button
947
  type="button"
948
  onClick={handleNext}
949
+ className="px-5 py-2.5 rounded-xl bg-gradient-to-r from-indigo-600 to-violet-600 hover:from-indigo-500 hover:to-violet-500 text-white text-xs font-bold transition-all flex items-center gap-2 cursor-pointer shadow-md shadow-indigo-600/25 active:scale-95 ml-auto"
950
  >
951
  <span>{step === 2 && !profilePreview ? "Skip for now" : "Continue"}</span>
952
+ <ArrowRight size={14} />
953
  </button>
954
  </div>
955
  )}
 
961
  </main>
962
 
963
  {/* Footer Branding */}
964
+ <footer className="relative z-10 w-full py-4 text-center text-[11px] text-white/30 border-t border-white/[0.06] bg-[#07090e]/60 backdrop-blur-md shrink-0 flex items-center justify-center gap-2">
965
+ <span>ArkiTel Automation Engine</span>
966
+ <span>•</span>
967
+ <span>Enterprise Telegram Growth Suite</span>
968
  </footer>
969
 
970
  </div>