)}
{view.name === 'product' && (
)}
{view.name === 'checkout' && (
setCart([])} />
)}
setCartOpen(false)} onQty={changeQty}
onCheckout={() => { setCartOpen(false); setView({ name: 'checkout' }); }} />
setConfirm(false)} />
);
}
// Load products from the API before mounting, so the catalogue + category
// filter are populated on first render. Mount defensively: even if RIFTR_LOAD
// is missing (e.g. a stale cached data.js) or the fetch rejects, still render
// the app rather than leaving a blank page.
const boot = () => ReactDOM.createRoot(document.getElementById('root')).render();
const loader = (typeof window.RIFTR_LOAD === 'function') ? window.RIFTR_LOAD() : Promise.resolve();
loader.then(boot).catch(boot);
})();