mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-17 20:52:15 +03:00
fix(dashboard): extract getCodexPlanLabel to unfreeze providerPageHelpers.ts
The Fast Quality Gates file-size ratchet froze providerPageHelpers.ts at 1053 lines; adding getCodexPlanLabel inline pushed it to 1067. Move the self-contained helper into its own codexPlanLabel.ts module instead of growing the frozen file, and repoint ConnectionRow.tsx + the regression test at the new location. No behavior change.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Codex subscription plan label (e.g. "Plus", "Pro", "Team"), persisted on the
|
||||
* connection's providerSpecificData.chatgptPlanType at OAuth import time (see
|
||||
* src/lib/oauth/services/codexImport.ts). Returns "" when the connection is
|
||||
* not Codex or the value is missing/blank — callers gate rendering on that.
|
||||
*
|
||||
* Kept in its own module (not providerPageHelpers.ts) because that file is
|
||||
* frozen at its file-size ratchet cap (config/quality/file-size-baseline.json)
|
||||
* and this helper is fully self-contained.
|
||||
*/
|
||||
export function getCodexPlanLabel(isCodex: boolean, providerSpecificData: unknown): string {
|
||||
if (!isCodex) return "";
|
||||
const record =
|
||||
providerSpecificData && typeof providerSpecificData === "object"
|
||||
? (providerSpecificData as Record<string, unknown>)
|
||||
: {};
|
||||
const raw = record.chatgptPlanType;
|
||||
return typeof raw === "string" ? raw.trim() : "";
|
||||
}
|
||||
@@ -17,10 +17,10 @@ import {
|
||||
} from "@/lib/providers/codexFastTier";
|
||||
import {
|
||||
normalizeCodexLimitPolicy,
|
||||
getCodexPlanLabel,
|
||||
providerText,
|
||||
ERROR_TYPE_LABELS,
|
||||
} from "../providerPageHelpers";
|
||||
import { getCodexPlanLabel } from "../codexPlanLabel";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Types (exported so the client can reference them without re-importing)
|
||||
|
||||
@@ -735,22 +735,6 @@ export function normalizeCodexLimitPolicy(policy: unknown): { use5h: boolean; us
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Codex subscription plan label (e.g. "Plus", "Pro", "Team"), persisted on the
|
||||
* connection's providerSpecificData.chatgptPlanType at OAuth import time (see
|
||||
* src/lib/oauth/services/codexImport.ts). Returns "" when the connection is
|
||||
* not Codex or the value is missing/blank — callers gate rendering on that.
|
||||
*/
|
||||
export function getCodexPlanLabel(isCodex: boolean, providerSpecificData: unknown): string {
|
||||
if (!isCodex) return "";
|
||||
const record =
|
||||
providerSpecificData && typeof providerSpecificData === "object"
|
||||
? (providerSpecificData as Record<string, unknown>)
|
||||
: {};
|
||||
const raw = record.chatgptPlanType;
|
||||
return typeof raw === "string" ? raw.trim() : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* UI adapter around the canonical getCodexRequestDefaults from requestDefaults.ts.
|
||||
* Adds the "medium" fallback for reasoningEffort required by the connection form.
|
||||
|
||||
Reference in New Issue
Block a user