'use client'; import { FunctionComponent, useState } from 'react'; import { useTranslations } from 'next-intl'; import { Box, Collapse, Stack, Typography } from '@mui/material'; import AppIcon from '@/components/common/AppIcon'; import AppButton from '@/components/common/AppButton'; import EscrowNotice from '@/components/EscrowNotice'; interface ExplainerStep { icon: string; labelKey: string; } const STEPS: ExplainerStep[] = [ { icon: 'payment', labelKey: 'escrow_step_pay' }, { icon: 'lock', labelKey: 'escrow_step_hold' }, { icon: 'verified', labelKey: 'escrow_step_release' }, ]; /** * Wraps the product-mandated `EscrowNotice` (never edited) with an optional «چطور کار می‌کند؟» expander: a * 3-step visual (پرداخت ← امانت نزد بالین‌یار ← آزادسازی پس از تایید پایان ویزیت) grounded in * `product/payments/escrow-ledger.md`, plus the cancellation/refund implication. Used from checkout and the * confirmation receipt so escrow — the platform's whole reason to pay on-platform — gets more than one * alert line at the moment of maximum skepticism. * @component EscrowExplainer */ const EscrowExplainer: FunctionComponent = () => { const t = useTranslations('payment'); const [open, setOpen] = useState(false); return ( setOpen((v) => !v)} aria-expanded={open} endIcon={ } sx={{ alignSelf: 'flex-start', px: 0.5 }} > {t('escrow_explainer_toggle')} {STEPS.map((step, index) => ( {t(step.labelKey)} {index < STEPS.length - 1 ? ( ) : null} ))} {t('escrow_cancellation_note')} ); }; export default EscrowExplainer;