@tiledesk/tiledesk-tybot-connector 0.2.145 → 0.2.146

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
@@ -17,6 +17,12 @@ available on:
17
17
  - Added flowError on JSONCondition when result = null
18
18
  - Added fix on Filler -->
19
19
 
20
+ # v0.2.146
21
+ - bug-fixed: message.attributes["flowAttributes"]
22
+
23
+ # v0.2.146-rc1
24
+ - bug-fixed: message.attributes["flowAttributes"] added only if value size is <= 1kb
25
+
20
26
  # v0.2.145
21
27
  - added: TILEBOT_ENDPOINT env variable to startApp method
22
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.2.145",
3
+ "version": "0.2.146",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -209,6 +209,7 @@ class DirectivesChatbotPlug {
209
209
  name: "message",
210
210
  action: {
211
211
  "_tdThenStop": true,
212
+ isInfo: true,
212
213
  text: message,
213
214
  attributes: {
214
215
  runtimeError: {
@@ -121,11 +121,19 @@ class DirReply {
121
121
  message.attributes.intentName = this.context.reply.attributes.intent_info.intent_name;
122
122
  }
123
123
  // userFlowAttributes
124
- if (this.projectId === "656054000410fa00132e5dcc") {
125
- let userFlowAttributes = TiledeskChatbotUtil.userFlowAttributes(requestAttributes);
126
- if (this.log) { console.log("userFlowAttributes:", userFlowAttributes); }
127
- if (userFlowAttributes) {
128
- message.attributes["flowAttributes"] = userFlowAttributes;
124
+ let userFlowAttributes = TiledeskChatbotUtil.userFlowAttributes(requestAttributes);
125
+ if (this.log) { console.log("userFlowAttributes:", userFlowAttributes); }
126
+ if (userFlowAttributes) {
127
+ message.attributes["flowAttributes"] = {};
128
+ for (const [key, value] of Object.entries(userFlowAttributes)) {
129
+ try {
130
+ if(typeof value === 'string' && value.length <= 1000){
131
+ message.attributes["flowAttributes"][key] = value;
132
+ }
133
+ }
134
+ catch(err) {
135
+ console.error("An error occurred while JSON.parse(). Parsed value:" + value + " in allParametersStatic(). Error:", err);
136
+ }
129
137
  }
130
138
  }
131
139
  }
@@ -255,11 +255,19 @@ class DirReplyV2 {
255
255
  message.attributes.intentName = this.context.reply.attributes.intent_info.intent_name;
256
256
  }
257
257
  // userFlowAttributes
258
- if (this.projectId === "656054000410fa00132e5dcc") {
259
- let userFlowAttributes = TiledeskChatbotUtil.userFlowAttributes(requestAttributes);
260
- if (this.log) { console.log("userFlowAttributes:", userFlowAttributes); }
261
- if (userFlowAttributes) {
262
- message.attributes["flowAttributes"] = userFlowAttributes;
258
+ let userFlowAttributes = TiledeskChatbotUtil.userFlowAttributes(requestAttributes);
259
+ if (this.log) { console.log("userFlowAttributes:", userFlowAttributes); }
260
+ if (userFlowAttributes) {
261
+ message.attributes["flowAttributes"] = {};
262
+ for (const [key, value] of Object.entries(userFlowAttributes)) {
263
+ try {
264
+ if(typeof value === 'string' && value.length <= 1000){
265
+ message.attributes["flowAttributes"][key] = value;
266
+ }
267
+ }
268
+ catch(err) {
269
+ console.error("An error occurred while JSON.parse(). Parsed value:" + value + " in allParametersStatic(). Error:", err);
270
+ }
263
271
  }
264
272
  }
265
273