"use client";
import { useQuery } from "@tanstack/react-query";
import { readApiResultOrThrow } from "@open-mercato/ui/backend/utils/apiCall";
function useUnitPriceDisplayEnabled() {
  const query = useQuery({
    queryKey: ["catalog", "settings", "unitPriceDisplayEnabled"],
    queryFn: async () => {
      const result = await readApiResultOrThrow(
        "/api/catalog/settings",
        void 0,
        { errorMessage: "Failed to load catalog settings.", fallback: { unitPriceDisplayEnabled: true } }
      );
      return result.unitPriceDisplayEnabled !== false;
    },
    staleTime: 6e4
  });
  return {
    enabled: query.data ?? true,
    isLoading: query.isLoading
  };
}
export {
  useUnitPriceDisplayEnabled
};
//# sourceMappingURL=useUnitPriceDisplayEnabled.js.map
