chore: support Zendesk widget (#25517)

This commit is contained in:
Nite Knite 2025-09-11 13:17:50 +08:00 • committed by GitHub
commit 07d067d828
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 155 additions and 35 deletions

View file

@ -0,0 +1,23 @@
import { IS_CE_EDITION } from '@/config'
export type ConversationField = {
id: string,
value: any,
}
declare global {
// eslint-disable-next-line ts/consistent-type-definitions
interface Window {
zE?: (
command: string,
value: string,
payload?: ConversationField[] | string | string[] | (() => any),
callback?: () => any,
) => void;
}
}
export const setZendeskConversationFields = (fields: ConversationField[], callback?: () => any) => {
if (!IS_CE_EDITION && window.zE)
window.zE('messenger:set', 'conversationFields', fields, callback)
}