@php $agentAvailable = \App\Helpers\ChatHelper::isAgentAvailable(); $skipDocsRouting = $skipDocsRouting ?? false; $isDocsSession = session('ai_from_docs'); $hasJwt = (bool) request('jwt'); $chat = false; if ($skipDocsRouting) { // Homepage / non-docs context: skip the docs-message route entirely if ($agentAvailable) { $formAction = route('chat.create'); $chat = true; } elseif ($hasJwt) { $formAction = route('supportBubble.submit'); } else { $formAction = route('supportBubble.guest.submit'); } } elseif ($isDocsSession) { // Docs pages: always go through the docs AI endpoint $formAction = route('docs.message'); } elseif ($agentAvailable) { $formAction = route('chat.create'); } elseif ($hasJwt) { $formAction = route('supportBubble.submit'); } else { $formAction = route('supportBubble.guest.submit'); } @endphp
@php $ai_plugin = session('ai_plugin') ?? request('plugin'); $ai_page = session('ai_page') ?? request('page'); $ai_site = session('ai_site'); $isLocal = !$ai_site || rtrim($ai_site, '/') === rtrim(config('app.url'), '/'); $docsSlugToCatalogSlug = [ 'agency-pulse-invoice' => 'free-invoice', 'agency-pulse-products' => 'shopping-cart', 'agency-pulse-line-item-taxes' => 'line-item-tax', 'agency-pulse-invoice-enhancements' => 'invoice-enhancements', 'agency-pulse-portal' => 'client-portal', 'agency-pulse-multi-currency' => 'multi-currency', 'agency-pulse-gateway-plugin-stripe' => 'gateway-stripe', 'agency-pulse-quickbooks' => 'quickbooks', 'agency-pulse-secure-sign' => 'secure-sign', 'agency-pulse-admin-menu' => 'admin-organizer', 'agency-pulse-pro' => 'pro-connector', 'agency-pulse-backup' => 'archive-backup', ]; $catalog = config('products.catalog', []); $allPlugins = array_filter([ 'agency-pulse-invoice' => 'The Core FREE Invoice Plugin', 'agency-pulse-products' => 'Store Products for Invoices', 'agency-pulse-line-item-taxes' => 'Extend to use Line Item Taxes', 'agency-pulse-invoice-enhancements' => 'Full Suite of Invoice Enhancements', 'agency-pulse-portal' => 'Get the Complete Client Portal', 'agency-pulse-multi-currency' => 'Multi Currency Invoice Support', 'agency-pulse-gateway-plugin-stripe' => 'The Stripe Gateway Extension', 'agency-pulse-quickbooks' => 'The QuickBooks Integration Extension', 'agency-pulse-secure-sign' => 'The Invoice Secure Signing Extension', 'agency-pulse-admin-menu' => 'Admin Menu Organizer', 'agency-pulse-pro' => 'Pro Connector', 'agency-pulse-backup' => 'Backup', ], function ($label, $docsSlug) use ($docsSlugToCatalogSlug, $catalog) { $catalogSlug = $docsSlugToCatalogSlug[$docsSlug] ?? null; $availability = $catalogSlug ? ($catalog[$catalogSlug]['availability'] ?? 'open') : null; return $availability !== null && in_array($availability, ['open', 'auth']); }, ARRAY_FILTER_USE_BOTH); @endphp @if($ai_plugin && !session('ai_from_docs')) @endif @if($chat) {!! __('support-bubble::support-bubble.intro_chat') !!} @elseif(session('ai_from_docs')) {!! __('support-bubble::support-bubble.intro_docs') !!} @elseif($skipDocsRouting) @auth {!! __('support-bubble::support-bubble.intro_site') !!} @else {!! __('support-bubble::support-bubble.intro_guest') !!} @endauth @else @auth {!! __('support-bubble::support-bubble.intro') !!} @else {!! __('support-bubble::support-bubble.intro_guest') !!} @endauth @endif @if($isLocal && !$ai_plugin)
@else @endif @if(session('ai_from_docs')) @endif @if($hasField('subject')) @endif @if($hasField('message')) @endif @if(session('ai_from_docs')) @else @if($hasField('name')) @endif @if($hasField('email')) @endif @endif