wingbot 3.55.1 → 3.56.0

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": "wingbot",
3
- "version": "3.55.1",
3
+ "version": "3.56.0",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "doc": "npm run doc:gql && node ./bin/makeApiDoc.js && cpy ./CHANGELOG.md ./doc && gitbook install ./doc && gitbook build ./doc && rimraf -rf ./docs && rimraf --rf ./doc/CHANGELOG.md && move-cli ./doc/_book ./docs",
10
10
  "test": "npm run test:lint && npm run test:coverage && npm run test:coverage:threshold",
11
11
  "test:coverage": "nyc --reporter=html mocha ./test && nyc report",
12
- "test:coverage:threshold": "nyc check-coverage --lines 90 --functions 89 --branches 80",
12
+ "test:coverage:threshold": "nyc check-coverage --lines 89 --functions 89 --branches 80",
13
13
  "test:backend": "mocha ./test",
14
14
  "test:lint": "eslint --ext .js src test *.js plugins"
15
15
  },
@@ -36,20 +36,20 @@
36
36
  },
37
37
  "homepage": "https://github.com/wingbot.ai/wingbot#readme",
38
38
  "devDependencies": {
39
- "cpy-cli": "^4.1.0",
40
- "eslint": "^8.11.0",
39
+ "cpy-cli": "^4.2.0",
40
+ "eslint": "^8.36.0",
41
41
  "eslint-config-airbnb": "^19.0.4",
42
- "eslint-plugin-import": "^2.25.4",
43
- "eslint-plugin-jsdoc": "^39.7.5",
44
- "eslint-plugin-jsx-a11y": "^6.5.1",
45
- "eslint-plugin-mocha": "^10.0.3",
46
- "eslint-plugin-react": "^7.29.4",
42
+ "eslint-plugin-import": "^2.27.5",
43
+ "eslint-plugin-jsdoc": "^40.1.0",
44
+ "eslint-plugin-jsx-a11y": "^6.7.1",
45
+ "eslint-plugin-mocha": "^10.1.0",
46
+ "eslint-plugin-react": "^7.32.2",
47
47
  "graphql-markdown": "^6.0.0",
48
48
  "jsdoc-to-markdown": "^8.0.0",
49
- "mocha": "^10.0.0",
49
+ "mocha": "^10.2.0",
50
50
  "nyc": "^15.1.0",
51
51
  "rimraf": "^3.0.2",
52
- "sinon": "^13.0.1",
52
+ "sinon": "^15.0.3",
53
53
  "tsd-jsdoc": "^2.5.0"
54
54
  },
55
55
  "dependencies": {
@@ -60,7 +60,7 @@
60
60
  "jsonwebtoken": "^9.0.0",
61
61
  "node-fetch": "^2.6.7",
62
62
  "path-to-regexp": "^6.2.1",
63
- "uuid": "^8.3.2",
63
+ "uuid": "^9.0.0",
64
64
  "webalize": "^0.1.0"
65
65
  },
66
66
  "optionalDependencies": {
@@ -107,6 +107,8 @@ const {
107
107
  * @prop {string} [browserName]
108
108
  * @prop {string} [deviceType]
109
109
  * @prop {string} [osName]
110
+ * @prop {string} [skill]
111
+ * @prop {string} [prevSkill]
110
112
  */
111
113
 
112
114
  /**
@@ -328,6 +330,9 @@ function onInteractionHandler (
328
330
  didHandover = true;
329
331
  }
330
332
 
333
+ const useSkill = (skill && webalize(skill)) || noneAction;
334
+ const usePrevSkill = (prevSkill && webalize(prevSkill)) || noneAction;
335
+
331
336
  const metadata = {
332
337
  sessionCount,
333
338
  lang,
@@ -344,7 +349,9 @@ function onInteractionHandler (
344
349
  pageCategory,
345
350
  browserName: ua.browser.name || null,
346
351
  deviceType: ua.device.type || null,
347
- osName: ua.os.name || null
352
+ osName: ua.os.name || null,
353
+ skill: useSkill,
354
+ prevSkill: usePrevSkill
348
355
  };
349
356
 
350
357
  let sessionPromise;
@@ -374,8 +381,6 @@ function onInteractionHandler (
374
381
  : anonymize(
375
382
  replaceDiacritics(req.text()).replace(/\s+/g, ' ').toLowerCase().trim()
376
383
  );
377
- const useSkill = (skill && webalize(skill)) || noneAction;
378
- const usePrevSkill = (prevSkill && webalize(prevSkill)) || noneAction;
379
384
 
380
385
  let winnerAction = '';
381
386
  let winnerScore = 0;
@@ -76,6 +76,8 @@ function optionalWrap (l, r, content) {
76
76
  return `${l || ''}(${content})${r || ''}`;
77
77
  }
78
78
 
79
+ const MULTI_ENTITY_CLEANER = /((?<!\\)\([^()]*[^()\\]\)|@[A-Z0-9-]+)\?/g;
80
+
79
81
  class CustomEntityDetectionModel {
80
82
 
81
83
  /**
@@ -485,11 +487,18 @@ class CustomEntityDetectionModel {
485
487
 
486
488
  /**
487
489
  *
488
- * @param {RegExp} regexp
490
+ * @param {RegExp|string} regexp
489
491
  */
490
492
  _extractRegExpDependencies (regexp) {
491
- const matches = regexp.source.match(/@[A-Z0-9-]+/g);
492
- return Array.from(new Set(matches).values());
493
+ let str = typeof regexp === 'string' ? regexp : regexp.source;
494
+ const matches = str.match(/@[A-Z0-9-]+/g);
495
+ const known = Array.from(new Set(matches));
496
+ if (known.length <= 1 || !str.match(MULTI_ENTITY_CLEANER)) {
497
+ return known;
498
+ }
499
+ str = str.replace(MULTI_ENTITY_CLEANER, '');
500
+ const cleanDeps = this._extractRegExpDependencies(str);
501
+ return Array.from(new Set([...cleanDeps, ...matches]));
493
502
  }
494
503
 
495
504
  /**