feat: allow custom signature

This commit is contained in:
Shivam Mishra
2026-02-26 20:31:15 +05:30
parent 787c99bfd2
commit 15c710ec01
4 changed files with 43 additions and 2 deletions
+2
View File
@@ -134,6 +134,7 @@ interface ChatwootProviderProps {
pubsubToken?: string; // PubSub authentication token
disableUpload?: boolean; // Disable file attachments
disableEditor?: boolean; // Disable reply editor
signature?: string; // Custom message signature (overrides user profile signature)
}
```
@@ -147,6 +148,7 @@ window.__PUBSUB_TOKEN__ // Real-time auth token
window.__WOOT_CONVERSATION_ID__ // Active conversation
window.__EDITOR_DISABLE_UPLOAD__ // Upload flag
window.__DISABLE_EDITOR__ // Editor flag
window.__WOOT_CUSTOM_SIGNATURE__ // Custom signature (overrides profile)
window.__WOOT_ISOLATED_SHELL__ // Disables audio notifications
window.__CHATWOOT_STORE__ // Vuex store reference
window.WootConstants // Global constants
@@ -18,6 +18,7 @@ export const ChatwootProvider = ({
conversationId,
disableUpload,
disableEditor,
signature,
children,
}) => {
const isInitialized = useRef(false);
@@ -41,6 +42,7 @@ export const ChatwootProvider = ({
disableUpload: disableUpload || false,
websocketURL: websocketURL,
pubsubToken: pubsubToken,
signature: signature || '',
};
function initializeChatwootGlobals() {
@@ -57,6 +59,7 @@ export const ChatwootProvider = ({
window.__WOOT_CONVERSATION_ID__ = config.conversationId;
window.__EDITOR_DISABLE_UPLOAD__ = config.disableUpload;
window.__DISABLE_EDITOR__ = config.disableEditor;
window.__WOOT_CUSTOM_SIGNATURE__ = config.signature || undefined;
window.__WOOT_ISOLATED_SHELL__ = true;
/* eslint-enable no-underscore-dangle */
@@ -87,6 +90,16 @@ export const ChatwootProvider = ({
config.pubsubToken,
]);
// Keep signature global in sync when the prop changes after init
useEffect(() => {
const value = signature || undefined;
// eslint-disable-next-line no-underscore-dangle
window.__WOOT_CUSTOM_SIGNATURE__ = value;
window.dispatchEvent(
new CustomEvent('chatwoot:signature-change', { detail: value || '' })
);
}, [signature]);
if (!initializationComplete) {
return null;
}