showArticle(articleId) : void
Force widget to display article by specified article id (method works for both Search and Conversational widgets)
articleId: Number |
text |
nanorep.floatingWidget.focus(); nanorep.floatingWidget.showArticle(1046126072);
defineDictionary(languageCode, dictionary) : void
Override default widget localization like in SDK environment. More information here (method available at any time)
languageCode: String |
Code of language |
dictionary: Object |
Object with translations |
setStorageOptions(options) : void
Use this method to enforce specific storage options like crossdomain support. (must be used only before widget is fully loaded)
For example:
nanorep.floatingWidget.setStorageOptions({ type: 'session', crossDomainHelper: 'https://<AccountName>.nanorep.co/web/assets/_storage.html' });
options: Object |
Options to configure storage:
|
setFAQ(options) : void
Allows to programmatically control FAQ sections inside the widget (options
is an object or an array of objects which describe FAQ section parameters).
It can use same filtering options like FAQ SDK and might look like following:{ title: 'Top 5 questions:', filter: { days: 21, items: 5, labelId: '1D4AE1C' }, behavior: ['onNoResults', 'onWidgetLoad', 'onClearSearchField'] }
)
It can use same filtering options like FAQ SDK
{ title: 'Top 5 questions:', filter: { days: 21, items: 5, labelId: '1D4AE1C' }, behavior: ['onNoResults', 'onWidgetLoad', 'onClearSearchField'] }
setCustomParams(params) : void
Define custom parameters that can be used inside the article title/body statements like {{brand}}
.
"params" object should look like { name: 'John', age: 31 }
(method available after widget is fully loaded)
getContext() : Promise
Get current context of the widget (method available at any time)
setContext(context) : Promise
Set widget context (method available at any time)
context: Object |
Plain object with new context |
getPredefinedValues() : Promise
Get current predefined values that can be used by contact form to prepopulate form field values (method available at any time)
setPredefinedValues(values) : Object
Set predefined values that can be used by contact form to populate form fields (method available at any time)
values: Object |
Plain object with predefined values |
getInputValue() : Promise
Get current value from the query field (method available after widget is fully loaded)
nanorep.floatingWidget.getInputValue().then(alert);
getLastQuery() : Promise
Get last search query in case of search widget or last statement in case of conversational widget (method available after widget is fully loaded)
nanorep.floatingWidget.getLastQuery().then(alert);
searchByLabels(labels) : void
Filter search results by specified labels. Array of labels should look like ['32715845', '30840398']
(method available at any time)
labels: Array |
Array of labels to search |
preprocessInput(hook) : void
This method allows to sanitize user input that is being sent to server
hook: Function |
Hook function will be invoked for each string entered by user with single argument - string entered by user. (method available at any time) Example usage: this.preprocessInput(function(input) { return input.replace(/[0-9]/g, '*') }) |
preprocessAnswers(hook) : void
This method allows to install preprocessing hook on each answer that will be displayed inside the widget.
hook: Function |
Hook function will be invoked for each answer model with single argument - answer model that can be modified inside this function. (method available at any time) Example usage: this.preprocessAnswers(function(answer) { answer.title = '* ' + answer.title }) |
setAnswerDisplayMode(mode) : void
Set answer rendering mode. Two modes are supported - "iframe"
and "default"
(method available at any time)
mode: String |
One of "iframe" and "default" |
toggleFollowMe(enabled) : void
Enable or disable "Follow Me" feature (when widget is automatically showing last answered question after page reload/redirect)
(method available at any time)
enabled: Boolean |
New state of FollowMe |