{{--
Responsive payment checkout shell: bottom sheet on mobile, centered modal on desktop.
Audiences:
- buyer (default): public ticket buyers, donors, shoppers — self-serve checkout
- operator: signed-in staff flows such as wallet top-up
Optional overrides: $sheetTitle, $sheetSubtitle, $sheetFooter, $sheetAria, $iframeTitle
Requires Alpine ancestor with:
- showSheet (bool)
- checkoutUrl (string) — authorization / waiting URL
- accessCode (string, optional) — Paystack initialize access_code for Inline
- publicKey (string, optional) — unused by resumeTransaction; kept for callers
- returnUrl (string, optional) — where to go after Inline onSuccess (?reference=)
checkout.paystack.com cannot be iframed (X-Frame-Options: SAMEORIGIN).
Primary path: Paystack Inline JS (PaystackPop.resumeTransaction) — in-page overlay,
not a separate browser tab. Same-origin URLs (e.g. MoMo waiting) still use iframe.
--}}
@php
$audience = $audience ?? 'buyer';
$defaults = match ($audience) {
'operator' => [
'title' => 'Complete payment',
'subtitle' => null,
'aria' => 'Complete payment',
'iframe' => 'Payment checkout',
'footer' => null,
],
default => [
'title' => 'Complete your payment',
'subtitle' => 'Pay securely. You\'ll get a confirmation when it succeeds.',
'aria' => 'Complete your payment',
'iframe' => 'Secure payment checkout',
'footer' => 'Your payment is processed securely. Do not close this window until finished.',
],
};
$sheetTitle = $sheetTitle ?? $defaults['title'];
$sheetSubtitle = $sheetSubtitle ?? $defaults['subtitle'];
$sheetAria = $sheetAria ?? $defaults['aria'];
$iframeTitle = $iframeTitle ?? $defaults['iframe'];
$sheetFooter = $sheetFooter ?? $defaults['footer'];
@endphp
@once
@endonce
{{-- Keep Paystack checkout flush inside the Ladill sheet loading area (no double card). --}}
@once('ladill-paystack-contain-css')
@endonce
{{-- No local x-data: inherit showSheet/checkoutUrl/accessCode from the including scope. --}}
{{--
ONE surface everywhere (POS / Merchant / Mini / Give / Invoice / Events):
- Mobile: bottom sheet
- Desktop: centered modal
- Paystack Inline fills the sheet body loading area (not a second full-screen modal)
--}}
{{-- Full header while loading / error / same-origin; compact bar once Paystack fills the body --}}
{{ $sheetTitle }}
@if (! empty($sheetSubtitle))
{{ $sheetSubtitle }}
@endif
{{ $sheetTitle }}
{{-- Body: spinner while starting; Paystack fills this flush when ready (no second card stage) --}}
{{-- Loading-area mount: Paystack fills this edge-to-edge when live. --}}