@tiledesk/tiledesk-tybot-connector 2.0.10-rc12 → 2.0.10-rc14

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.
Files changed (50) hide show
  1. package/logs/app2.log +11113 -0
  2. package/package.json +1 -1
  3. package/tiledeskChatbotPlugs/directives/DirAddTags.js +3 -8
  4. package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +3 -2
  5. package/tiledeskChatbotPlugs/directives/DirAskGPT.js +2 -1
  6. package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +3 -2
  7. package/tiledeskChatbotPlugs/directives/DirAssign.js +0 -6
  8. package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +1 -6
  9. package/tiledeskChatbotPlugs/directives/DirAssistant.js +3 -2
  10. package/tiledeskChatbotPlugs/directives/DirBrevo.js +3 -2
  11. package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +2 -1
  12. package/tiledeskChatbotPlugs/directives/DirClearTranscript.js +2 -1
  13. package/tiledeskChatbotPlugs/directives/DirClose.js +4 -9
  14. package/tiledeskChatbotPlugs/directives/DirCode.js +2 -1
  15. package/tiledeskChatbotPlugs/directives/DirCondition.js +2 -1
  16. package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +3 -8
  17. package/tiledeskChatbotPlugs/directives/DirCustomerio.js +3 -2
  18. package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +1 -6
  19. package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +2 -1
  20. package/tiledeskChatbotPlugs/directives/DirDepartment.js +5 -10
  21. package/tiledeskChatbotPlugs/directives/DirFireTiledeskEvent.js +3 -7
  22. package/tiledeskChatbotPlugs/directives/DirForm.js +4 -10
  23. package/tiledeskChatbotPlugs/directives/DirGptTask.js +3 -2
  24. package/tiledeskChatbotPlugs/directives/DirGptTask_OLD.js +3 -1
  25. package/tiledeskChatbotPlugs/directives/DirHubspot.js +3 -2
  26. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +4 -8
  27. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +4 -9
  28. package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +2 -1
  29. package/tiledeskChatbotPlugs/directives/DirIfOpenHours_OLD.js +4 -8
  30. package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +2 -1
  31. package/tiledeskChatbotPlugs/directives/DirMake.js +2 -1
  32. package/tiledeskChatbotPlugs/directives/DirMessage.js +1 -6
  33. package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +2 -8
  34. package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +3 -8
  35. package/tiledeskChatbotPlugs/directives/DirQapla.js +3 -2
  36. package/tiledeskChatbotPlugs/directives/DirRandomReply.js +3 -8
  37. package/tiledeskChatbotPlugs/directives/DirRemoveCurrentBot.js +1 -6
  38. package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +3 -8
  39. package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +4 -8
  40. package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +4 -8
  41. package/tiledeskChatbotPlugs/directives/DirReply.js +4 -9
  42. package/tiledeskChatbotPlugs/directives/DirReplyV2.js +4 -9
  43. package/tiledeskChatbotPlugs/directives/DirSendEmail.js +3 -8
  44. package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +3 -2
  45. package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +1 -3
  46. package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +2 -7
  47. package/tiledeskChatbotPlugs/directives/DirWait.js +3 -2
  48. package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +3 -2
  49. package/tiledeskChatbotPlugs/directives/DirWebResponse.js +2 -1
  50. package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +2 -1
@@ -6,6 +6,7 @@ const axios = require("axios").default;
6
6
  let https = require("https");
7
7
  const winston = require('../../utils/winston');
8
8
  const httpUtils = require('../../utils/HttpUtils');
9
+ const { Logger } = require('../../Logger');
9
10
 
10
11
  class DirReplaceBotV3 {
11
12
 
@@ -15,15 +16,10 @@ class DirReplaceBotV3 {
15
16
  }
16
17
  this.context = context;
17
18
  this.requestId = context.requestId;
18
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
19
-
20
19
  this.API_ENDPOINT = context.API_ENDPOINT;
21
- this.tdClient = new TiledeskClient({
22
- projectId: this.context.projectId,
23
- token: this.context.token,
24
- APIURL: this.API_ENDPOINT,
25
- APIKEY: "___"
26
- });
20
+
21
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
22
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
27
23
  }
28
24
 
