{{-- ========== SHOPIFY APP BRIDGE (embedded app only) ==========
Shopify's automated "Embedded app checks" require BOTH:
1. the latest App Bridge loaded from Shopify's CDN, and
2. session tokens used for authentication.
Loading it from cdn.shopify.com/shopifycloud/app-bridge.js always
installs the LATEST version — it must NOT be bundled through Vite or
self-hosted, or the check fails no matter how current the copy is.
It must also be the FIRST
@endif
{{-- Real-time (Pusher) — public key + cluster only (never the secret); the
current workspace id for the private inbox channel. Blank when an admin
hasn't enabled real-time, in which case Echo stays off and the inbox
keeps polling. --}}
@php $__rt = \App\Support\WorkspaceRealtimeSettings::publicConfig(auth()->user()?->current_workspace_id); @endphp
{{-- Self-hosted soketi/Reverb only — blank for Pusher Cloud (pusher-js uses the cluster). --}}
{{-- Sub-folder base path (e.g. /public) so client-side AJAX honours the deploy location under a sub-directory. --}}
@php $defCountry = app_default_country(); @endphp
{{-- Active currency symbol (workspace override → platform default) for
chart JS so axes/tooltips follow the chosen currency, not '$'. --}}
@php $faviconUrl = \App\Support\Brand::faviconUrl(); @endphp
@if ($faviconUrl)
@endif
{{-- Server flash → toast. Any controller that does
redirect()->with('status' / 'success' / 'error') ends up
here as a meta tag, and resources/js/wa-toaster.js shows
it on DOMContentLoaded. Keeps UI feedback consistent
without each page rolling its own banner. --}}
@php
$flashVariant = session('error') ? 'error' : (session('warning') ? 'warn' : 'success');
$flashMessage = session('error') ?? (session('warning') ?? (session('success') ?? session('status')));
@endphp
@if ($flashMessage)
$flashVariant, 'message' => $flashMessage])'>
@endif
@php $__brandName = (string) brand_name(); @endphp
{{ $title }} — {{ $__brandName }}
{{-- SEO meta block — single source at /admin/settings/seo. --}}
@include('partials.seo-meta', ['seoOverrides' => ['title' => $title . ' — ' . $__brandName]])
{{-- On the Team-Inbox page, when the separate Team-Inbox PWA is enabled,
emit ITS scoped manifest instead of the app-wide one (a page may carry
only one effective manifest). Every other page keeps the app PWA. --}}
@if (($navKey ?? '') === 'team-inbox' && \App\Models\SystemSetting::get('ti_pwa_enabled', false))
@include('partials.teaminbox-pwa')
@else
@include('partials.pwa-meta')
@endif
@include('partials.site-analytics')
@php
// Per-theme logo URLs for live theme-switch in wadesk.js.
$brandLogos = [];
foreach (['paper', 'bright', 'dark', 'doodle'] as $__t) {
$brandLogos[$__t] = \App\Support\Brand::logoUrl($__t);
}
@endphp
{{-- Sprint 6 · Branding tab — workspace-scoped brand colors get
emitted as CSS vars AND class overrides. Only renders when
at least one brand_* column is set on the current workspace;
otherwise the default Tailwind palette wins. --}}
@auth
@php
$brandWs = auth()->user()->currentWorkspace;
@endphp
@if ($brandWs && ($brandWs->brand_primary || $brandWs->brand_accent || $brandWs->brand_background))
@endif
@endauth
@auth
@endauth
@auth
{{-- Guided product tour bootstrap. `run` is true only until the user has
seen it once (users.has_seen_intro); the tour persists progress in
localStorage so it can span page navigations, and POSTs to seenUrl
when finished/skipped so it never auto-runs again. --}}
@endauth
{{-- JS i18n helper. Client-side renderers (chat / team-inbox) build UI from
string literals; window.t(en) returns the active locale's translation for
that English string (populated per-page via partials.js-i18n) or the
English key itself as a graceful fallback. Defined before the bundle so
it always exists by the time any render code calls it. --}}
@vite(['resources/css/app.css', 'resources/js/app.js'])
@include('partials.app-font')
{{-- Admin-set dashboard theme colour overrides — LAST in head so they win --}}
{!! theme_css() !!}
{{-- Impersonation strip renders INSIDE each layout branch below (via
partials.impersonation-strip). In the sidebar shell it must be a
shrink-0 row of the 100vh flex column, not stacked on top of an
h-screen shell — the latter pushed the shell below the fold and caused a
phantom "scroll to blank" on every page while impersonating. --}}
@php $__userLayout = \App\Support\UserNav::layout(); @endphp
@if ($__userLayout === 'sidebar' && !$hideHeader)
{{-- Admin-selected SIDEBAR layout — dark left rail (all nav, no /more,
no top menu header). Every page's $slot renders unchanged inside the
main column, so no page can break. --}}
{{-- App shell — a 100vh flex COLUMN: the impersonation strip is a
shrink-0 row at the top (so the shell stays exactly one viewport
tall whether or not you're impersonating — no phantom scroll), then
a flex ROW of rail + content. Rail is shrink-0 + full height; ONLY
the inner content div scrolls. --}}
@else
@include('partials.impersonation-strip', ['wrapClass' => 'sticky top-0'])
@unless ($hideHeader)
@endunless
{{ $slot }}
@endif
{{-- In-app paywall — slides up over the page when the current plan
doesn't include the feature being viewed. Self-guards (admins /
unlocked / non-gated pages render nothing). --}}
{{-- Global "Connect device" popover — opened from any device picker via a
[data-connect-device] trigger / window.openConnectDevice(). Iframes the
devices connect flow so a user can add a number without leaving the page. --}}
{{-- GDPR cookie consent — auto-opens on first visit; admin can
disable globally at /admin/settings/pwa. --}}
@include('partials.cookie-consent')
@stack('scripts')
@auth
{{-- Global "new messages" notification widget. Appears bottom-right
on every page EXCEPT the team-inbox itself (where you already
see the chats live). Polls /team-inbox/api/unread-summary
every 15s, pauses when the tab is hidden, exponential
backoff on 429 / errors. --}}
@if (in_array($navKey, ['team-inbox'], true) === false)
@endif
{{-- Global quick-access edge drawer + its editor modal — jump anywhere
and customise shortcuts from any page. --}}
{{-- Client Support Bot — floating help launcher. Renders only when the
platform admin has enabled it (/admin/settings/support-bot). --}}
{{-- "Ask CRM Copilot" launcher on CRM pages (contacts, deals, invoices...). --}}
@endauth