@tiledesk/tiledesk-tybot-connector 0.2.131-rc2 → 0.2.131-rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.2.131-rc2",
3
+ "version": "0.2.131-rc3",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,17 +10,6 @@ class DirAssign {
10
10
  throw new Error('context object is mandatory.');
11
11
  }
12
12
  this.context = context;
13
- // let context = {
14
- // projectId: projectId,
15
- // token: token,
16
- // supportRequest: supportRequest,
17
- // requestId: supportRequest.request_id,
18
- // TILEDESK_APIURL: API_URL,
19
- // TILEBOT_ENDPOINT:TILEBOT_ENDPOINT,
20
- // departmentId: depId,
21
- // tdcache: tdcache,
22
- // log: false
23
- // }
24
13
  this.log = context.log;
25
14
  }
26
15
 
@@ -9,25 +9,7 @@ class DirAssignFromFunction {
9
9
  throw new Error('context object is mandatory.');
10
10
  }
11
11
  this.context = context;
12
- // let context = {
13
- // projectId: projectId,
14
- // token: token,
15
- // supportRequest: supportRequest,
16
- // requestId: supportRequest.request_id,
17
- // TILEDESK_APIURL: API_URL,
18
- // TILEBOT_ENDPOINT:TILEBOT_ENDPOINT,
19
- // departmentId: depId,
20
- // tdcache: tdcache,
21
- // log: false
22
- // }
23
12
  this.tdclient = context.tdclient;
24
- // new TiledeskClient({
25
- // projectId: context.projectId,
26
- // token: context.token,
27
- // APIURL: context.TILEDESK_APIURL,
28
- // APIKEY: "___",
29
- // log: context.log
30
- // });
31
13
  this.log = context.log;
32
14
  this.tdcache = context.tdcache;
33
15
  }
@@ -10,33 +10,7 @@ class DirCondition {
10
10
  throw new Error('context object is mandatory.');
11
11
  }
12
12
  this.context = context;
13
- // let context = {
14
- // projectId: projectId,
15
- // token: token,
16
- // supportRequest: supportRequest,
17
- // requestId: supportRequest.request_id,
18
- // TILEDESK_APIURL: API_URL,
19
- // TILEBOT_ENDPOINT:TILEBOT_ENDPOINT,
20
- // departmentId: depId,
21
- // tdcache: tdcache,
22
- // log: false
23
- // }
24
- // this.tdclient = new TiledeskClient({
25
- // projectId: context.projectId,
26
- // token: context.token,
27
- // APIURL: context.TILEDESK_APIURL,
28
- // APIKEY: "___",
29
- // log: context.log
30
- // });
31
13
  this.intentDir = new DirIntent(context);
32
- // {
33
- // API_ENDPOINT: context.TILEDESK_APIURL,
34
- // TILEBOT_ENDPOINT: context.TILEBOT_ENDPOINT,
35
- // supportRequest: context.supportRequest,
36
- // token: context.token,
37
- // log: context.log
38
- // }
39
- // );
40
14
  this.log = context.log;
41
15
  }
42
16
 
@@ -10,23 +10,11 @@ class DirConnectBlock {
10
10
  throw new Error('context object is mandatory.');
11
11
  }
12
12
  this.context = context;
13
- this.API_ENDPOINT = context.TILEDESK_APIURL,
13
+ this.API_ENDPOINT = context.API_ENDPOINT,
14
14
  this.TILEBOT_ENDPOINT = context.TILEBOT_ENDPOINT;
15
15
  this.supportRequest = context.supportRequest;
16
16
  this.token = context.token;
17
17
  this.log = context.log;
18
- // let context = {
19
- // projectId: projectId,
20
- // token: token,
21
- // supportRequest: supportRequest,
22
- // requestId: supportRequest.request_id,
23
- // TILEDESK_APIURL: API_URL,
24
- // TILEBOT_ENDPOINT: TILEBOT_ENDPOINT,
25
- // departmentId: depId,
26
- // tdcache: tdcache,
27
- // tdclient: tdclient,
28
- // log: true
29
- // }
30
18
  }
31
19
 
