fix(subscription): report the acting environment's plan for gating
Feature gates and the resource cap are enforced against the environment the user is standing in, but /subscription/my only ever returned the plan of the environment they own. A doctor working as a guest in another clinic consumed the host clinic's resource quota while the panel showed their own plan's cap, so the quota number and the menu locks disagreed with what the server would allow. /subscription/my now also returns context_plan — limits and features of the acting environment, without the other environment's plan identity. effective_plan, subscription and used_trial stay on the owned environment so the purchase flow is unchanged, and useSubscription reads its caps and hasFeature from context_plan. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -604,7 +604,7 @@ export interface MySubscriptionData {
|
||||
days_remaining?: number;
|
||||
} | null;
|
||||
used_trial: boolean;
|
||||
/** پلن مؤثر: پلن اشتراک فعال یا پلن پیشفرض free در نبود اشتراک. */
|
||||
/** پلن مؤثرِ محیطِ **مالکیت** — مبنای خرید و ارتقا. */
|
||||
effective_plan: {
|
||||
name: string;
|
||||
level: number;
|
||||
@@ -612,6 +612,16 @@ export interface MySubscriptionData {
|
||||
max_resources: number;
|
||||
features: Record<string, boolean>;
|
||||
} | null;
|
||||
/**
|
||||
* پلن محیطی که کاربر همین حالا در آن ایستاده — مبنای سقفها و قفل قابلیتها،
|
||||
* چون سرور هم با همین محیط میسنجد. برای کاربری که فقط محیط خودش را دارد با
|
||||
* `effective_plan` یکی است.
|
||||
*/
|
||||
context_plan: {
|
||||
max_secretaries: number;
|
||||
max_resources: number;
|
||||
features: Record<string, boolean>;
|
||||
} | null;
|
||||
}
|
||||
/** @deprecated use MySubscriptionData */
|
||||
export interface MySubscription {
|
||||
|
||||
Reference in New Issue
Block a user