wingbot 3.41.3 → 3.42.1

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.3",
3
+ "version": "3.42.1",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/Processor.js CHANGED
@@ -529,6 +529,7 @@ class Processor extends EventEmitter {
529
529
  ];
530
530
  const options = {
531
531
  ...this.options,
532
+ state: Object.freeze({ ...state }),
532
533
  features
533
534
  };
534
535
 
package/src/Responder.js CHANGED
@@ -63,6 +63,12 @@ Object.freeze(ExpectedInput);
63
63
  * @prop {string} [voice]
64
64
  */
65
65
 
66
+ /**
67
+ * @callback VoiceControlFactory
68
+ * @param {object} state
69
+ * @returns {VoiceControl}
70
+ */
71
+
66
72
  /** @typedef {import('./ReturnSender').UploadResult} UploadResult */
67
73
 
68
74
  /**
@@ -91,6 +97,7 @@ class Responder {
91
97
  this._bookmark = null;
92
98
 
93
99
  this.options = {
100
+ state: Object.freeze({}),
94
101
  translator: (w) => w,
95
102
  appUrl: ''
96
103
  };
@@ -148,6 +155,11 @@ class Responder {
148
155
  */
149
156
  this.startedOutput = false;
150
157
 
158
+ /**
159
+ * @type {VoiceControl|VoiceControlFactory}
160
+ */
161
+ this.voiceControl = null;
162
+
151
163
  this._trackAsAction = null;
152
164
 
153
165
  // both vars are package protected
@@ -471,9 +483,16 @@ class Responder {
471
483
  }
472
484
  }
473
485
 
474
- if (voice && this._features.includes(FEATURE_VOICE)) {
486
+ if (this._features.includes(FEATURE_VOICE)
487
+ && (voice || this.voiceControl)) {
488
+
475
489
  Object.assign(messageData.message, {
476
490
  voice: {
491
+ ...(typeof this.voiceControl === 'function'
492
+ ? this.voiceControl(Object.freeze({
493
+ ...this.options.state, ...this.newState
494
+ }))
495
+ : this.voiceControl),
477
496
  ...voice
478
497
  }
479
498
  });