32
20
  execute(directive, callback) {
@@ -9,31 +9,7 @@ class DirIfOnlineAgents {
9
9
  throw new Error('context object is mandatory.');
10
10
  }
11
11
  this.tdclient = context.tdclient;
12
- // this.tdclient = new TiledeskClient({
13
- // projectId: context.projectId,
14
- // token: context.token,
15
- // APIURL: context.TILEDESK_APIURL,
16
- // APIKEY: "___",
17
- // log: context.log
18
- // });
19
- // let context = {
20
- // projectId: projectId,
21
- // token: token,
22
- // requestId: supportRequest,
23
- // APIURL: API_URL,
24
- // TILEBOT_ENDPOINT:TILEBOT_ENDPOINT,
25
- // departmentId: depId,
26
- // log: false
27
- // }
28
12
  this.intentDir = new DirIntent(context);
29
- // {
30
- // API_ENDPOINT: context.TILEDESK_APIURL,
31
- // TILEBOT_ENDPOINT: context.TILEBOT_ENDPOINT,
32
- // supportRequest: context.supportRequest,
33
- // token: context.token,
34
- // log: context.log
35
- // }
36
- // );
37
13
  this.log = context.log;
38
14
  }
39
15
 
@@ -15,6 +15,7 @@ class DirIfOnlineAgentsV2 {
15
15
  this.chatbot = context.chatbot;
16
16
  this.tdclient = context.tdclient;
17
17
  this.intentDir = new DirIntent(context);
18
+ this.API_ENDPOINT = context.API_ENDPOINT;
18
19
  this.log = context.log;
19
20
  }
20
21
 
