@salesforcedevs/docs-components
Advanced tools
Comparing version
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "0.0.17-chat", | ||
"version": "0.0.18-chat", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -38,2 +38,11 @@ import { LightningElement, api, track } from "lwc"; | ||
@api | ||
get isOpen() { | ||
return this._isOpen; | ||
} | ||
set isOpen(value) { | ||
this._isOpen = normalizeBoolean(value); | ||
} | ||
@track messages: ChatMessage[] = []; | ||
@@ -45,2 +54,3 @@ @track currentMessage: string = ""; | ||
private _showTimestamp: boolean = false; | ||
private _isOpen: boolean = false; | ||
private messageIdCounter: number = 0; | ||
@@ -56,6 +66,11 @@ | ||
"chat-container", | ||
this.disabled && "chat-container--disabled" | ||
this.disabled && "chat-container--disabled", | ||
this.isOpen && "chat-container--open" | ||
); | ||
} | ||
get showTriggerButton() { | ||
return !this.isOpen; | ||
} | ||
get messagesWithTyping() { | ||
@@ -166,2 +181,38 @@ const messages = [...this.messages]; | ||
} | ||
handleCloseClick() { | ||
this.isOpen = false; | ||
// Dispatch custom event to notify parent components | ||
this.dispatchEvent(new CustomEvent('chatclosed', { | ||
detail: { closed: true } | ||
})); | ||
} | ||
handleOpenClick() { | ||
this.isOpen = true; | ||
// Dispatch custom event to notify parent components | ||
this.dispatchEvent(new CustomEvent('chatopened', { | ||
detail: { opened: true } | ||
})); | ||
} | ||
openChat() { | ||
this.isOpen = true; | ||
// Dispatch custom event to notify parent components | ||
this.dispatchEvent(new CustomEvent('chatopened', { | ||
detail: { opened: true } | ||
})); | ||
} | ||
closeChat() { | ||
this.isOpen = false; | ||
// Dispatch custom event to notify parent components | ||
this.dispatchEvent(new CustomEvent('chatclosed', { | ||
detail: { closed: true } | ||
})); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
303111
3.51%94
1.08%7493
2.34%