mirror of
https://github.com/langgenius/dify.git
synced 2026-06-17 14:51:10 +08:00
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: hjlarry <hjlarry@163.com> Co-authored-by: fatelei <fatelei@gmail.com> Co-authored-by: Asuka Minato <i@asukaminato.eu.org> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com> Co-authored-by: gigglewang <gigglewang@dify.ai> Co-authored-by: Yunlu Wen <yunlu.wen@dify.ai> Co-authored-by: chariri <w@chariri.moe> Co-authored-by: Evan <2869018789@qq.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
73 lines
2.2 KiB
TypeScript
73 lines
2.2 KiB
TypeScript
import type { IntegrationSection } from '@/app/components/integrations/routes'
|
|
import { INTEGRATION_SECTION_VALUES } from '@/app/components/integrations/routes'
|
|
|
|
export const ACCOUNT_SETTING_MODAL_ACTION = 'showSettings'
|
|
|
|
export const ACCOUNT_SETTING_TAB = {
|
|
PROVIDER: 'provider',
|
|
MEMBERS: 'members',
|
|
BILLING: 'billing',
|
|
DATA_SOURCE: 'data-source',
|
|
API_BASED_EXTENSION: 'custom-endpoint',
|
|
CUSTOM: 'custom',
|
|
LANGUAGE: 'language',
|
|
} as const
|
|
|
|
export type AccountSettingTab = typeof ACCOUNT_SETTING_TAB[keyof typeof ACCOUNT_SETTING_TAB]
|
|
|
|
export const DEFAULT_ACCOUNT_SETTING_TAB = ACCOUNT_SETTING_TAB.MEMBERS
|
|
|
|
const WORKSPACE_SETTING_TAB_VALUES = [
|
|
ACCOUNT_SETTING_TAB.MEMBERS,
|
|
ACCOUNT_SETTING_TAB.BILLING,
|
|
ACCOUNT_SETTING_TAB.CUSTOM,
|
|
] as const
|
|
|
|
export type WorkspaceSettingTab = typeof WORKSPACE_SETTING_TAB_VALUES[number]
|
|
|
|
const USER_SETTING_TAB_VALUES = [
|
|
ACCOUNT_SETTING_TAB.LANGUAGE,
|
|
] as const
|
|
|
|
export type UserSettingTab = typeof USER_SETTING_TAB_VALUES[number]
|
|
|
|
export type IntegrationSettingTab = IntegrationSection
|
|
|
|
export const SETTINGS_TAB_VALUES = [
|
|
...WORKSPACE_SETTING_TAB_VALUES,
|
|
...USER_SETTING_TAB_VALUES,
|
|
...INTEGRATION_SECTION_VALUES,
|
|
] as const
|
|
|
|
export type SettingsTab = typeof SETTINGS_TAB_VALUES[number]
|
|
|
|
export const isValidAccountSettingTab = (tab: string | null): tab is AccountSettingTab => {
|
|
if (!tab)
|
|
return false
|
|
return Object.values(ACCOUNT_SETTING_TAB).includes(tab as AccountSettingTab)
|
|
}
|
|
|
|
export const isValidSettingsTab = (tab: string | null): tab is SettingsTab => {
|
|
if (!tab)
|
|
return false
|
|
return SETTINGS_TAB_VALUES.includes(tab as SettingsTab)
|
|
}
|
|
|
|
export const isWorkspaceSettingTab = (tab: SettingsTab | null): tab is WorkspaceSettingTab => {
|
|
if (!tab)
|
|
return false
|
|
return WORKSPACE_SETTING_TAB_VALUES.includes(tab as WorkspaceSettingTab)
|
|
}
|
|
|
|
export const isUserSettingTab = (tab: SettingsTab | null): tab is UserSettingTab => {
|
|
if (!tab)
|
|
return false
|
|
return USER_SETTING_TAB_VALUES.includes(tab as UserSettingTab)
|
|
}
|
|
|
|
export const isIntegrationSettingTab = (tab: SettingsTab | null): tab is IntegrationSettingTab => {
|
|
if (!tab)
|
|
return false
|
|
return INTEGRATION_SECTION_VALUES.includes(tab as IntegrationSection)
|
|
}
|