@@ -175,7 +176,7 @@ class DirIfOnlineAgentsV2 {
175
176
 
176
177
  async getProjectAvailableAgents(departmentId, raw, callback) {
177
178
  return new Promise( (resolve, reject) => {
178
- let URL = `${this.context.TILEDESK_APIURL}/projects/${this.context.projectId}/users/availables?raw=${raw}`
179
+ let URL = `${this.API_ENDPOINT}/projects/${this.context.projectId}/users/availables?raw=${raw}`
179
180
  if (departmentId) {
180
181
  URL = URL + `&department=${departmentId}`
181
182
  }
@@ -9,31 +9,7 @@ class DirIfOpenHours {
9
9
  throw new Error('context object is mandatory.');
10
10
  }
11
11
  this.tdclient = context.tdclient;
12
- // this.tdclient = new TiledeskClient({
13
- // projectId: context.projectId,
14
- // token: context.token,
15
- // APIURL: context.TILEDESK_APIURL,
16
- // APIKEY: "___",
17
- // log: context.log
18
- // });
19
- // let context = {
20
- // projectId: projectId,
21
- // token: token,
22
- // requestId: supportRequest,
23
- // APIURL: API_URL,
24
- // TILEBOT_ENDPOINT:TILEBOT_ENDPOINT,
25
- // departmentId: depId,
26
- // log: false
27
- // }
28
12
  this.intentDir = new DirIntent(context);
29
- // {
30
- // API_ENDPOINT: context.TILEDESK_APIURL,
31
- // TILEBOT_ENDPOINT: context.TILEBOT_ENDPOINT,
32
- // supportRequest: context.supportRequest,
33
- // token: context.token,
34
- // log: context.log
35
- // }
36
- // );
37
13
  this.log = context.log;
38
14
  }
39
15
 
@@ -6,38 +6,16 @@ const ms = require('minimist-string');
6
6
 
7
7
  class DirIntent {
8
8
 
9
- // constructor(settings) {
10
- // if (!settings.API_ENDPOINT) {
11
- // throw new Error("settings.API_ENDPOINT is mandatory!");
12
- // }
13
- // this.API_ENDPOINT = settings.API_ENDPOINT;
14
- // this.TILEBOT_ENDPOINT = settings.TILEBOT_ENDPOINT;
15
- // this.log = settings.log;
16
- // this.supportRequest = settings.supportRequest;
17
- // this.token = settings.token;
18
- // }
19
9
  constructor(context) {
20
10
  if (!context) {
21
11
  throw new Error('context object is mandatory.');
22
12
  }
23
13
  this.context = context;
24
- this.API_ENDPOINT = context.TILEDESK_APIURL,
14
+ this.API_ENDPOINT = context.API_ENDPOINT,
25
15
  this.TILEBOT_ENDPOINT = context.TILEBOT_ENDPOINT;
26
16
  this.supportRequest = context.supportRequest;
27
17
  this.token = context.token;
28
18
  this.log = context.log;
29
- // let context = {
30
- // projectId: projectId,
31
- // token: token,
32
- // supportRequest: supportRequest,
33
- // requestId: supportRequest.request_id,
34
- // TILEDESK_APIURL: API_URL,
35
- // TILEBOT_ENDPOINT: TILEBOT_ENDPOINT,
36
- // departmentId: depId,
37
- // tdcache: tdcache,
38
- // tdclient: tdclient,
39
- // log: true
40
- // }
41
19
  }
42
20
 
43
21
  execute(directive, callback) {
@@ -10,34 +10,8 @@ class DirJSONCondition {
10
10
  }
11
11
  this.context = context;
12
12
  this.chatbot = context.chatbot;
13
- // let context = {
14
- // projectId: projectId,
15
- // token: token,
16
- // supportRequest: supportRequest,
17
- // requestId: supportRequest.request_id,
18
- // TILEDESK_APIURL: API_URL,
19
- // TILEBOT_ENDPOINT:TILEBOT_ENDPOINT,
20
- // departmentId: depId,
21
- // tdcache: tdcache,
22
- // log: false
23
- // }
24
- // this.tdclient = new TiledeskClient({
25
- // projectId: context.projectId,
26
- // token: context.token,
27
- // APIURL: context.TILEDESK_APIURL,
28
- // APIKEY: "___",
29
- // log: context.log
30
- // });
31
13
  this.chatbot = context.chatbot;
32
14
  this.intentDir = new DirIntent(context);
33
- // {
34
- // API_ENDPOINT: context.TILEDESK_APIURL,
35
- // TILEBOT_ENDPOINT: context.TILEBOT_ENDPOINT,
36
- // supportRequest: context.supportRequest,
37
- // token: context.token,
38
- // log: context.log
39
- // }
40
- // );
41
15
  this.log = context.log;
42
16
  }
43
17
 
@@ -19,7 +19,7 @@ class DirMessage {
19
19
  throw new Error('context object is mandatory.');
20
20
  }
21
21
  this.context = context;
22
- this.API_ENDPOINT = context.TILEDESK_APIURL,
22
+ this.API_ENDPOINT = context.API_ENDPOINT,
23
23
  this.TILEBOT_ENDPOINT = context.TILEBOT_ENDPOINT;
24
24
  this.projectId = context.projectId;
25
25
  this.requestId = context.requestId;
@@ -9,23 +9,11 @@ class DirMessageToBot {
9
9
  throw new Error('context object is mandatory.');
10
10
  }
11
11
  this.context = context;
12
- this.API_ENDPOINT = context.TILEDESK_APIURL,
12
+ this.API_ENDPOINT = context.API_ENDPOINT,
13
13
  this.TILEBOT_ENDPOINT = context.TILEBOT_ENDPOINT;
14
14
  this.supportRequest = context.supportRequest;
15
15
  this.token = context.token;
16
16
  this.log = context.log;
17
- // let context = {
18
- // projectId: projectId,
19
- // token: token,
20
- // supportRequest: supportRequest,
21
- // requestId: supportRequest.request_id,
22
- // TILEDESK_APIURL: API_URL,
23
- // TILEBOT_ENDPOINT: TILEBOT_ENDPOINT,
24
- // departmentId: depId,
25
- // tdcache: tdcache,
26
- // tdclient: tdclient,
27
- // log: true
28
- // }
29
17
  }
30
18
 
31
19
  execute(directive, callback) {
@@ -14,26 +14,7 @@ class DirSendEmail {
14
14
  this.tdclient = context.tdclient;
15
15
  this.tdcache = context.tdcache;
16
16
  this.requestId = context.requestId;
17
- this.log = context.log;
18
- // let context = {
19
- // projectId: projectId,
20
- // token: token,
21
- // supportRequest: supportRequest,
22
- // requestId: supportRequest.request_id,
23
- // TILEDESK_APIURL: API_URL,
24
- // TILEBOT_ENDPOINT:TILEBOT_ENDPOINT,
25
- // departmentId: depId,
26
- // tdcache: tdcache,
27
- // log: false
28
- // }
29
- // this.tdclient = new TiledeskClient({
30
- // projectId: context.projectId,
31
- // token: context.token,
32
- // APIURL: context.TILEDESK_APIURL,
33
- // APIKEY: "___",
34
- // log: context.log
35
- // });
36
-
17
+ this.log = context.log;
37
18
  }
38
19
 
39
20
  execute(directive, callback) {