import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell"; import { CHATGPT_USAGE_LIMIT_CODE, CHATGPT_USAGE_URL, CHATGPT_WORKSPACE_ADMIN_REQUEST, CHATGPT_WORKSPACE_USAGE_LIMIT_CODE, } from "@t3tools/shared/usageLimits"; import * as Clipboard from "expo-clipboard"; import { useState } from "react"; import { Linking, View } from "react-native"; import { ProviderIcon } from "../../components/ProviderIcon"; import { AppText as Text } from "../../components/ui/AppText"; import { Button } from "../../components/ui/Button"; export function ChatGptUsageLimitNotice({ thread }: { thread: EnvironmentThreadShell }) { const [status, setStatus] = useState<"copied" | "copy-failed" | "open-failed" | null>(null); const code = thread.runtime?.lastErrorCode; const workspaceLimit = code === CHATGPT_WORKSPACE_USAGE_LIMIT_CODE; if (thread.runtime?.status !== "failed" || (!workspaceLimit && code !== CHATGPT_USAGE_LIMIT_CODE)) return null; return ( ChatGPT usage limit reached {workspaceLimit ? status === "copied" ? "Request copied. Send it to your workspace admin." : "You've reached your workspace's limit for using your ChatGPT plan in other apps. Copy a request to ask your workspace admin for increased usage limits." : "Review your usage settings in ChatGPT."} {workspaceLimit ? (