# Class: chatUI

## chatUI(container) → {object}

#### new chatUI(container) → {object}

chatUI constructor

##### Parameters:

Name | Type | Description
--- | --- | ---
`container` | d3-selection | Container for the chat interface.

Source:
  - index-d3.js, line 7

##### Returns:

chatUI object

Type
  object

### Methods

#### (static) module.addBubble(options, callback) → {integer}

##### Parameters:

Name | Type | Description
--- | --- | ---
`options` | object | object containing configs {type:string (e.g. 'text' or 'select'), class:string ('human' || 'bot'), value:depends on type}
`callback` | function | function to be called after everything is done

Source:
  - index-d3.js, line 43

##### Returns:

id - id of the bubble

Type
  integer

#### (static) module.appendText(bubble, options, callback)

Helper Function for adding text to a bubble

##### Parameters:

Name | Type | Description
--- | --- | ---
`bubble` | d3-selection | d3 selection of the bubble container
`options` | object | object containing configs {type:'text', class:string ('human' || 'bot'), value:string (e.g. 'Hello World')}
`callback` | function | function to be called after everything is done

Source:
  - index-d3.js, line 133

#### (static) module.getBubble(id) → {object}

Remove all bubbles until the bubble with 'id' from the chat

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | integer | id of bubble provided by addBubble

Source:
  - index-d3.js, line 223

##### Returns:

obj - {el:d3-selection, obj:bubble-data}

Type
  object

#### (static) module.removeBubble(id)

Remove a bubble from the chat

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | integer | id of bubble provided by addBubble

Source:
  - index-d3.js, line 200

#### (static) module.removeBubbles(id)

Remove all bubbles until the bubble with 'id' from the chat

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | integer | id of bubble provided by addBubble

Source:
  - index-d3.js, line 211

#### (static) module.scrollTo(position)

Scroll chat flow

##### Parameters:

Name | Type | Description
--- | --- | ---
`position` | string | where to scroll either 'start' or 'end'

Source:
  - index-d3.js, line 235

#### (static) module.showInput(submitCallback, typeCallback)

Showing the input module and set cursor into input field

##### Parameters:

Name | Type | Description
--- | --- | ---
`submitCallback` | function | function to be called when user presses enter or submits through the submit-button
`typeCallback` | function | function to when user enters text (on change)

Source:
  - index-d3.js, line 152

#### (static) module.types.select(bubble, options, callback)

##### Parameters:

Name | Type | Description
--- | --- | ---
`bubble` | d3-selection | d3 selection of the bubble container
`options` | object | object containing configs {type:'text', class:string ('human' || 'bot'), value:array of objects (e.g. [{label:'yes'}])}
`callback` | function | function to be called after everything is done

Source:
  - index-d3.js, line 90

#### (static) module.types.text(bubble, options, callback)

##### Parameters:

Name | Type | Description
--- | --- | ---
`bubble` | d3-selection | d3 selection of the bubble container
`options` | object | object containing configs {type:'text', class:string ('human' || 'bot'), value:string (e.g. 'Hello World')}
`callback` | function | function to be called after everything is done

Source:
  - index-d3.js, line 107

#### (static) module.updateContainer()

updateContainer should be called when height or width changes of the container changes

Source:
  - index-d3.js, line 30