wingbot 3.42.0 → 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.42.0",
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
  };
@@ -149,9 +156,9 @@ class Responder {
149
156
  this.startedOutput = false;
150
157
 
151
158
  /**
152
- * @type {VoiceControl}
159
+ * @type {VoiceControl|VoiceControlFactory}
153
160
  */
154
- this.voiceControl = {};
161
+ this.voiceControl = null;
155
162
 
156
163
  this._trackAsAction = null;
157
164
 
@@ -477,11 +484,15 @@ class Responder {
477
484
  }
478
485
 
479
486
  if (this._features.includes(FEATURE_VOICE)
480
- && (voice || Object.keys(this.voiceControl).length)) {
487
+ && (voice || this.voiceControl)) {
481
488
 
482
489
  Object.assign(messageData.message, {
483
490
  voice: {
484
- ...this.voiceControl,
491
+ ...(typeof this.voiceControl === 'function'
492
+ ? this.voiceControl(Object.freeze({
493
+ ...this.options.state, ...this.newState
494
+ }))
495
+ : this.voiceControl),
485
496
  ...voice
486
497
  }
487
498
  });