feat: update chat URLs and paths from /kefu to /support for consistency
This commit is contained in:
@@ -720,7 +720,7 @@ function WebAccessGuide({ channelId }: { channelId: string }) {
|
||||
if (!origin || !channelId) {
|
||||
return ""
|
||||
}
|
||||
const url = new URL("/kefu/chat/", origin)
|
||||
const url = new URL("/support/chat/", origin)
|
||||
url.searchParams.set("channelId", channelId)
|
||||
return url.toString()
|
||||
}, [channelId, origin])
|
||||
@@ -729,7 +729,7 @@ function WebAccessGuide({ channelId }: { channelId: string }) {
|
||||
if (!origin || !channelId) {
|
||||
return ""
|
||||
}
|
||||
const url = new URL("/kefu", origin)
|
||||
const url = new URL("/support", origin)
|
||||
url.searchParams.set("channelId", channelId)
|
||||
return url.toString()
|
||||
}, [channelId, origin])
|
||||
@@ -858,7 +858,7 @@ function WechatMPAccessGuide({ channelId }: { channelId: string }) {
|
||||
if (!origin || !channelId) {
|
||||
return ""
|
||||
}
|
||||
const url = new URL("/kefu/chat/", origin)
|
||||
const url = new URL("/support/chat/", origin)
|
||||
url.searchParams.set("channelId", channelId)
|
||||
return url.toString()
|
||||
}, [channelId, origin])
|
||||
|
||||
@@ -25,5 +25,5 @@ async function loadCloseNavigation() {
|
||||
test("standalone close navigates to the non-bootstrapping closed page", async () => {
|
||||
const { getStandaloneClosedUrl } = await loadCloseNavigation()
|
||||
|
||||
assert.equal(getStandaloneClosedUrl(), "/kefu/closed")
|
||||
assert.equal(getStandaloneClosedUrl(), "/support/closed")
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const KEFU_CLOSED_PATH = "/kefu/closed"
|
||||
export const KEFU_CLOSED_PATH = "/support/closed"
|
||||
|
||||
export function getStandaloneClosedUrl() {
|
||||
return KEFU_CLOSED_PATH
|
||||
|
||||
@@ -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)
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user