1, 'address' => 'idevakk@imail.com', 'expires_at' => '23:59:12', 'progress' => 90], ['id' => 2, 'address' => 'tester_99@devmail.ai', 'expires_at' => '45:12:05', 'progress' => 40], ]; public $currentMailboxId = 1; public $activeFolder = 'inbox'; public $selectedEmailId = null; public $search = ''; public $viewMode = 'text'; // text | html public $allowRemoteContent = false; public $page = 1; public $totalPages = 5; // Create State public $showCreateModal = false; public $createType = 'random'; // random | custom public $customUsername = ''; public $customDomain = 'imail.com'; public $availableDomains = ['imail.com', 'devmail.ai', 'temp-inbox.net']; public function getEmailsProperty() { // Mock emails based on mailbox ID $baseEmails = [ 1 => [ // Inbox [ 'id' => 1, 'from_name' => 'GitHub Security', 'from_email' => 'noreply@github.com', 'subject' => '[GitHub] A new personal access token was created', 'preview' => 'A new personal access token (classic) was recently added to your account.', 'body_html' => '
Hi @idevakk,
A new personal access token (classic) was recently added to your account IDEVAKK.
If this was you, you can safely ignore this email.
If this was not you, please visit https://github.com/settings/tokens to revoke the token.
', 'body_text' => "Hi @idevakk,\n\nA new personal access token (classic) was recently added to your account IDEVAKK.\n\nIf this was you, you can safely ignore this email.\n\nIf this was not you, please visit https://github.com/settings/tokens to revoke the token.", 'time' => '10:24 AM', 'unread' => true, 'flagged' => true, 'attachments' => [], ], [ 'id' => 101, 'from_name' => 'Linear', 'from_email' => 'updates@linear.app', 'subject' => 'New issue assigned: [UI-124] Fix sidebar overflow', 'preview' => 'You have been assigned to a new issue in the UI project. Please review the details...', 'body_html' => 'Hello,
You have been assigned to [UI-124] Fix sidebar overflow in mobile view.
Priority: High
Project: Imail Revamp
View details at https://linear.app/imail/issue/UI-124
', 'body_text' => "Hello,\n\nYou have been assigned to [UI-124] Fix sidebar overflow in mobile view.\n\nPriority: High\nProject: Imail Revamp\n\nView details at https://linear.app/imail/issue/UI-124", 'time' => '11:45 AM', 'unread' => true, 'flagged' => false, 'attachments' => [], ], [ 'id' => 104, 'from_name' => 'Unsplash Updates', 'from_email' => 'hello@unsplash.com', 'subject' => 'Featured Photos: Cinematic Landscapes', 'preview' => 'Check out this week\'s curated collection of cinematic landscape photography...', 'body_html' => 'Hello Zemailer,
We have curated some new cinematic landscapes for your next project:
Feel free to use them in your designs!
', 'body_text' => "Hello Zemailer,\n\nWe have curated some new cinematic landscapes for your next project.\n\n[Images are blocked by default in privacy mode]\n\nCheck them out on Unsplash!", 'time' => '7:45 AM', 'unread' => true, 'flagged' => false, 'attachments' => [], ], // Generated Inbox items to reach 15 ], 2 => [ // Sent [ 'id' => 2, 'from_name' => 'Stripe', 'from_email' => 'support@stripe.com', 'subject' => 'Your weekly payment report', 'preview' => 'Your weekly report for the period of Feb 24 - Mar 2 is now available.', 'body_html' => 'Hello,
Your weekly report for the period of Feb 24 - Mar 2 is now available in your dashboard.
Total Volume: $12,450.00
View the full report details online.
', 'body_text' => "Hello,\n\nYour weekly report for the period of Feb 24 - Mar 2 is now available in your dashboard.\n\nTotal Volume: $12,450.00\n\nView the full report details online.", 'time' => 'Yesterday', 'unread' => false, 'flagged' => false, 'attachments' => [['name' => 'report_mar_02.pdf', 'size' => '1.2 MB']], ], ], 3 => [ // Notifications [ 'id' => 3, 'from_name' => 'Slack', 'from_email' => 'notifications@slack.com', 'subject' => 'You have 12 unread messages from your team', 'preview' => 'Atul Kumar: "Did you check the new API endpoints? We need them for..."', 'body_html' => 'You have new activity in Slack.
Hello,
This is a follow-up email #$i regarding our partnership.
", 'body_text' => "Hello,\n\nThis is a follow-up email #$i regarding our partnership.", 'time' => 'Mar 1', 'unread' => $i % 3 === 0, 'flagged' => $i % 5 === 0, 'attachments' => [], ]; } // Fill Sent (MB 2) to 15 for ($i = 1; $i <= 14; $i++) { $baseEmails[2][] = [ 'id' => 2000 + $i, 'from_name' => 'Me', 'from_email' => 'idevakk@imail.com', 'subject' => "Re: Project Sync $i", 'preview' => "Sounds good, let's proceed with the plan we discussed for sprint $i.", 'body_html' => "Hi team,
Update on project $i: everything is on track.
", 'body_text' => "Hi team,\n\nUpdate on project $i: everything is on track.", 'time' => 'Feb 26', 'unread' => false, 'flagged' => $i % 4 === 0, 'attachments' => [], ]; } // Fill Others (MB 3) to 15 for ($i = 1; $i <= 14; $i++) { $baseEmails[3][] = [ 'id' => 3000 + $i, 'from_name' => "System Notification $i", 'from_email' => 'noreply@system.com', 'subject' => "Security Alert $i: New Login", 'preview' => "We detected a new login to your account from a new device on day $i...", 'body_html' => "A new login was detected on your account.
Location: City $i
", 'body_text' => "A new login was detected on your account.\n\nLocation: City $i", 'time' => 'Feb 25', 'unread' => $i % 2 === 0, 'flagged' => false, 'attachments' => [], ]; } $allData = $baseEmails[$this->currentMailboxId] ?? $baseEmails[3]; $total = count($allData); $this->totalPages = ceil($total / 10); // Ensure page is within bounds if ($this->page > $this->totalPages && $this->totalPages > 0) { $this->page = $this->totalPages; } return array_slice($allData, ($this->page - 1) * 10, 10); } public function selectEmail($id) { $this->selectedEmailId = $id; $this->viewMode = 'text'; $this->allowRemoteContent = false; // Simulate cinematic loading usleep(500000); // 500ms } public function switchMailbox($id) { $this->currentMailboxId = $id; $this->selectedEmailId = null; $this->search = ''; $this->page = 1; } public function createMailbox() { $newAddress = $this->createType === 'random' ? fake()->userName().'_'.rand(10, 99).'@'.$this->availableDomains[array_rand($this->availableDomains)] : $this->customUsername.'@'.$this->customDomain; $newId = count($this->activeMailboxes) + 1; $this->activeMailboxes[] = [ 'id' => $newId, 'address' => $newAddress, 'expires_at' => '24:00:00', 'progress' => 100, ]; $this->currentMailboxId = $newId; $this->showCreateModal = false; $this->customUsername = ''; } public function deleteMailbox($id) { $this->activeMailboxes = array_filter($this->activeMailboxes, fn ($m) => $m['id'] !== $id); if ($this->currentMailboxId === $id) { $this->currentMailboxId = count($this->activeMailboxes) > 0 ? reset($this->activeMailboxes)['id'] : null; $this->selectedEmailId = null; } } public function downloadEmail($id) { // Mock download logic $this->js("alert('Downloading email #{$id}... (Mock Action)')"); } public function printEmail($id) { // Mock print logic $this->js('window.print()'); } public function deleteEmail($id) { // Mock delete logic $this->js("alert('Email #{$id} deleted successfully! (Mock Action)')"); $this->selectedEmailId = null; } public function nextPage() { if ($this->page < $this->totalPages) { $this->page++; $this->selectedEmailId = null; } } public function previousPage() { if ($this->page > 1) { $this->page--; $this->selectedEmailId = null; } } public function generateQrCode($address) { // Mock QR generation with a slight delay usleep(800000); // 800ms $this->dispatch('qrCodeGenerated', address: $address); } public function getProcessedContent($email) { $content = $email['body_html']; $isText = $this->viewMode === 'text'; // Fallback to HTML if text is selected but body_text is empty if ($isText && ! empty($email['body_text'])) { return trim(e($email['body_text'])); } if ($isText) { // If fallback occurred, we sanitize the HTML to text return trim(strip_tags($content)); } if (! $this->allowRemoteContent) { // Block remote assets by replacing src with data-src for img tags return preg_replace('/