feat: add runtime configuration for Kefu Chat SDK

- Introduced `readKefuChatRuntimeConfig` and `setKefuChatRuntimeConfig` functions to manage runtime configuration for the Kefu Chat SDK.
- Updated `useKefuChatStore` to utilize the new runtime configuration functions instead of the previous widget config methods.
- Modified the SDK build process to compile TypeScript instead of JavaScript, enhancing type safety and maintainability.
- Updated the minified SDK file to reflect the changes in configuration handling and TypeScript compilation.
This commit is contained in:
mlogclub
2026-05-06 19:28:49 +08:00
parent bd9fad68a7
commit 15710d294f
12 changed files with 651 additions and 606 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { request } from "@/lib/api/client"
import { readKefuWidgetConfig } from "@/lib/kefu-widget-config"
import { readKefuChatRuntimeConfig } from "@/lib/sdk/runtime-config"
import { generateUUID } from "@/lib/utils"
export type Paging = {
@@ -157,7 +157,7 @@ export function getGuestId() {
}
function getRuntimeImConfig() {
const widgetConfig = readKefuWidgetConfig()
const widgetConfig = readKefuChatRuntimeConfig()
const baseUrl = (widgetConfig.apiBaseUrl || widgetConfig.baseUrl || API_BASE_URL)
.trim()
.replace(/\/$/, "")