;
+ }
+> = {
+ 'privacy-policy': {
+ get: adminLegalPagesApi.getPrivacyPolicy,
+ update: adminLegalPagesApi.updatePrivacyPolicy,
+ },
+ 'public-offer': {
+ get: adminLegalPagesApi.getPublicOffer,
+ update: adminLegalPagesApi.updatePublicOffer,
+ },
+ 'recurrent-payments': {
+ get: adminLegalPagesApi.getRecurrentPayments,
+ update: adminLegalPagesApi.updateRecurrentPayments,
+ },
+};
+
function extractErrorDetail(err: unknown): string | null {
const error = err as { response?: { data?: { detail?: unknown } } };
const detail = error.response?.data?.detail;
@@ -103,7 +128,7 @@ function DocumentEditor({
kind,
onDirtyChange,
}: {
- kind: 'privacy-policy' | 'public-offer';
+ kind: DocumentKind;
onDirtyChange: (dirty: boolean) => void;
}) {
const { t } = useTranslation();
@@ -118,10 +143,7 @@ function DocumentEditor({
const { data, isLoading, isFetching } = useQuery({
queryKey: ['admin', 'legal-pages', kind],
- queryFn: () =>
- kind === 'privacy-policy'
- ? adminLegalPagesApi.getPrivacyPolicy()
- : adminLegalPagesApi.getPublicOffer(),
+ queryFn: () => DOCUMENT_API[kind].get(),
staleTime: 0,
gcTime: 0,
});
@@ -167,9 +189,7 @@ function DocumentEditor({
is_enabled: enabled[language] ?? false,
})),
};
- return kind === 'privacy-policy'
- ? adminLegalPagesApi.updatePrivacyPolicy(payload)
- : adminLegalPagesApi.updatePublicOffer(payload);
+ return DOCUMENT_API[kind].update(payload);
},
onSuccess: () => {
haptic.success();
@@ -661,7 +681,7 @@ export default function AdminLegalPages() {
- {(['privacy', 'offer', 'rules', 'faq'] as const).map((tab) => (
+ {(['privacy', 'offer', 'recurrent', 'rules', 'faq'] as const).map((tab) => (
)}
+ {activeTab === 'recurrent' && (
+
+ )}
{activeTab === 'rules' && }
{activeTab === 'faq' && }
diff --git a/src/pages/PublicLegal.tsx b/src/pages/PublicLegal.tsx
index 024b17b..20b8a46 100644
--- a/src/pages/PublicLegal.tsx
+++ b/src/pages/PublicLegal.tsx
@@ -5,7 +5,7 @@ import { infoApi } from '../api/info';
import { formatContent } from '../utils/legalContent';
import LanguageSwitcher from '../components/LanguageSwitcher';
-export type PublicLegalDoc = 'offer' | 'privacy';
+export type PublicLegalDoc = 'offer' | 'privacy' | 'recurrent';
interface PublicLegalProps {
doc: PublicLegalDoc;
@@ -32,6 +32,12 @@ const DOC_CONFIG: Record<
titleFallback: 'Политика конфиденциальности',
fetch: infoApi.getPrivacyPolicy,
},
+ recurrent: {
+ queryKey: 'recurrent-payments',
+ titleKey: 'footer.recurrent',
+ titleFallback: 'Рекуррентные платежи',
+ fetch: infoApi.getRecurrentPayments,
+ },
};
// Public, unauthenticated viewer for the legal documents linked from the login