Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018BAUeCFpDkRD6tU5wGsc1C
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { SubscriptionPlanType } from '../value-objects/subscription-plan.vo';
|
|
|
|
/**
|
|
* Questions par utilisateur et par jour.
|
|
*
|
|
* `-1` signifie illimite, comme partout ailleurs dans le domaine
|
|
* (`maxLicenses`, `maxShipmentsPerYear`). Platinium est une offre sur devis :
|
|
* elle n'est pas plafonnee.
|
|
*/
|
|
export const TRADE_DAILY_LIMITS: Readonly<Record<SubscriptionPlanType, number>> = {
|
|
BRONZE: 3,
|
|
SILVER: 10,
|
|
GOLD: 15,
|
|
PLATINIUM: -1,
|
|
};
|
|
|
|
export const TRADE_SUPPORT_EMAIL = 'support@xpeditis.com';
|
|
|
|
/**
|
|
* Limite d'une offre, avec repli sur Bronze.
|
|
*
|
|
* L'offre arrive d'une colonne de base de donnees : une valeur inconnue —
|
|
* ancienne offre, ligne ecrite a la main — donnait `undefined`, puis un
|
|
* `NaN` de bout en bout jusqu'a « NaN/undefined » dans l'interface. Le repli
|
|
* sur l'offre la plus restrictive est le seul comportement sur.
|
|
*/
|
|
export function tradeDailyLimit(plan: string): number {
|
|
return Object.prototype.hasOwnProperty.call(TRADE_DAILY_LIMITS, plan)
|
|
? TRADE_DAILY_LIMITS[plan as SubscriptionPlanType]
|
|
: TRADE_DAILY_LIMITS.BRONZE;
|
|
}
|
|
|
|
export const isUnlimitedTradeQuota = (limit: number): boolean => limit < 0;
|