This commit is contained in:
SwiftyOS
2025-07-02 09:21:41 +02:00
parent 848990411d
commit e58a4599c8
3 changed files with 17 additions and 10 deletions

View File

@@ -37,10 +37,9 @@ const fallbackIcon = FaKey;
// --8<-- [start:ProviderIconsEmbed]
// Provider icons mapping - uses fallback for unknown providers
export const providerIcons: Partial<Record<
string,
React.FC<{ className?: string }>
>> = {
export const providerIcons: Partial<
Record<string, React.FC<{ className?: string }>>
> = {
aiml_api: fallbackIcon,
anthropic: fallbackIcon,
apollo: fallbackIcon,

View File

@@ -25,15 +25,15 @@ function toDisplayName(provider: string): string {
smtp: "SMTP",
revid: "Rev.ID",
};
if (specialCases[provider]) {
return specialCases[provider];
}
// General case: convert snake_case to Title Case
return provider
.split(/[_-]/)
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.join(" ");
}
@@ -127,7 +127,11 @@ export default function CredentialsProvider({
state_token: string,
): Promise<CredentialsMetaResponse> => {
try {
const credsMeta = await api.oAuthCallback(provider as string, code, state_token);
const credsMeta = await api.oAuthCallback(
provider as string,
code,
state_token,
);
addCredentials(provider as string, credsMeta);
return credsMeta;
} catch (error) {
@@ -211,7 +215,11 @@ export default function CredentialsProvider({
CredentialsDeleteResponse | CredentialsDeleteNeedConfirmationResponse
> => {
try {
const result = await api.deleteCredentials(provider as string, id, force);
const result = await api.deleteCredentials(
provider as string,
id,
force,
);
if (!result.deleted) {
return result;
}

View File

@@ -157,7 +157,7 @@ export type Credentials =
// This allows for SDK-registered providers without hardcoding
export type CredentialsProviderName = string;
// For backward compatibility, we'll keep PROVIDER_NAMES but it should be
// For backward compatibility, we'll keep PROVIDER_NAMES but it should be
// populated dynamically from the API. This is a placeholder that will be
// replaced with actual values from the /api/integrations/providers endpoint
export const PROVIDER_NAMES = {} as Record<string, string>;