'use client'; import { getStripeWeChatPayPaymentConfig, updateStripeWeChatPayPaymentConfig, } from '@/services/admin/payment'; import { EnhancedInput } from '@repo/ui/enhanced-input'; import { unitConversion } from '@repo/ui/utils'; import { Label } from '@shadcn/ui/label'; import { toast } from '@shadcn/ui/lib/sonner'; import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, } from '@shadcn/ui/select'; import { Switch } from '@shadcn/ui/switch'; import { Table, TableBody, TableCell, TableRow } from '@shadcn/ui/table'; import { useQuery } from '@tanstack/react-query'; import { useTranslations } from 'next-intl'; export default function StripeWeChatPay() { const t = useTranslations('payment'); const { data, refetch } = useQuery({ queryKey: ['getStripeWeChatPayPaymentConfig'], queryFn: async () => { const { data } = await getStripeWeChatPayPaymentConfig(); return data.data; }, }); async function updateConfig(key: string, value: unknown) { if (data?.[key] === value) return; try { await updateStripeWeChatPayPaymentConfig({ ...data, mark: 'stripe_wechat_pay', [key]: value, } as any); toast.success(t('saveSuccess')); refetch(); } catch (error) { /* empty */ } } return (