Updated the public documentation site with improved layout and accessibility, including new sections for client integration and admin guides. Enhanced API queries by adding 'active_only' and 'group_by' parameters for better data filtering in risk management. Refined UI components for agent management, ensuring consistent styling and improved user experience across the application. Added localization support for new documentation content in English and Nepali.
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
type DocPageKey =
|
|
| "overview"
|
|
| "delivery"
|
|
| "quickstart"
|
|
| "fundamentals"
|
|
| "setup"
|
|
| "sso"
|
|
| "iframe"
|
|
| "wallet"
|
|
| "transfer"
|
|
| "errors"
|
|
| "troubleshooting"
|
|
| "golive";
|
|
|
|
const INTEGRATION_DOCS_NS = "integrationDocs";
|
|
|
|
function asStringArray(value: unknown): string[] {
|
|
return Array.isArray(value) ? value.filter((item): item is string => typeof item === "string") : [];
|
|
}
|
|
|
|
function asStringMatrix(value: unknown): string[][] {
|
|
return Array.isArray(value)
|
|
? value.filter((row): row is string[] => Array.isArray(row) && row.every((cell) => typeof cell === "string"))
|
|
: [];
|
|
}
|
|
|
|
export function useIntegrationDoc(page: DocPageKey) {
|
|
const { t } = useTranslation(INTEGRATION_DOCS_NS);
|
|
|
|
return {
|
|
t,
|
|
p: (key: string) => t(`pages.${page}.${key}`, { ns: INTEGRATION_DOCS_NS }),
|
|
rows: (key: string) =>
|
|
asStringMatrix(t(`pages.${page}.${key}`, { returnObjects: true, ns: INTEGRATION_DOCS_NS })),
|
|
list: (key: string) =>
|
|
asStringArray(t(`pages.${page}.${key}`, { returnObjects: true, ns: INTEGRATION_DOCS_NS })),
|
|
header: (key: string) =>
|
|
asStringArray(t(`headers.${key}`, { returnObjects: true, ns: INTEGRATION_DOCS_NS })),
|
|
};
|
|
}
|