'use client'; import { useCallback } from 'react'; import clsx from 'clsx'; import PluginModule, { Component } from '@akinon/next/components/plugin-module'; import { CheckoutPiece } from '@akinon/pz-theme/src/chrome/checkout-piece'; import ContactSection from './sections/contact-section'; import AddressSection from './sections/address-section'; import ShippingSection from './sections/shipping-section'; import PaymentSection from './sections/payment-section'; import OnePageSummary from './one-page-summary'; import MobileSummarySheet from './mobile-summary-sheet'; import TrustBadges from './trust-badges'; import { useSectionState, type SectionId } from './hooks/use-section-state'; import { useCheckoutFunnelGtm } from './hooks/use-checkout-funnel-gtm'; import type { CheckoutVariantProps } from '../types'; const OnePageCheckout = ({ options }: CheckoutVariantProps) => { const autoAdvance = options?.autoAdvance ?? true; const stickyMobileCta = options?.stickyMobileCta ?? true; const enableEditMode = options?.enableEditMode ?? true; const showOrderReview = options?.showOrderReview ?? true; const showTrustBadges = options?.showTrustBadges ?? true; const gtmEnabled = options?.gtmEnabled ?? true; const compactMode = options?.compactMode ?? false; const { sections, activeSection, openSection } = useSectionState({ autoAdvance }); useCheckoutFunnelGtm(activeSection, { enabled: gtmEnabled }); const sectionStatus = useCallback( (id: SectionId) => sections.find((section) => section.id === id)?.status ?? 'locked', [sections] ); const goTo = useCallback( (id: SectionId) => () => openSection(id), [openSection] ); return (
{showTrustBadges && }
{stickyMobileCta && (
)}
); }; export default OnePageCheckout;