29
25
  execute(directive, callback) {
@@ -17,16 +17,11 @@ class DirReply {
17
17
  this.requestId = context.requestId;
18
18
  this.token = context.token;
19
19
  this.tdcache = context.tdcache;
20
- this.supportRequest = this.context.supportRequest;
21
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
22
-
20
+ this.log = context.log;
23
21
  this.API_ENDPOINT = context.API_ENDPOINT;
24
- this.tdClient = new TiledeskClient({
25
- projectId: this.context.projectId,
26
- token: this.context.token,
27
- APIURL: this.API_ENDPOINT,
28
- APIKEY: "___"
29
- });
22
+
23
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
24
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
30
25
  }
31
26
 
32
27
  execute(directive, callback) {
@@ -21,19 +21,14 @@ class DirReplyV2 {
21
21
  this.requestId = context.requestId;
22
22
  this.token = context.token;
23
23
  this.tdcache = context.tdcache;
24
- this.intentDir = new DirIntent(context);
25
24
  this.chatbot = context.chatbot;
26
25
  this.reply = context.reply;
27
26
  this.originalMessage = context.message;
28
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
29
-
30
27
  this.API_ENDPOINT = context.API_ENDPOINT;
31
- this.tdClient = new TiledeskClient({
32
- projectId: this.context.projectId,
33
- token: this.context.token,
34
- APIURL: this.API_ENDPOINT,
35
- APIKEY: "___"
36
- });
28
+
29
+ this.intentDir = new DirIntent(context);
30
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
31
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
37
32
  }
38
33
 
39
34
  execute(directive, callback) {
@@ -16,15 +16,10 @@ class DirSendEmail {
16
16
  this.context = context;
17
17
  this.tdcache = context.tdcache;
18
18
  this.requestId = context.requestId;
19
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
20
-
21
19
  this.API_ENDPOINT = context.API_ENDPOINT;
22
- this.tdClient = new TiledeskClient({
23
- projectId: this.context.projectId,
24
- token: this.context.token,
25
- APIURL: this.API_ENDPOINT,
26
- APIKEY: "___"
27
- });
20
+
21
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
22
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
28
23
  }
29
24
 
30
25
  execute(directive, callback) {
@@ -18,9 +18,10 @@ class DirSendWhatsapp {
18
18
  this.chatbot = context.chatbot;
19
19
  this.tdcache = this.context.tdcache;
20
20
  this.requestId = this.context.requestId;
21
- this.intentDir = new DirIntent(context);
22
21
  this.API_ENDPOINT = this.context.API_ENDPOINT;
23
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
22
+
23
+ this.intentDir = new DirIntent(context);
24
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
24
25
  }
25
26
 
26
27
  execute(directive, callback) {
@@ -82,9 +82,7 @@ class DirSetAttributeV2 {
82
82
  this.tdcache = context.tdcache;
83
83
  this.requestId = context.requestId;
84
84
 
85
- let dev = this.context.supportRequest?.draft || false;
86
- let intent_id = this.context.reply?.attributes?.intent_info?.intent_id || undefined;
87
- this.logger = new Logger({ request_id: this.requestId, dev: dev, intent_id: intent_id });
85
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
88
86
  }
89
87
 
90
88
  execute(directive, callback) {
@@ -10,14 +10,9 @@ class DirSetConversationTags {
10
10
  }
11
11
  this.context = context;
12
12
  this.requestId = context.requestId;
13
-
14
13
  this.API_ENDPOINT = context.API_ENDPOINT;
15
- this.tdClient = new TiledeskClient({
16
- projectId: this.context.projectId,
17
- token: this.context.token,
18
- APIURL: this.API_ENDPOINT,
19
- APIKEY: "___"
20
- });
14
+
15
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
21
16
  }
22
17
 
23
18
  execute(directive, callback) {
@@ -13,7 +13,8 @@ class DirWait {
13
13
  this.chatbot = context.chatbot;
14
14
  this.tdcache = context.tdcache;
15
15
  this.requestId = context.requestId;
16
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
16
+
17
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
17
18
  }
18
19
 
19
20
  execute(directive, callback) {
@@ -60,7 +61,7 @@ class DirWait {
60
61
  // await this.tdcache.set(step_key, 0);
61
62
  await TiledeskChatbot.resetStep(this.tdcache, this.requestId);
62
63
  }
63
- this.logger.verbose("[Wait] Waiting for ", action.millis, "[ms]")
64
+ this.logger.debug("[Wait] Waiting for ", action.millis, "[ms]")
64
65
  setTimeout(() => {
65
66
  callback();
66
67
  }, action.millis);
@@ -16,9 +16,10 @@ class DirWebRequestV2 {
16
16
  this.tdcache = context.tdcache;
17
17
  this.requestId = context.requestId;
18
18
  this.chatbot = context.chatbot;
19
- this.intentDir = new DirIntent(context);
20
19
  this.log = context.log;
21
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
20
+
21
+ this.intentDir = new DirIntent(context);
22
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
22
23
  }
23
24
 
24
25
  execute(directive, callback) {
@@ -16,7 +16,8 @@ class DirWebResponse {
16
16
  this.requestId = context.requestId;
17
17
  this.token = context.token;
18
18
  this.tdcache = context.tdcache;
19
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
19
+
20
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
20
21
  }
21
22
 
22
23
  execute(directive, callback) {
@@ -15,7 +15,8 @@ class DirWhatsappByAttribute {
15
15
  this.context = context;
16
16
  this.requestId = this.context.requestId;
17
17
  this.API_ENDPOINT = context.API_ENDPOINT;
18
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
18
+
19
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
19
20
  }
20
21
 
21
22
  execute(directive, callback) {