import { Button, Heading, Label, Select, Text, toast } from "@medusajs/ui" import { useState } from "react" import { useTranslation } from "react-i18next" import { HttpTypes } from "@medusajs/types" import { RouteDrawer, useRouteModal } from "../../../components/modals" import { useExportCustomers } from "../../../hooks/api" import { useCustomerTableQuery } from "../../../hooks/table/query" import { ExportFilters } from "./components/export-filters" type ExportFormat = NonNullable export const CustomerExport = () => { const { t } = useTranslation() return ( {t("customers.export.header")} {t("customers.export.description")} ) } const CustomerExportContent = () => { const { t } = useTranslation() const { searchParams } = useCustomerTableQuery({}) const [format, setFormat] = useState("json") const { mutateAsync } = useExportCustomers() const { handleSuccess } = useRouteModal() const handleExportRequest = async () => { await mutateAsync( { payload: { format }, query: searchParams, }, { onSuccess: () => { toast.info(t("customers.export.success.title"), { description: t("customers.export.success.description"), }) handleSuccess() }, onError: (err) => { toast.error(err.message) }, } ) } return ( <>
{t("customers.export.format.description")}
) }