feat: allow disabling signature

This commit is contained in:
Shivam Mishra
2026-03-05 16:01:03 +05:30
parent 6a6c3b7c27
commit 2f46cf162d
3 changed files with 36 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
disableSignature?: boolean; // Disable signature controls and insertion
signature?: string; // Custom message signature (overrides user profile signature)
}
```
@@ -148,6 +149,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_DISABLE_SIGNATURE__ // Disable signature controls and insertion
window.__WOOT_CUSTOM_SIGNATURE__ // Custom signature (overrides profile)
window.__WOOT_ISOLATED_SHELL__ // Disables audio notifications
window.__CHATWOOT_STORE__ // Vuex store reference
@@ -18,6 +18,7 @@ export const ChatwootProvider = ({
conversationId,
disableUpload,
disableEditor,
disableSignature,
signature,
children,
}) => {
@@ -40,6 +41,7 @@ export const ChatwootProvider = ({
conversationId: Number(conversationId),
disableEditor: disableEditor || false,
disableUpload: disableUpload || false,
disableSignature: disableSignature || false,
websocketURL: websocketURL,
pubsubToken: pubsubToken,
signature: signature || '',
@@ -59,6 +61,7 @@ export const ChatwootProvider = ({
window.__WOOT_CONVERSATION_ID__ = config.conversationId;
window.__EDITOR_DISABLE_UPLOAD__ = config.disableUpload;
window.__DISABLE_EDITOR__ = config.disableEditor;
window.__WOOT_DISABLE_SIGNATURE__ = config.disableSignature;
window.__WOOT_CUSTOM_SIGNATURE__ = config.signature || undefined;
window.__WOOT_ISOLATED_SHELL__ = true;
/* eslint-enable no-underscore-dangle */
@@ -100,6 +103,16 @@ export const ChatwootProvider = ({
);
}, [signature]);
// Keep signature toggle global in sync when the prop changes after init
useEffect(() => {
const value = disableSignature === true;
// eslint-disable-next-line no-underscore-dangle
window.__WOOT_DISABLE_SIGNATURE__ = value;
window.dispatchEvent(
new CustomEvent('chatwoot:disable-signature-change', { detail: value })
);
}, [disableSignature]);
if (!initializationComplete) {
return null;
}