@alan-ai/alan-sdk-web 1.8.32 → 1.8.33

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
@@ -780,7 +780,7 @@
780
780
 
781
781
  /// <reference types="../global" />
782
782
  (function (ns) {
783
- var alanButtonVersion = '1.8.32';
783
+ var alanButtonVersion = '1.8.33';
784
784
  if (window.alanBtn) {
785
785
  console.warn('Alan: the Alan Button source code has already added (v.' + alanButtonVersion + ')');
786
786
  }
@@ -788,6 +788,7 @@
788
788
  var currentProjectId = null;
789
789
  var deviceId;
790
790
  var firstClick = null;
791
+ var btnInstance;
791
792
  // Define base properties for disable/enable button functionality
792
793
  var isLocalStorageAvailable = false;
793
794
  try {
@@ -855,10 +856,13 @@
855
856
  mode = 'component';
856
857
  }
857
858
  console.log('Alan: v.' + alanButtonVersion);
858
- if (window.tutorProject && !isTutorMode()) {
859
- throw new Error('The Alan Button instance has already been created. There cannot be two Alan Button instances created at the same time');
859
+ if (window.tutorProject && !isTutorMode() && btnInstance) {
860
+ if (currentProjectId === options.key) {
861
+ return btnInstance;
862
+ }
863
+ throw new Error('The Alan Button instance has already been created. There cannot be two Alan Button instances created at the same time connected to the different projects.');
860
864
  }
861
- var btnInstance = {
865
+ btnInstance = {
862
866
  // Common public API
863
867
  version: alanButtonVersion,
864
868
  setVisualState: function (visualStateData) {
@@ -949,7 +953,8 @@
949
953
  remove: function () {
950
954
  alanAudio.stop();
951
955
  window.tutorProject.close();
952
- rootEl.remove();
956
+ rootEl.innerHTML = '';
957
+ btnInstance = null;
953
958
  if (!isTutorMode()) {
954
959
  window.tutorProject = null;
955
960
  }