Add/mcp and visma (#547)
* fix: simplify COMING_SOON_PROVIDERS to include only bjornlunden and briox * feat: add supplier creation functionality and related operations * feat: reorder and enhance OAuth scopes in Visma integration * feat: implement create supplier functionality with validation and risk tier management
This commit is contained in:
@@ -7,24 +7,29 @@ import {
|
||||
} from '@/lib/http/fetch-with-timeout';
|
||||
|
||||
const DEFAULT_SCOPES = [
|
||||
'offline_access',
|
||||
'ea:api',
|
||||
'offline_access',
|
||||
'ea:sales',
|
||||
'ea:accounting',
|
||||
'ea:purchase',
|
||||
'vls:api',
|
||||
];
|
||||
|
||||
const EACCOUNTING_ACR_VALUE = 'service:44643EB1-3F76-4C1C-A672-402AE8085934';
|
||||
|
||||
const ALLOWED_PROMPT_VALUES = new Set(['none', 'login', 'consent', 'select_account']);
|
||||
|
||||
export function buildVismaAuthUrl(
|
||||
config: OAuthConfig,
|
||||
options?: { scopes?: string[]; state?: string; acrValues?: string },
|
||||
options?: { scopes?: string[]; state?: string; acrValues?: string; prompt?: string },
|
||||
): string {
|
||||
const promptCandidate = options?.prompt ?? 'select_account';
|
||||
const prompt = ALLOWED_PROMPT_VALUES.has(promptCandidate) ? promptCandidate : 'select_account';
|
||||
|
||||
const params = new URLSearchParams({
|
||||
client_id: config.clientId,
|
||||
redirect_uri: config.redirectUri,
|
||||
response_type: 'code',
|
||||
prompt,
|
||||
acr_values: options?.acrValues ?? EACCOUNTING_ACR_VALUE,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user