@tiledesk/tiledesk-tybot-connector 0.1.65 → 0.1.67

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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@
5
5
  available on:
6
6
  ▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
7
7
 
8
+ ### 0.1.67
9
+ - adds tdActionId to Schema for SetAttribute
10
+ - removes hidden vars from attributes
11
+
12
+ ### 0.1.66
13
+ - Replaced tdClient.agent() with tdCLient.moveToAgent() in DirMoveToAgent
14
+
8
15
  ### 0.1.65 - online
9
16
  - Added more logs for bug wa-wh test
10
17
 
package/index.js CHANGED
@@ -478,7 +478,7 @@ router.get('/ext/parameters/requests/:requestid', async (req, res) => {
478
478
  if (parameters) {
479
479
  for (const [key, value] of Object.entries(parameters)) {
480
480
  // console.log(key, value);
481
- if (!key.startsWith("td")) {
481
+ if (!key.startsWith("_")) {
482
482
  userParams[key] = value;
483
483
  }
484
484
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.1.65",
3
+ "version": "0.1.67",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  "@tiledesk/helpcenter-query-client": "^0.1.8",
15
15
  "@tiledesk/tiledesk-chatbot-client": "^0.5.30",
16
16
  "@tiledesk/tiledesk-chatbot-util": "^0.8.39",
17
- "@tiledesk/tiledesk-client": "^0.9.6",
17
+ "@tiledesk/tiledesk-client": "^0.10.1",
18
18
  "axios": "^0.27.2",
19
19
  "body-parser": "^1.19.0",
20
20
  "cors": "^2.8.5",
@@ -49,7 +49,7 @@ class DirectivesChatbotPlug {
49
49
  this.HELP_CENTER_API_ENDPOINT = config.HELP_CENTER_API_ENDPOINT;
50
50
  this.tdcache = config.cache;
51
51
  this.directives = config.directives;
52
- console.log("We have the support request:", JSON.stringify(this.supportRequest))
52
+ // console.log("We have the support request:", JSON.stringify(this.supportRequest))
53
53
  }
54
54
 
55
55
  exec(pipeline) {
@@ -97,7 +97,7 @@ class DirectivesChatbotPlug {
97
97
  return;
98
98
  }
99
99
  const supportRequest = this.supportRequest;
100
- console.log("supportRequest is:", JSON.stringify(supportRequest))
100
+ // console.log("supportRequest is:", JSON.stringify(supportRequest))
101
101
 
102
102
  const token = this.token;
103
103
  const API_URL = this.API_URL;
@@ -37,85 +37,79 @@ class DirMoveToAgent {
37
37
 
38
38
  execute(directive, callback) {
39
39
  directive.action = {};
40
- if (directive.name === Directives.WHEN_ONLINE_MOVE_TO_AGENT) { // TEMP
41
- directive.action = {
42
- whenOnlineOnly: true
43
- }
44
- }
40
+ // if (directive.name === Directives.WHEN_ONLINE_MOVE_TO_AGENT) { // TEMP
41
+ // directive.action = {
42
+ // whenOnlineOnly: true
43
+ // }
44
+ // }
45
45
  this.go(directive.action, () => {
46
46
  callback();
47
47
  });
48
48
  }
49
49
 
50
50
  async go(action, callback) {
51
- let depId = null;
52
- if (this.log) {console.log("DirMoveToAgent this.context.departmentId:", this.context.departmentId);}
53
- if (this.context.departmentId) {
54
- depId = this.context.departmentId
55
- if (this.log) {console.log("DirMoveToAgent depId:", depId);}
56
- }
57
- else if (this.tdcache) {
58
- depId =
59
- await TiledeskChatbot.getParameterStatic(
60
- this.tdcache, this.requestId, TiledeskChatbotConst.REQ_DEPARTMENT_ID_KEY
61
- );
62
- if (this.log) {console.log("DirMoveToAgent depId (cache):", depId);}
63
- }
64
- if (this.log) {console.log("DirMoveToAgent anyway depId is:", depId);}
65
- if (action.whenOnlineOnly === true) {
66
- this.tdclient.openNow( async (err, result) => {
67
- if (err) {
68
- console.error("Agent in DirOfflineHours Error:", err);
69
- callback();
70
- }
71
- else {
72
- if (result && result.isopen) {
73
- if (depId) {
74
- this.tdclient.agent(this.requestId, depId, (err) => {
75
- if (err) {
76
- console.error("Error moving to agent during online hours:", err);
77
- }
78
- else {
79
- //console.log("Successfully moved to agent during online hours");
80
- }
81
- callback();
82
- });
83
- }
84
- else {
85
- callback();
86
- }
87
- }
88
- else {
89
- callback();
90
- }
91
- }
92
- });
93
- }
94
- else {
95
- // if (this.tdcache) {
96
- // const depId =
97
- // await TiledeskChatbot.getParameterStatic(
98
- // this.tdcache, this.requestId, TiledeskChatbotConst.REQ_DEPARTMENT_ID_KEY
99
- // );
100
- if (depId) {
101
- this.tdclient.agent(this.requestId, depId, (err) => {
51
+ // let depId = null;
52
+ // if (this.log) {console.log("DirMoveToAgent this.context.departmentId:", this.context.departmentId);}
53
+ // if (this.context.departmentId) {
54
+ // depId = this.context.departmentId
55
+ // if (this.log) {console.log("DirMoveToAgent depId:", depId);}
56
+ // }
57
+ // else if (this.tdcache) {
58
+ // depId =
59
+ // await TiledeskChatbot.getParameterStatic(
60
+ // this.tdcache, this.requestId, TiledeskChatbotConst.REQ_DEPARTMENT_ID_KEY
61
+ // );
62
+ // if (this.log) {console.log("DirMoveToAgent depId (cache):", depId);}
63
+ // }
64
+ // if (this.log) {console.log("DirMoveToAgent anyway depId is:", depId);}
65
+ // if (action.whenOnlineOnly === true) {
66
+ // this.tdclient.openNow( async (err, result) => {
67
+ // if (err) {
68
+ // console.error("Agent in DirOfflineHours Error:", err);
69
+ // callback();
70
+ // }
71
+ // else {
72
+ // if (result && result.isopen) {
73
+ // // if (depId) {
74
+ // // this.tdclient.agent(this.requestId, depId, (err) => {
75
+ // this.tdclient.moveToAgent(this.requestId, (err) => {
76
+ // if (err) {
77
+ // console.error("Error moving to agent during online hours:", err);
78
+ // }
79
+ // else {
80
+ // console.log("Successfully moved to agent during online hours");
81
+ // }
82
+ // callback();
83
+ // });
84
+ // // }
85
+ // // else {
86
+ // // callback();
87
+ // // }
88
+ // }
89
+ // else {
90
+ // callback();
91
+ // }
92
+ // }
93
+ // });
94
+ // }
95
+ // else {
96
+ // if (depId) {
97
+ // this.tdclient.agent(this.requestId, depId, (err) => {
98
+ this.tdclient.moveToAgent(this.requestId, (err) => {
102
99
  if (err) {
103
100
  console.error("Error moving to agent:", err);
104
101
  }
105
102
  else {
106
- //console.log("Successfully moved to agent");
103
+ console.log("Successfully moved to agent");
107
104
  }
108
105
  callback();
109
106
  });
110
- }
111
- else {
112
- callback();
113
- }
114
- // }
115
- // else {
116
- // callback();
117
- // }
118
- }
107
+ // }
108
+ // else {
109
+ // callback();
110
+ // }
111
+
112
+ // }
119
113
  }
120
114
 
121
115
  }
@@ -12,15 +12,15 @@ const schema = {
12
12
  "type": "string",
13
13
  "enum": ["setattribute"]
14
14
  },
15
-
15
+ "_tdActionId": {
16
+ "type": ["string", "null"]
17
+ },
16
18
  "_tdActionTitle": {
17
19
  "type": ["string", "null"]
18
20
  },
19
-
20
21
  "destination": {
21
22
  "type": "string",
22
23
  },
23
-
24
24
  "operation": {
25
25
  "type": "object",
26
26
  "properties": {