mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-30 10:42:38 +00:00
feat: Add the ability to close and reopen the chat window via SDK (#3080)
This commit is contained in:
@@ -40,8 +40,8 @@ const runSDK = ({ baseUrl, websiteToken }) => {
|
|||||||
launcherTitle: chatwootSettings.launcherTitle || '',
|
launcherTitle: chatwootSettings.launcherTitle || '',
|
||||||
showPopoutButton: chatwootSettings.showPopoutButton || false,
|
showPopoutButton: chatwootSettings.showPopoutButton || false,
|
||||||
|
|
||||||
toggle() {
|
toggle(state) {
|
||||||
IFrameHelper.events.toggleBubble();
|
IFrameHelper.events.toggleBubble(state);
|
||||||
},
|
},
|
||||||
|
|
||||||
setUser(identifier, user) {
|
setUser(identifier, user) {
|
||||||
|
|||||||
@@ -137,8 +137,15 @@ export const IFrameHelper = {
|
|||||||
setBubbleText(window.$chatwoot.launcherTitle || message.label);
|
setBubbleText(window.$chatwoot.launcherTitle || message.label);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleBubble: () => {
|
toggleBubble: state => {
|
||||||
onBubbleClick();
|
let bubbleState = {};
|
||||||
|
if (state === 'open') {
|
||||||
|
bubbleState.toggleValue = true;
|
||||||
|
} else if (state === 'close') {
|
||||||
|
bubbleState.toggleValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
onBubbleClick(bubbleState);
|
||||||
},
|
},
|
||||||
|
|
||||||
onBubbleToggle: isOpen => {
|
onBubbleToggle: isOpen => {
|
||||||
|
|||||||
Reference in New Issue
Block a user