import { I18nMessageOverrides } from './i18n'; export interface AttributeMappingConfig { source: string; target: string; label?: string; unit?: string; } /** * 分语言别名。key 为 locale(如 "zh-CN"、"en"),value 为该语言的显示名。 * 例如 { "zh-CN": "容量", "en": "Capacity" }。 */ export type LocalizedAlias = Record; /** * 数据驱动文案(接口返回的 code / value)的客户自定义显示名。 * 命中别名即覆盖对应语言显示;未命中时英文回退 code/value、其它语言回退接口 name/label。 */ export interface AliasConfig { /** key = 分类 code */ categories?: Record; /** key = 属性 code */ attributes?: Record; /** key = 属性值 value */ attributeValues?: Record; /** key = 推荐类型 value */ recommendTypes?: Record; /** 布尔属性值显示名 */ booleans?: BooleanAliasConfig; } export interface BooleanAliasConfig { true?: LocalizedAlias; false?: LocalizedAlias; byAttribute?: Record; } export interface DetailFieldConfig { source: string; target?: string; label?: string; group?: string; unit?: string; sort?: number; showEmpty?: boolean; } export interface EnumWhitelistConfig { categories?: string[]; attributeValues?: Record; } export type FilterDisplayMode = "configured" | "all"; export interface FilterFieldConfig { source: string; target?: string; label?: string; scope?: "attribute" | "recommend_type" | "has_3d"; operator?: "eq" | "in" | "nin" | "not_in" | "between" | "gte" | "lte" | "contains"; component?: "select" | "multi_select" | "range" | "text" | "boolean"; display?: "accordion"; options?: FilterStaticOption[]; hideUnit?: boolean; hideWhenNoOptions?: boolean; sort?: number; } export interface FilterStaticOption { label: string; value: string; product_count?: number; } /** * 数值筛选预设区间项。 * 例如 { label: "5-10", min: 5, max: 10 }、{ label: "20+", min: 20 }。 * 只给 min 表示 ">= min",只给 max 表示 "<= max"。 */ export interface FilterPresetOption { label: string; min?: number; max?: number; } export interface ViewerControlsConfig { graphicCustomization?: boolean; objectSelection?: boolean; materialSelection?: boolean; surfaceProcess?: boolean; colorPicker?: boolean; pantone?: boolean; rgb?: boolean; cmyk?: boolean; gradient?: boolean; } export interface ThemeConfig { primaryColor?: string; borderColor?: string; borderRadius?: string; fontFamily?: string; activeColor?: string; cardBg?: string; textColor?: string; textSecondary?: string; } export interface NavItemConfig { label: string; href?: string; active?: boolean; children?: NavItemConfig[]; } export interface BrandConfig { logoUrl?: string; name?: string; tagline?: string; } export interface FooterLinkGroupConfig { title: string; links: NavItemConfig[]; } export interface FooterConfig { copyright?: string; groups?: FooterLinkGroupConfig[]; contactEmail?: string; contactPhone?: string; qrCodeUrl?: string; } export interface ProductListConfig { categorySelection?: "single" | "multiple"; /** * 仅作用于产品列表左侧筛选面板的英文大写展示样式(通过 CSS text-transform 实现)。 * 仅在当前生效语言为英文时生效;不影响详情页、面包屑、底层数据与中文。 */ filterPanelUppercase?: boolean; filterPanelVariant?: "default" | "boxed"; gridColumns?: number; has3d?: boolean; loadMorePrefixSvg?: string; loadMoreSuffixSvg?: string; pageSize?: number; /** * 产品关键词搜索框展示位置。 * list 保持旧行为,仅显示在产品列表内容区;header 显示在站点导航栏;both 两处都显示;none 全部隐藏。 */ searchPlacement?: "list" | "header" | "both" | "none"; /** * 左侧主筛选维度。缺省(或 type:"category")渲染分类树(现状)。 * type:"attribute" 时改为渲染某个属性的可选值作为主筛选: * - code 既可是后端 typed 属性 code,也可是 value_json 的 key; * - 取值默认来自 /filter-options(按 code 匹配),可用 options 提供静态兜底; * - 选中值会以 { attribute_code: code, operator: "in", value: [选中值] } 注入搜索,并显示在标题/面包屑。 */ primaryFilter?: { type: "category"; } | { type: "attribute"; code: string; label?: string; options?: FilterStaticOption[]; }; showFooter?: boolean; showHeader?: boolean; showListTitle?: boolean; showPrimaryFilter?: boolean; title?: string; } export interface ProductCardConfig { imageHoverScale?: number; nameAlign?: "left" | "center" | "right"; showCarousel?: boolean; showCode?: boolean; } export interface ProductDetailConfig { galleryLayout?: "bottom" | "left"; recommendColumns?: number; recommendLimit?: number; recommendTitleAlign?: "left" | "center" | "right"; recommendTitleFontSize?: string; showFooter?: boolean; showGalleryArrows?: boolean; showHeader?: boolean; showInquiryButton?: boolean; showProductCode?: boolean; productTitleFontSize?: string; productTitleFontWeight?: string | number; paramsTitleFontSize?: string; paramsTitleFontWeight?: string | number; dynamicFields?: { exclude?: string[]; flattenJson?: boolean; includeUnconfiguredJson?: boolean; prefixJsonLabel?: boolean; }; } export interface FilterOptionLike { code: string; field_type?: string; is_filterable?: boolean; name?: string; options?: unknown[]; unit?: string; } export interface SiteConfig { attributeMappings?: Record>; /** * 数据驱动文案(分类/属性/属性值/布尔)的客户自定义显示名(分语言)。 * 详见 AliasConfig;与 messages(UI 静态文案)相互独立。 */ aliases?: AliasConfig; brand?: BrandConfig; detailFields?: DetailFieldConfig[]; enumWhitelist?: EnumWhitelistConfig; filterDisplay?: FilterDisplayMode; filterFields?: FilterFieldConfig[]; /** * 数值筛选的预设区间映射。 * key 使用 /filter-options 接口返回的属性 code(即 FilterFieldConfig.target)。 * 配置后该字段以固定区间 chips 取代自由数值输入。 */ filterPresets?: Record; footer?: FooterConfig; navItems?: NavItemConfig[]; productCard?: ProductCardConfig; productDetail?: ProductDetailConfig; productList?: ProductListConfig; viewerControls?: ViewerControlsConfig; theme?: ThemeConfig; locale?: string; /** * 覆盖 SDK 静态 UI 文案。值可以是全语言共用字符串,也可以是按 locale * 分组的对象,例如 { "configurator.graphicsDefaultText": { en: "New text" } }。 */ messages?: I18nMessageOverrides; } export declare const defaultAttributeMappings: Record; export declare const defaultViewerControls: Required; export declare const defaultTheme: Required; export declare const defaultProductCard: Required; export declare function resolveTheme(siteConfig?: SiteConfig | null): Required; export declare function themeToStyleVars(theme: Required): string; export declare const normalizeSiteConfig: (siteConfig?: SiteConfig | null) => SiteConfig; export declare const parseSiteConfigValue: (value: unknown) => SiteConfig | undefined; export interface SiteConfigParseResult { value?: SiteConfig; error?: Error; } export declare const parseSiteConfigResult: (value: unknown) => SiteConfigParseResult; export declare const resolveAttributeTarget: (sourceOrTarget: string, siteConfig?: SiteConfig | null) => string; export declare const resolveAttributeLabel: (source: string, siteConfig?: SiteConfig | null) => string; export declare const resolveFilterFieldTarget: (field: Pick, siteConfig?: SiteConfig | null) => string; /** 取当前生效语言:组件 site-config.locale 优先,否则取全局 currentLocale。 */ export declare const resolveActiveLocale: (config?: SiteConfig | null) => string; /** * 解析数据驱动文案(分类/属性/属性值)的显示名。 * 优先取 aliases[kind][key][locale];未命中时英文回退 code、其它语言回退 name。 */ export declare const resolveDataLabel: (config: SiteConfig | undefined, locale: string, kind: "categories" | "attributes" | "attributeValues" | "recommendTypes", key: string | undefined, fallback: { name?: string | null; code?: string | null; }) => string; export declare const resolveAttributeValueAlias: (config: SiteConfig | undefined, locale: string, value: string) => string | undefined; export declare const humanizeCodeLabel: (code: string) => string; export declare const normalizeDisplayLabel: (label: string) => string; export declare const resolveFieldLabel: (config: SiteConfig | undefined, locale: string, field: Pick, fallbackName?: string | null) => string; export declare const resolveRecommendTypeLabel: (config: SiteConfig | undefined, locale: string, type: string | undefined | null, fallback?: string | null) => string | null; export declare const isEnumValueAllowed: (config: SiteConfig | undefined, attributeCode: string | undefined, value: unknown) => boolean; export declare const isCategoryCodeAllowed: (config: SiteConfig | undefined, code: string | undefined | null) => boolean; export declare const resolveFilterFields: (config: SiteConfig | undefined, backendOptions: FilterOptionLike[], fallbackConfiguredFields?: FilterFieldConfig[]) => FilterFieldConfig[]; /** 解析布尔属性值显示名:优先 aliases.booleans,其次内置 fallback(如 t("detail.boolYes"))。 */ export declare const resolveBooleanLabel: (config: SiteConfig | undefined, locale: string, value: boolean, fallback: string, attributeKey?: string) => string;