{{--
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=)
Paystack 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
{{-- Override Paystack's full-viewport popup styles so checkout sits in our sheet mount. --}}
@once('ladill-paystack-contain-css')
@endonce
{{-- No local x-data: inherit showSheet/checkoutUrl/accessCode from the including scope. --}}
{{--
ONE design everywhere (POS / Merchant / Mini / Give / Invoice / Events):
- Loading / error / same-origin: white bottomsheet (mobile) or modal (desktop)
- Paystack Inline ready: transparent shell so Paystack's own card is the only surface
on the dimmed backdrop (no second white frame / double modal)
--}}
{{-- Floating close when Paystack owns the surface (Paystack has no host close for us) --}}
{{-- Standard POS header: loading, error, or same-origin waiting page --}}
{{ $sheetTitle }}
@if (! empty($sheetSubtitle))
{{ $sheetSubtitle }}
@endif
{{-- Body: spinner while starting; Paystack fills this when ready --}}