fix(cloud): add missing oauth action bindings and validation status helper
This commit is contained in:
1 parent
4fa0a3c63d
commit
87c17a1ed0
2 files changed
+50
-3
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import type { TFunction } from 'i18next';
|
||||
import { isOAuthReauthReason, isRateLimitReason } from '@/utils/account-status';
|
||||
|
||||
export function getValidationBlockedStatusLabel(
|
||||
status: 'active' | 'rate_limited' | 'expired' | undefined,
|
||||
reason: string | undefined,
|
||||
t: TFunction,
|
||||
): string | null {
|
||||
const normalizedReason = (reason || '').toLowerCase();
|
||||
const hasReason = normalizedReason !== '';
|
||||
const isBlockedByStatus = status === 'rate_limited' || status === 'expired';
|
||||
|
||||
if (!isBlockedByStatus && !hasReason) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (status === 'rate_limited' || isRateLimitReason(normalizedReason)) {
|
||||
return t('cloud.card.validationRiskControlled');
|
||||
}
|
||||
|
||||
if (status === 'expired' || isOAuthReauthReason(normalizedReason)) {
|
||||
return t('cloud.card.validationOAuthReauthRequired');
|
||||
}
|
||||
|
||||
return t('cloud.card.validationRequired');
|
||||
}
|
||||
Reference in new issue
Block a user