wingbot 3.44.4 → 3.45.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.44.4",
3
+ "version": "3.45.0",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -61,16 +61,28 @@ function slotsRegister ({
61
61
  };
62
62
  });
63
63
 
64
- res.setState({
65
- _slotState: slotState,
66
- _slotSteps: steps,
67
- _slotDone: doneAction,
64
+ const setStateEntities = {
68
65
  ...Object.fromEntries(
69
66
  steps.map(({ entity, type }) => (type === StepType.MULTI
70
67
  ? [entity.replace(/^@/, '+'), []]
71
68
  : [entity, null]))
72
69
  ),
73
70
  ...setEntities.reduce((o, r) => Object.assign(o, r), {})
71
+ };
72
+
73
+ Object.assign(
74
+ req.state,
75
+ Object.fromEntries(
76
+ Object.entries(setStateEntities)
77
+ .filter(([k]) => !k.startsWith('_'))
78
+ )
79
+ );
80
+
81
+ res.setState({
82
+ _slotState: slotState,
83
+ _slotSteps: steps,
84
+ _slotDone: doneAction,
85
+ ...setStateEntities
74
86
  });
75
87
 
76
88
  return getNextStep(req, res, postBack);
package/src/Responder.js CHANGED
@@ -29,7 +29,9 @@ const EXCEPTION_HOPCOUNT_THRESHOLD = 5;
29
29
  * @readonly
30
30
  */
31
31
  const ExpectedInput = {
32
- TYPE_PASSWORD: 'password'
32
+ TYPE_PASSWORD: 'password',
33
+ TYPE_NONE: 'none',
34
+ TYPE_UPLOAD: 'upload'
33
35
  };
34
36
 
35
37
  Object.freeze(ExpectedInput);
@@ -10,6 +10,7 @@ const { makeAbsolute } = require('../utils');
10
10
  * @typedef MarkdownPayload
11
11
  * @prop {"text/markdown"} contentType
12
12
  * @prop {string} content
13
+ * @prop {string} [className]
13
14
  */
14
15
 
15
16
  /**
@@ -22,6 +23,7 @@ const { makeAbsolute } = require('../utils');
22
23
  * @typedef EncodedPayload
23
24
  * @prop {string} content
24
25
  * @prop {"text/markdown"} content_type
26
+ * @prop {string} [class_name]
25
27
  */
26
28
 
27
29
  /**
@@ -31,10 +33,11 @@ const { makeAbsolute } = require('../utils');
31
33
  * @param {Payload} payload
32
34
  * @returns {EncodedPayload}
33
35
  */
34
- function encodePayload ({ content, contentType }) {
36
+ function encodePayload ({ content, contentType, className }) {
35
37
  return {
36
38
  content: Buffer.from(content).toString('base64'),
37
- content_type: contentType
39
+ content_type: contentType,
40
+ class_name: className
38
41
  };
39
42
  }
40
43