{{-- Native "Connect Email Account" modal, opened from the Channels hub (/devices). Two steps in one dialog. Step 1 lists any mailboxes already connected (with pause / remove / check-now), then a grid of IMAP providers. Step 2 is the credentials form for whichever tile was picked, pre-filled from the server-side catalogue (App\Services\Email\Providers) so nobody has to know Apple answers on 587 or that Zoho refuses an .in account on the .com host. Everything is AJAX (public/js/user-email-connect.js posts to /email/connect and handles the JSON) so the hub never reloads mid-connect. Password auth only for now; Gmail/Outlook OAuth is a later phase. Self-sufficient: @include('user.email._connect_modal') works from any page. --}} @php // Distinct names so this never collides with the page's own $emailAccounts // (the MailTrixy mirror collection) or the legacy #email-connect-modal. $providers = $providers ?? \App\Services\Email\Providers::all(); $nativeMailboxes = $nativeMailboxes ?? \App\Models\EmailAccount::allForWorkspace((int) (auth()->user()->current_workspace_id ?? 0)); // One-click sign-in is available only when an admin has added the OAuth app // keys (Admin → Channels → Email). Otherwise the cards render disabled and // the IMAP/app-password path below is the way in. $googleReady = (new \App\Services\Email\OAuth\GoogleOAuth())->isConfigured(); $microsoftReady = (new \App\Services\Email\OAuth\MicrosoftOAuth())->isConfigured(); @endphp
{{-- Provider catalogue as data, so step 2 fills itself with no round trip. --}}