Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/chat/messages/action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export default class Action extends MessageType {

performAction(action: IAction) {
botman.callAPI(action.value, true, null, (msg: IMessage) => {
this.setState({ attachmentsVisible : false});
if (this.props.conf.oneTimeButtons) {
this.setState({attachmentsVisible: false});
}
this.props.messageHandler({
text: msg.text,
type: msg.type,
Expand Down
4 changes: 3 additions & 1 deletion src/chat/messages/buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default class ButtonsType extends MessageType {

performAction(button: IButton) {
botman.callAPI(button.payload, true, null, (msg: IMessage) => {
this.setState({ attachmentsVisible : false});
if (this.props.conf.oneTimeButtons) {
this.setState({attachmentsVisible: false});
}
this.props.messageHandler({
text: msg.text,
type: msg.type,
Expand Down
10 changes: 6 additions & 4 deletions src/typings/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


export interface IMessageTypeProps {
message: IMessage,
calculatedTimeout?: number,
Expand Down Expand Up @@ -45,7 +43,7 @@ export interface IAttachment {
}

export interface IElement {
title : string,
title: string,
image_url: string,
item_url: string,
subtitle: string,
Expand Down Expand Up @@ -106,6 +104,10 @@ export interface IConfiguration {
*/
sendWidgetOpenedEvent: boolean,
widgetOpenedEventData: string,
/*
* Hide buttons after action fired
*/
oneTimeButtons: boolean,
mainColor: string,
headerTextColor: string,
bubbleBackground: string,
Expand Down Expand Up @@ -133,4 +135,4 @@ export interface IConfiguration {
echoEventName: string,

init?: Function
}
}
1 change: 1 addition & 0 deletions src/widget/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const defaultConfiguration: IConfiguration = {
displayMessageTime: true,
sendWidgetOpenedEvent: false,
widgetOpenedEventData: '',
oneTimeButtons: true,
mainColor: '#408591',
headerTextColor: '#333',
bubbleBackground: '#408591',
Expand Down