/** * Cart — one of WooCommerce's four store views (see `../index.tsx` for the * top-level hub). Its own two tabs (Cart / Behavior) are two views of the same * settings, not separate topics — the same call Product Catalog and Checkout * make — so both render inline behind one segmented toggle (see Tabs' * `segmented` variant) rather than each drilling into a `WP_Customize_Section` * of its own. Both hosts therefore render exactly the same thing here. */ import { __ } from '@wordpress/i18n'; import { useEffect, useState } from '@wordpress/element'; import { ShoppingCart } from 'lucide-react'; import Tabs, { TabPanel } from '../../../controls/tabs'; import type { WorkingSettings, SetPath, SectionExtra } from '../../../types'; import type { WooSchema } from '../types'; import { CART_TABS } from '../constants'; import { BlockCartNotice, CartDesignFields, CartBehaviorFields, } from './fields'; import SectionIntro from '../../../controls/section-intro'; const ID_PREFIX = 'aureon-woocommerce-cart'; interface CartSectionProps { schema: WooSchema; working: WorkingSettings; setPath: SetPath; extras?: SectionExtra[]; onViewChange?: ( context: string ) => void; /** * See the same prop on `ShopSection` — avoids a duplicate header when * the top hub embeds this inline for the standalone page. */ showHeader?: boolean; } export default function CartSection( { schema, working, setPath, extras, onViewChange, showHeader = true, }: CartSectionProps ) { useEffect( () => { onViewChange?.( 'cart' ); }, [ onViewChange ] ); const [ activeTab, setActiveTab ] = useState( 'design' ); return (
{ showHeader && (

{ __( 'Cart', 'aureon' ) }

{ __( 'Customize the cart page and mini-cart drawer.', 'aureon' ) }

) } { /* Above the tabs, not inside one: the block cart greys out controls in both of them. */ }
); }