@props([ /* Everything below defaults to the STAFF app. Pass these to describe a different installable app on the same origin — today that is a shop's public request page, which installs as the shop rather than as BillPro (see App\Http\Controllers\PortalPwaController). */ 'manifest' => null, 'themeColor' => null, 'appName' => null, 'appleIcon' => null, /* A customer's page rather than a staff one. It turns the fallbacks OFF: where a shop has no manifest to offer (its intake is switched off), the page is simply not installable, rather than quietly installing as the staff app with BillPro's name and start page. The icon itself is the shared app icon either way; it is the name and the start URL that must never be the staff app's on a customer's phone. */ 'portal' => false, // The VAPID public key, when the page may subscribe a device without a // login. Null keeps the original behaviour: the key is emitted for a // signed-in person and nobody else. 'pushKey' => null, ]) @php $manifestHref = $manifest ?: ($portal ? null : route('pwa.manifest')); $appleIconHref = $appleIcon ?: ($portal ? null : asset(config('push.icons.apple_touch'))); $title = $appName ?: ($portal ? null : config('push.manifest.short_name')); // The VAPID public key. Public by definition — it is handed to every // browser that subscribes — and its absence is how the UI knows to say // "notifications are not set up on this server" instead of offering a // button that cannot work. // // Whose key it is decides the scope pwa.js registers under: a customer's // page subscribes a device to one request, a signed-in page subscribes it // to a person. $vapidKey = $pushKey ?: (auth()->check() ? app(\App\Services\PushService::class)->publicKey() : null); @endphp {{-- Everything a browser needs in order to offer BillPro as an installable app, and everything resources/js/pwa.js needs in order to subscribe this device to notifications. Included from BOTH layouts. The login page matters as much as the app: on a phone, "install this" is a decision people make before they have signed in, and a manifest that only appears after login means the browser has already decided the site is not installable by the time they get there. --}} {{-- The manifest itself: name, icon, colours, start URL. --}} @if ($manifestHref) @endif {{-- Android's status bar and the desktop title bar while the app is open. --}} @if ($title) @endif {{-- iOS reads none of the manifest for this. Safari has its own, older tags, and without them "Add to Home Screen" produces a bookmark that opens in Safari rather than an app — and on iOS, only a real installed app can receive push notifications at all. The status bar stays `default` deliberately. `black-translucent` draws the page under the notch, and this layout has a sticky header that would end up beneath it. --}} @if ($title) @endif @if ($appleIconHref) @endif @if ($vapidKey) @endif