FIRST JACK V8 — CHECKOUT FIXES, ROTATING BANNER AND EDITABLE TEXT

THIS UPDATE
- Fixed the checkout typing bug: a changing close handler was re-running the popup focus setup after every character. Focus trapping now initializes once and uses the current close handler without taking focus away from the input.
- Checkout now includes quantity controls, removal, and an Add another product picker with size selection. Totals and delivery update from the edited bag; unavailable items and empty bags cannot be ordered. Coupon discounts reset after bag changes and can be applied again.
- Unfinished checkout saving is debounced, serialized and flushed on blur, close, tab hiding and leaving the page. Failed saves remain in a local outbox and retry when the browser returns online and reloads the site. The status shows whether online saving succeeded.
- A valid name and complete Bangladesh mobile number are required to appear in the admin Pending Checkouts section. Cart and incomplete customer input are still saved locally before that point.
- Removing every item dismisses the existing unfinished checkout; adding items again resumes that same session. Converting a checkout to an order prevents later draft saves from changing it back. Retrying a submitted order remains idempotent.
- Missing checkout tables and supported columns initialize automatically. The draft limit now applies per checkout session per minute instead of one hourly quota shared by everyone on the same IP.
- Website Settings includes a banner category selector, 3–20 second rotation interval, and autoplay on/off. Visible products in the selected category contribute their uploaded photos. All categories is also available. Add or update photos in Products.
- The banner has previous/next and pause controls. It pauses when hovered, focused or hidden, and respects reduced-motion settings. Product photos remain uncropped. A category without photos shows an empty state instead of unrelated products.
- Website Settings has separate English and Bengali fields for banner headings/button/note, brand subtitle, product spotlight label, highlight strip, collection headings, About section, navigation labels, Add to cart, Buy now and Checkout title. Bengali tagline is editable too.
- Improved text contrast and font sizes, 16px checkout inputs to avoid iPhone input zoom, clearer product cards, and responsive Website Settings layouts.
- Real recent order bubbles enter from alternating left/right directions and rise upward. Names remain masked, including Bengali names. Relative times use Bangladesh time.
- Previous coupon management, exit coupons, customer records, Excel exports, repeat ordering and IP block/unblock features are retained.

INSTALL ON YOUR EXISTING WEBSITE
Back up files and the database. Keep your LIVE ai/.env, ai/config/db.php, .htaccess and existing uploaded product/branding photos. This ZIP has not been deployed to your hosting.

For an upgrade from V7, upload/replace these files:
  index.html
  assets/ (merge with existing assets)
  theme-enhancements.js
  theme-enhancements.css
  ai/store-settings.php
  ai/assets/js/store-settings.js
  ai/api/store_settings.php
  ai/api/storefront.php
  ai/config/storefront.php
  ai/config/storefront_security.php

The source/storefront folder contains editable source and build instructions; it is not needed for the deployed site to run.
For upgrades from earlier versions, also upload the V7 admin files listed in DEPLOY-UPDATE-V7.txt. Do not overwrite your live credentials or uploads with sample/archive files.

After upload, purge hosting/CDN cache and open the site with ?v=8. Website Settings is available from the admin Settings area. Choose a category under Rotating product banner, edit Website text, then Save changes. The storefront refreshes saved settings within 30 seconds.

If a previously SUBMITTED checkout is locked after a connection failure, use "Edit details if no order was created". The server checks for an existing order before unlocking editing. If the order exists, retry the saved submission to recover the receipt rather than starting a duplicate order.

CUSTOMER DATA
Customer cart/details recovery requires the same browser and saved site data. Clearing browser storage or changing devices removes that local recovery. Online draft saving requires connectivity and a valid name/phone. Existing customer/order data is preserved.

VALIDATION
Production build and PHP syntax checks passed. Isolated PHP 8.3 / MariaDB integration checks verify settings validation/persistence, Unicode drafts, updates without duplicate leads, empty-bag dismissal/resumption, checkout-table creation, edited order totals/items, idempotent retries, converted checkout protection and Bengali activity responses.
Chromium checks at 320, 390, 768 and 1440px verify Website Settings, category-filtered banner rotation/pause, uninterrupted keyboard typing and focus, checkout add/remove/quantity controls, empty-bag submission protection, immediate-exit saving, returning cart/details, edited order receipts and no horizontal overflow. Order bubbles were checked for upward movement and alternating sides.
Additional checks cover coupon reapplication after cart edits, copyable exit offers, offline draft replay, discounted receipts and unlocking a saved failed submission after a server check.
These are local browser/backend checks, not tests on your live hosting or a physical iPhone.

REBUILD
cd source/storefront
npm ci
npm run build
python3 scripts/package-storefront.py
