@tiledesk/tiledesk-tybot-connector 0.1.78 → 0.1.80

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,8 +5,15 @@
5
5
  available on:
6
6
  ▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
7
7
 
8
+ ### 0.1.80
9
+ - removed log "faq not found, getting from datasource..."
10
+ - added in Directive IF_ONLINE_AGENTS "stop" in async (stop)
11
+
12
+ ### 0.1.79
13
+ - added Handlebars.registerHelper('ifeq'... helper
14
+
8
15
  ### 0.1.78
9
- - web request assign to fix
16
+ - web request assign-to fix
10
17
  - fix filter on messages: groups removed
11
18
 
12
19
  ### 0.1.77
@@ -2,13 +2,30 @@ const Handlebars = require("handlebars");
2
2
 
3
3
  class TiledeskJSONEval {
4
4
 
5
- static eval(data, expression) {
5
+ static {
6
6
  Handlebars.registerHelper("last", function(array) {
7
7
  return array[array.length-1];
8
8
  });
9
9
  Handlebars.registerHelper("first", function(array) {
10
10
  return array[0];
11
11
  });
12
+ Handlebars.registerHelper('ifeq', function (a, b, options) {
13
+ if (a == b) { return options.fn(this); }
14
+ return options.inverse(this);
15
+ });
16
+ }
17
+
18
+ static eval(data, expression) {
19
+ // Handlebars.registerHelper("last", function(array) {
20
+ // return array[array.length-1];
21
+ // });
22
+ // Handlebars.registerHelper("first", function(array) {
23
+ // return array[0];
24
+ // });
25
+ // Handlebars.registerHelper('ifeq', function (a, b, options) {
26
+ // if (a == b) { return options.fn(this); }
27
+ // return options.inverse(this);
28
+ // });
12
29
  let template = null;
13
30
  if (expression.startsWith("{")) {
14
31
  template = Handlebars.compile(expression);
@@ -152,7 +152,7 @@ class MongodbBotsDataSource {
152
152
  if (this.log) {console.log("got faq from cache:", JSON.stringify(faq));}
153
153
  }
154
154
  else {
155
- console.log("faq not found, getting from datasource...");
155
+ //console.log("faq not found, getting from datasource...");
156
156
  faq = await this.getByIntentDisplayName(botId, key);
157
157
  if (this.log) {console.log(".faq found in datasource:", JSON.stringify(faq));}
158
158
  await tdcache.set(faqCacheKey, JSON.stringify(faq));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.1.78",
3
+ "version": "0.1.80",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -265,7 +265,7 @@ class DirectivesChatbotPlug {
265
265
  }
266
266
  else if (directive_name === Directives.IF_ONLINE_AGENTS) {
267
267
  // console.log("...DirIfOnlineAgents")
268
- new DirIfOnlineAgents(context).execute(directive, async () => {
268
+ new DirIfOnlineAgents(context).execute(directive, async (stop) => {
269
269
  if (stop) {
270
270
  if (context.log) { console.log("Stopping Actions on:", JSON.stringify(directive));}
271
271
  this.theend();