This class allows to create "like-in-widget" answer component with all features (multi-page answer, linked answer).

Example usage

1. Add script to your page:

<script src="https://<AccountName>.nanorep.co/web/include.js?sdk=answer-wrapper"></script>

2. Create a <div> with answer html:

<div id="example-container"><p>Hello, I'm simple answer</p></div>

3. Initialize component:

nanorep.sdk.init({
  host: 'dev3.nanorep.com',
  account: 'nanorep',
  kb: 'English'
});

new nanorep.sdk.AnswerWrapper({
  id: '900900972',
  title: "How to reply to a ticket?",
  sharing: ["clipboard", "email"],
  noFeedback: true
}, document.getElementById('example-container'));

Options

id (required)

Type: String

ID of the answers. Is using in getting channels api call

new nanorep.sdk.AnswerWrapper({
  id: '900900972',
  title: ''
}, document.getElementById('example-options-id'));
<div id="example-options-id"></div>

title (required)

Type: String

Title of the answer

new nanorep.sdk.AnswerWrapper({
  id: '900900972',
  title: 'What do you think about this title?'
}, document.getElementById('example-options-title'));
<div id="example-options-title"></div>

sharing

Type: Array

Array of strings with sharing channels

new nanorep.sdk.AnswerWrapper({
  id: '900900972',
  title: 'Title',
  sharing: ['clipboard', 'email', 'facebook', 'twitter']
}, document.getElementById('example-options-sharing'));
<div id="example-options-sharing"></div>

feedbackType

See feedbackType in the FAQ SDK section.

feedbackDialogType

See feebackDialogType in the FAQ SDK section.

noFeedback

Type: Boolean

Turn off feedback at all

new nanorep.sdk.AnswerWrapper({
  id: '900900972',
  title: 'What do you think about this noFeedback?',
  noFeedback: true
}, document.getElementById('example-options-noFeedback'));
<div id="example-options-noFeedback"></div>

htmlSourceSelector

Type: String

HTML source selector

new nanorep.sdk.AnswerWrapper({
  id: '900900972',
  title: 'What do you think about this htmlSourceSelector?',
  htmlSourceSelector: '.custom-html-source'
}, document.getElementById('example-options-htmlSourceSelector'));
<div id="example-options-htmlSourceSelector"><h1>Title??</h1><p class="custom-html-source">Lorem HTML CUSTOM SOURCE</p></div>

supportCenterDomain

Type: String

Support center domain url. Should be taken from support center templates ( '<%Site.nanoRepDomain%>' ). Required param for sharing

mainSiteURL

Type: String

Main site url. Should be taken from support center templates ( '<%Site.MainSiteUrl%>' ). Required param for sharing

attachmentUrls

Type: Array

Array of attachments URLs

new nanorep.sdk.AnswerWrapper({
  id: '900900972',
  title: 'What do you think about this attachmentUrls?',
  attachmentUrls: [<nR:Repeater type="attachment"> <nR:IF condition="Repeater.Ordinal != 1">,</nR:IF> "<%Article.Attachment.URL%>" </nR:Repeater>]
}, document.getElementById('example-options-attachmentUrls'));
<div id="example-options-attachmentUrls"><h1>Title??</h1><p class="custom-html-source">Lorem HTML CUSTOM SOURCE</p></div>

Events

ready

answerWrapper.on('ready', function() {})

Occurred when channeling was loaded

new nanorep.sdk.AnswerWrapper({ title: 'Title' }, document.getElementById('example-events-ready')).on('ready', function() {
  alert('READY');
});
<div id="example-events-ready"></div>

activateBlockquote

See activateBlockquote in the Widget Events section.