import { LimitInfoFragment, RefreshLimitsQuery } from "@dashboard/graphql";
export function hasLimits(
limits: RefreshLimitsQuery["shop"]["limits"],
key: keyof LimitInfoFragment,
): boolean {
if (limits === undefined) {
return false;
}
return limits.allowedUsage[key] !== null;
export function isLimitReached(
if (!hasLimits(limits, key)) {
return limits.currentUsage[key] >= limits.allowedUsage[key];