"use client";
import { useQuery } from "@tanstack/react-query";
import { readApiResultOrThrow } from "@open-mercato/ui/backend/utils/apiCall";
function useFeatureFlagBoolean(options) {
  const query = useQuery({
    queryKey: ["featureToggles", "check", options?.id],
    queryFn: async () => {
      const params = new URLSearchParams({
        identifier: options.id
      });
      const result = await readApiResultOrThrow(
        `/api/feature_toggles/check/boolean?${params.toString()}`,
        void 0,
        { errorMessage: "Failed to check feature flag." }
      );
      return result;
    },
    enabled: !!options.id
  });
  const enabled = query.data?.ok ? query.data.value : false;
  const isLoading = query.isLoading;
  return {
    enabled,
    isLoading
  };
}
export {
  useFeatureFlagBoolean
};
//# sourceMappingURL=useFeatureFlagBoolean.js.map
