@saurabharch/rollout-chatbot-client
Advanced tools
Comparing version 0.5.30 to 0.5.31
{ | ||
"name": "@saurabharch/rollout-chatbot-client", | ||
"version": "0.5.30", | ||
"version": "0.5.31", | ||
"description": "Client library to use Rollout Request APIs from a chatbot NodeJS proxy", | ||
@@ -32,2 +32,2 @@ "main": "index.js", | ||
} | ||
} | ||
} |
var assert = require('assert'); | ||
const { TiledeskChatbotClient } = require('..'); | ||
const { TiledeskClient } = require('@tiledesk/tiledesk-client'); | ||
const { RolloutChatbotClient } = require('..'); | ||
const { RolloutClient } = require('@saurabharch/rollout-client'); | ||
const APIKEY = "__APIKEY__"; | ||
const API_ENDPOINT = "https://tiledesk-server-pre.herokuapp.com"; //TiledeskClient.DEFAULT_API_ENDPOINT; | ||
const API_ENDPOINT = "https://rollout-server-pre.herokuapp.com"; //RolloutClient.DEFAULT_API_ENDPOINT; | ||
const LOG_STATUS = false; | ||
@@ -65,3 +65,3 @@ const WEBHOOK_REQUEST_BODY = { | ||
"fullname": "Andrea", | ||
"email": "andreasponziello@tiledesk.com", | ||
"email": "saurabh@rollout.com", | ||
"attributes": { | ||
@@ -72,3 +72,3 @@ "departmentId": "5fc4c150f2fc4d0034b96e52", | ||
"client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36", | ||
"sourcePage": "https://widget-pre.tiledesk.com/v5/assets/twp/index.html?tiledesk_projectid=5fc4c150f2fc4d0034b96e50&project_name=Microlang%20Dialogflow%20test%20-%20PRE&isOpen=true", | ||
"sourcePage": "https://widget-pre.rollout.com/v5/assets/twp/index.html?tiledesk_projectid=5fc4c150f2fc4d0034b96e50&project_name=Microlang%20Dialogflow%20test%20-%20PRE&isOpen=true", | ||
"projectId": "5fc4c150f2fc4d0034b96e50", | ||
@@ -79,3 +79,3 @@ "requester_id": "b930fcb0-e2b4-4677-b2a3-0712cfd08033", | ||
"userFullname": "Andrea", | ||
"userEmail": "andreasponziello@tiledesk.com", | ||
"userEmail": "saurabh@rollout.com", | ||
"subtype": "info" | ||
@@ -115,3 +115,3 @@ }, | ||
"__v": 0, | ||
"url": "https://tiledesk-df-connector-pre.herokuapp.com/tdbot/" | ||
"url": "https://rollout-df-connector-pre.herokuapp.com/tdbot/" | ||
} | ||
@@ -183,3 +183,3 @@ }, | ||
}], | ||
"sourcePage": "https://widget-pre.tiledesk.com/v5/assets/twp/index.html?tiledesk_projectid=5fc4c150f2fc4d0034b96e50&project_name=Dialogflow%20Connector%20test%20-%20PRE&isOpen=true", | ||
"sourcePage": "https://widget-pre.rollout.com/v5/assets/twp/index.html?tiledesk_projectid=5fc4c150f2fc4d0034b96e50&project_name=Dialogflow%20Connector%20test%20-%20PRE&isOpen=true", | ||
"language": "it", | ||
@@ -192,3 +192,3 @@ "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36", | ||
"client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36", | ||
"sourcePage": "https://widget-pre.tiledesk.com/v5/assets/twp/index.html?tiledesk_projectid=5fc4c150f2fc4d0034b96e50&project_name=Dialogflow%20Connector%20test%20-%20PRE&isOpen=true", | ||
"sourcePage": "https://widget-pre.rollout.com/v5/assets/twp/index.html?tiledesk_projectid=5fc4c150f2fc4d0034b96e50&project_name=Dialogflow%20Connector%20test%20-%20PRE&isOpen=true", | ||
"projectId": "5fc4c150f2fc4d0034b96e50", | ||
@@ -199,3 +199,3 @@ "requester_id": "b930fcb0-e2b4-4677-b2a3-0712cfd08033", | ||
"userFullname": "Andrea", | ||
"userEmail": "andreasponziello@tiledesk.com", | ||
"userEmail": "saurabh@rollout.com", | ||
"subtype": "info" | ||
@@ -310,3 +310,3 @@ }, | ||
"fullname": "Andrea", | ||
"email": "andreasponziello@tiledesk.com", | ||
"email": "saurabh@rollout.com", | ||
"attributes": { | ||
@@ -317,3 +317,3 @@ "departmentId": "5fc4c150f2fc4d0034b96e52", | ||
"client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36", | ||
"sourcePage": "https://widget-pre.tiledesk.com/v5/assets/twp/index.html?tiledesk_projectid=5fc4c150f2fc4d0034b96e50&project_name=Microlang%20Dialogflow%20test%20-%20PRE&isOpen=true", | ||
"sourcePage": "https://widget-pre.rollout.com/v5/assets/twp/index.html?tiledesk_projectid=5fc4c150f2fc4d0034b96e50&project_name=Microlang%20Dialogflow%20test%20-%20PRE&isOpen=true", | ||
"projectId": "5fc4c150f2fc4d0034b96e50", | ||
@@ -324,3 +324,3 @@ "requester_id": "b930fcb0-e2b4-4677-b2a3-0712cfd08033", | ||
"userFullname": "Andrea", | ||
"userEmail": "andreasponziello@tiledesk.com", | ||
"userEmail": "saurabh@rollout.com", | ||
"subtype": "info" | ||
@@ -364,3 +364,3 @@ }, | ||
"__v": 0, | ||
"url": "https://tiledesk-df-connector-pre.herokuapp.com/tdbot/" | ||
"url": "https://rollout-df-connector-pre.herokuapp.com/tdbot/" | ||
}] | ||
@@ -380,3 +380,3 @@ } | ||
"__v": 0, | ||
"url": "https://tiledesk-df-connector-pre.herokuapp.com/tdbot/" | ||
"url": "https://rollout-df-connector-pre.herokuapp.com/tdbot/" | ||
}, | ||
@@ -390,6 +390,6 @@ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ3ZWJob29rX2VuYWJsZWQiOmZhbHNlLCJ0eXBlIjoiZGlhbG9nZmxvdyIsIl9pZCI6IjVmYzRjMTkzZjJmYzRkMDAzNGI5NmU3MCIsIm5hbWUiOiJUZWNoeSIsImlkX3Byb2plY3QiOiI1ZmM0YzE1MGYyZmM0ZDAwMzRiOTZlNTAiLCJ0cmFzaGVkIjpmYWxzZSwiY3JlYXRlZEJ5IjoiNWUwOWQxNmQ0ZDM2MTEwMDE3NTA2ZDdmIiwiY3JlYXRlZEF0IjoiMjAyMC0xMS0zMFQwOTo1NTozMS42OThaIiwidXBkYXRlZEF0IjoiMjAyMC0xMS0zMFQxMDowOToyMS4wODBaIiwiX192IjowLCJ1cmwiOiJodHRwczovL3RpbGVkZXNrLWRmLWNvbm5lY3Rvci1wcmUuaGVyb2t1YXBwLmNvbS90ZGJvdC8iLCJpYXQiOjE2MTYxNDQxNjksImF1ZCI6Imh0dHBzOi8vdGlsZWRlc2suY29tL2JvdHMvNWZjNGMxOTNmMmZjNGQwMDM0Yjk2ZTcwIiwiaXNzIjoiaHR0cHM6Ly90aWxlZGVzay5jb20iLCJzdWIiOiJib3QiLCJqdGkiOiJlNjE2MWQ0Yy03MWJmLTQxNDctODAwOC1lZmRjYzFhNzBkMDgifQ.fwqw0tcEAtwP_Ev4ozLl6oP8ShPOdfhkAwT-VpYG7Vs" | ||
describe('TiledeskChatbotClient', function() { | ||
describe('RolloutChatbotClient', function() { | ||
describe('init()', function() { | ||
it('should return a new TiledeskChatbotClient', function() { | ||
const cbclient = new TiledeskChatbotClient({ | ||
it('should return a new RolloutChatbotClient', function() { | ||
const cbclient = new RolloutChatbotClient({ | ||
APIKEY: APIKEY, | ||
@@ -415,6 +415,6 @@ APIURL: API_ENDPOINT, | ||
describe('TiledeskChatbotClient', function() { | ||
describe('RolloutChatbotClient', function() { | ||
describe('init() with webhook request', function() { | ||
it('should return a new TiledeskChatbotClient', function() { | ||
const cbclient = new TiledeskChatbotClient({ | ||
it('should return a new RolloutChatbotClient', function() { | ||
const cbclient = new RolloutChatbotClient({ | ||
APIKEY: APIKEY, | ||
@@ -431,3 +431,3 @@ APIURL: API_ENDPOINT, | ||
assert(cbclient.tiledeskClient.projectId === WEBHOOK_REQUEST.body.payload.id_project); | ||
assert(cbclient.tiledeskClient.jwt_token === TiledeskClient.fixToken(WEBHOOK_REQUEST.body.token)); | ||
assert(cbclient.tiledeskClient.jwt_token === RolloutClient.fixToken(WEBHOOK_REQUEST.body.token)); | ||
assert(cbclient.supportRequest != null); | ||
@@ -445,6 +445,6 @@ assert(cbclient.tiledeskClient.log === LOG_STATUS); | ||
describe('TiledeskClient', function() { | ||
describe('RolloutClient', function() { | ||
describe('sendMessage()', function() { | ||
it('sends a message to the chatbot request conversation', function(done) { | ||
const cbclient = new TiledeskChatbotClient({ | ||
const cbclient = new RolloutChatbotClient({ | ||
APIKEY: APIKEY, | ||
@@ -460,3 +460,3 @@ APIURL: API_ENDPOINT, | ||
assert(cbclient.tiledeskClient.projectId === WEBHOOK_REQUEST.body.payload.id_project); | ||
assert(cbclient.tiledeskClient.jwt_token === TiledeskClient.fixToken(WEBHOOK_REQUEST.body.token)); | ||
assert(cbclient.tiledeskClient.jwt_token === RolloutClient.fixToken(WEBHOOK_REQUEST.body.token)); | ||
assert(cbclient.supportRequest != null); | ||
@@ -463,0 +463,0 @@ assert(cbclient.tiledeskClient.log === LOG_STATUS); |
22636