@alan-ai/alan-sdk-web 1.8.40 → 1.8.41

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/dist/alan_lib.js CHANGED
@@ -846,7 +846,7 @@
846
846
 
847
847
  /// <reference types="../global" />
848
848
  (function (ns) {
849
- var alanButtonVersion = '1.8.40';
849
+ var alanButtonVersion = '1.8.41';
850
850
  if (window.alanBtn) {
851
851
  console.warn('Alan: the Alan Button source code has already added (v.' + alanButtonVersion + ')');
852
852
  }
@@ -1033,6 +1033,7 @@
1033
1033
  window.tutorProject.off('scripts', onScriptsCb);
1034
1034
  window.tutorProject.off('text', onTextCbInMicBtn);
1035
1035
  window.tutorProject.off('parsed', onParsedCbInMicBtn);
1036
+ alanAudio.off('command', onCommandCbInMicBtn);
1036
1037
  rootEl.innerHTML = '';
1037
1038
  btnInstance = null;
1038
1039
  if (!isTutorMode()) {
@@ -1955,6 +1956,7 @@
1955
1956
  window.tutorProject.on('scripts', onScriptsCb);
1956
1957
  window.tutorProject.on('text', onTextCbInMicBtn);
1957
1958
  window.tutorProject.on('parsed', onParsedCbInMicBtn);
1959
+ alanAudio.on('command', onCommandCbInMicBtn);
1958
1960
  //window.tutorProject.on('popup', onPopup);
1959
1961
  // console.info('BTN: tutorProject', options.key);
1960
1962
  }
@@ -2086,7 +2088,6 @@
2086
2088
  alanAudio.on('micFail', onMicFail);
2087
2089
  alanAudio.on('playStart', onPlayStart);
2088
2090
  alanAudio.on('playStop', onPlayStop);
2089
- alanAudio.on('command', onCommandCbInMicBtn);
2090
2091
  alanAudio.start(resolve);
2091
2092
  if (options.onMicStarted) {
2092
2093
  options.onMicStarted();
@@ -2646,9 +2647,12 @@
2646
2647
  turnOffVoiceFn();
2647
2648
  }
2648
2649
  function onCommandCbInMicBtn(e) {
2650
+ var _a, _b;
2649
2651
  // console.info('BTN: onCommandCbInMicBtn', e, new Date());
2650
- if (options.onCommand) {
2651
- options.onCommand(e.data);
2652
+ if (isAlanActive || (!isAlanActive && ((_b = (_a = e.ctx) === null || _a === void 0 ? void 0 : _a.opts) === null || _b === void 0 ? void 0 : _b.force) === true)) {
2653
+ if (options.onCommand) {
2654
+ options.onCommand(e.data);
2655
+ }
2652
2656
  }
2653
2657
  if (isAlanActive) {
2654
2658
  switchState(LISTENING);