Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
commit
8580c996c3
1285 files changed
+325780
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import type { CreditBalance } from "$lib/types";
|
||||
import {
|
||||
canFeatureFromCredits,
|
||||
type CapabilitiesStatus
|
||||
} from "$lib/plan-capabilities";
|
||||
import {
|
||||
isFreePlan as isFreePlanFromBilling,
|
||||
planDisplayName as planDisplayNameFromBilling,
|
||||
type PlanLike
|
||||
} from "$lib/billing-display";
|
||||
|
||||
/** True when the company is on Free / no paid plan (AI campaign features gated). */
|
||||
export function isFreePlan(credits?: CreditBalance | null): boolean {
|
||||
const plan =
|
||||
credits?.plan && typeof credits.plan === "object"
|
||||
? (credits.plan as PlanLike)
|
||||
: null;
|
||||
return isFreePlanFromBilling(plan, credits);
|
||||
}
|
||||
|
||||
/** Display label — same contract as billing-display (never invent "Free" for missing plans). */
|
||||
export function planDisplayName(credits?: CreditBalance | null): string {
|
||||
const plan =
|
||||
credits?.plan && typeof credits.plan === "object"
|
||||
? (credits.plan as PlanLike)
|
||||
: null;
|
||||
return planDisplayNameFromBilling(plan, credits);
|
||||
}
|
||||
|
||||
/** Contract helper: effective feature from credits.features (see plan-capabilities). */
|
||||
export function canFeature(
|
||||
credits: CreditBalance | null | undefined,
|
||||
key: string,
|
||||
status: CapabilitiesStatus = "missing"
|
||||
): boolean {
|
||||
return canFeatureFromCredits(credits, key, status);
|
||||
}
|
||||
Reference in new issue
Block a user