@endif
{{-- Flash Messages avec animations --}}
{{-- Contenu principal - z-index bas pour rester sous la navbar --}}
@yield('content')
{{-- Mobile Bottom Navigation --}}
@includeIf('components.mobile-bottom-nav')
{{-- Cookie Consent Banner --}}
@include('components.cookie-consent')
@auth
@if(in_array((string) (auth()->user()->role ?? ''), ['client', 'prestataire'], true))
@includeIf('components.guidance-assistant')
@endif
@endauth
{{-- Scripts personnalisés par page --}}
@stack('scripts')
{{-- Évite le rendu obsolète depuis le Back/Forward cache --}}
{{-- Anti-double-navigation - différé pour ne pas bloquer le rendu --}}
{{-- Scripts tiers chargés en différé --}}
{{-- jQuery chargé uniquement si nécessaire --}}
{{-- OneSignal Push Notifications --}}
@php
$currentHost = request()->getHost();
// Récupérer l'allowed_host depuis la config ou utiliser APP_URL
$allowed = config('onesignal.allowed_host');
if (empty($allowed)) {
$allowed = config('app.url');
}
if (!empty($allowed) && !str_contains($allowed, '://')) {
$allowed = 'https://' . $allowed;
}
$allowedHost = parse_url($allowed, PHP_URL_HOST) ?? $currentHost;
// Comparer sans www pour supporter les deux variantes
$normalizedCurrent = preg_replace('/^www\./', '', $currentHost);
$normalizedAllowed = preg_replace('/^www\./', '', $allowedHost ?? '');
// Activer OneSignal si configuré ET (host correspond OU on est en production avec un app_id valide)
$enableOneSignalHere = config('onesignal.enabled')
&& !empty(config('onesignal.app_id'))
&& ($normalizedCurrent === $normalizedAllowed || str_contains($currentHost, 'taprestation'));
@endphp
@if($enableOneSignalHere)
@endif
{{-- PWA Service Worker (fallback si OneSignal non configuré) --}}
@if(!config('onesignal.app_id'))
@endif
{{-- Système de rappel pour activer les notifications --}}
{{-- Reminder notifications désactivé: il ouvrait un overlay/modal intrusif sous CSP strict. --}}
@once
@endonce