wingbot 3.41.1 → 3.41.3

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.41.1",
3
+ "version": "3.41.3",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,5 +1,6 @@
1
1
  const { compileWithState } = require('../../src/utils');
2
- const { StepState, getNextStep } = require('../../src/utils/slots');
2
+ const { StepState, getNextStep, StepType } = require('../../src/utils/slots');
3
+ const { vars } = require('../../src/utils/stateVariables');
3
4
 
4
5
  /** @typedef {import('../../src/Router').Resolver} Resolver */
5
6
  /** @typedef {import('../../src/Responder')} Responder */
@@ -38,8 +39,16 @@ function slotsContinue ({
38
39
  .split(',')
39
40
  .map((e) => e.trim());
40
41
 
42
+ const clear = {};
43
+
41
44
  slotState = slotState.map((s) => {
42
45
  if (skipEntities.includes(s.e)) {
46
+ if (s.t === StepType.MULTI) {
47
+ const entity = step.entity.replace(/^@/, '+');
48
+ Object.assign(clear, vars.dialogContext(entity, [], true));
49
+ } else {
50
+ Object.assign(clear, vars.dialogContext(s.e, null, true));
51
+ }
43
52
  return { ...s, s: StepState.INITIALIZED };
44
53
  }
45
54
 
@@ -48,7 +57,7 @@ function slotsContinue ({
48
57
  : s;
49
58
  });
50
59
 
51
- res.setState({ _slotState: slotState });
60
+ res.setState({ ...clear, _slotState: slotState });
52
61
 
53
62
  return getNextStep(req, res, postBack);
54
63
  }
@@ -40,6 +40,7 @@ function slotsRegister ({
40
40
 
41
41
  if (entities.length === 0) {
42
42
  return {
43
+ t: step.type,
43
44
  e: step.entity,
44
45
  s: step.type === StepType.ADDITIONAL
45
46
  ? StepState.FILLED
@@ -54,6 +55,7 @@ function slotsRegister ({
54
55
  }
55
56
 
56
57
  return {
58
+ t: step.type,
57
59
  e: step.entity,
58
60
  s: step.validateAction ? StepState.FILLED : StepState.VALID
59
61
  };
@@ -40,6 +40,7 @@ const StepState = {
40
40
  * @typedef {object} SlotState
41
41
  * @prop {string} e
42
42
  * @prop {StepState} s
43
+ * @prop {StepType} t
43
44
  */
44
45
 
45
46
  /**