feat: update chat URLs and paths from /kefu to /support for consistency
This commit is contained in:
@@ -17,7 +17,7 @@ export type CSAgentConfig = {
|
||||
}
|
||||
|
||||
export type KefuChatRuntimeConfig = Omit<CSAgentConfig, "getUserToken"> & {
|
||||
/** Used only by /kefu/chat to exchange for a chat token; not part of CSAgentConfig. */
|
||||
/** Used only by /support/chat to exchange for a chat token; not part of CSAgentConfig. */
|
||||
userToken?: string
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,8 @@ test("getChatUrl resolves a fresh userToken for each call", async () => {
|
||||
const first = await sandbox.window.CSAgentWidget.getChatUrl()
|
||||
const second = await sandbox.window.CSAgentWidget.getChatUrl()
|
||||
|
||||
assert.equal(new URL(first).pathname, "/support/chat/")
|
||||
assert.equal(new URL(second).pathname, "/support/chat/")
|
||||
assert.equal(new URL(first).searchParams.get("userToken"), "token_1")
|
||||
assert.equal(new URL(second).searchParams.get("userToken"), "token_2")
|
||||
assert.equal(calls, 2)
|
||||
@@ -140,6 +142,7 @@ test("launcher click creates chat iframe with a freshly resolved userToken", asy
|
||||
)
|
||||
|
||||
assert.ok(frame)
|
||||
assert.equal(new URL(frame.src).pathname, "/support/chat/")
|
||||
assert.equal(new URL(frame.src).searchParams.get("userToken"), "click_token")
|
||||
})
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ type FrameMessage =
|
||||
|
||||
function createFrameUrl(config: NormalizedCSAgentConfig, userToken: string) {
|
||||
const widgetBaseUrl = resolveWidgetBaseUrl(config)
|
||||
const frameUrl = new URL(`${widgetBaseUrl}/kefu/chat/`)
|
||||
const frameUrl = new URL(`${widgetBaseUrl}/support/chat/`)
|
||||
frameUrl.searchParams.set("channelId", config.channelId)
|
||||
frameUrl.searchParams.set("baseUrl", config.baseUrl)
|
||||
if (config.apiBaseUrl) frameUrl.searchParams.set("apiBaseUrl", config.apiBaseUrl)
|
||||
|
||||
Reference in New Issue
Block a user