|
23 | 23 | from datetime import datetime |
24 | 24 | from pathlib import Path |
25 | 25 | from types import ModuleType |
26 | | -from typing import Any, Callable, List, NamedTuple, Optional |
| 26 | +from typing import Callable, List, NamedTuple, Optional |
27 | 27 | from urllib.parse import urlparse |
28 | 28 |
|
29 | 29 | import httpx |
@@ -2025,38 +2025,3 @@ def get_user_tier(): |
2025 | 2025 | if authenticated_token[0] |
2026 | 2026 | else "anonymous" |
2027 | 2027 | ) |
2028 | | - |
2029 | | - |
2030 | | -def check_config_option_in_tier( |
2031 | | - option_name: str, |
2032 | | - allowed_tiers: list[str], |
2033 | | - fallback_value: Any, |
2034 | | - help_link: str | None = None, |
2035 | | -): |
2036 | | - """Check if a config option is allowed for the authenticated user's current tier. |
2037 | | -
|
2038 | | - Args: |
2039 | | - option_name: The name of the option to check. |
2040 | | - allowed_tiers: The tiers that are allowed to use the option. |
2041 | | - fallback_value: The fallback value if the option is not allowed. |
2042 | | - help_link: The help link to show to a user that is authenticated. |
2043 | | - """ |
2044 | | - config = get_config() |
2045 | | - current_tier = get_user_tier() |
2046 | | - |
2047 | | - if current_tier == "anonymous": |
2048 | | - the_remedy = ( |
2049 | | - "You are currently logged out. Run `reflex login` to access this option." |
2050 | | - ) |
2051 | | - else: |
2052 | | - the_remedy = ( |
2053 | | - f"Your current subscription tier is `{current_tier}`. " |
2054 | | - f"Please upgrade to {allowed_tiers} to access this option. " |
2055 | | - ) |
2056 | | - if help_link: |
2057 | | - the_remedy += f"See {help_link} for more information." |
2058 | | - |
2059 | | - if current_tier not in allowed_tiers: |
2060 | | - console.warn(f"Config option `{option_name}` is restricted. {the_remedy}") |
2061 | | - setattr(config, option_name, fallback_value) |
2062 | | - config._set_persistent(**{option_name: fallback_value}) |
0 commit comments