@alan-ai/alan-sdk-web 1.8.26 → 1.8.30

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Alan voice assistant SDK for Web
1
+ # Alan AI: In-app voice assistant SDK for Web
2
2
 
3
3
  [Alan Platform](https://alan.app/) • [Alan Studio](https://studio.alan.app/register) • [Docs](https://alan.app/docs) • [FAQ](https://alan.app/docs/usage/additional/faq) •
4
4
  [Blog](https://alan.app/blog/) • [Twitter](https://twitter.com/alanvoiceai)
@@ -8,49 +8,49 @@
8
8
  [![CircleCI](https://circleci.com/gh/alan-ai/alan-sdk-web.svg?style=shield)](https://circleci.com/gh/alan-ai/alan-sdk-web)
9
9
 
10
10
 
11
- Quickly add voice to your app or website. Create a voice assistant or build a multimodal interface with two input modes — speech and gestures — working in sync.
11
+ Quickly add voice to your app with the Alan Platform. Create an in-app voice assistant to enable human-like conversations and provide a personalized voice experience for every user.
12
12
 
13
- <img src="https://alan.app/voice/images/github/tablet-tasks.gif" height="325px" align="right"/>
13
+ <img src="https://storage.googleapis.com/alan-public-images/github/tablet-tasks.gif" height="325px" align="right"/>
14
14
 
15
15
 
16
16
  ## Alan is a Voice AI Platform
17
17
 
18
- Alan is a conversational voice AI platform that lets you create an intelligent voice assistant for your app. It offers all necessary tools to design, embed and host your conversational experiences:
18
+ Alan is a conversational voice AI platform that lets you create an intelligent voice assistant for your app. It offers all necessary tools to design, embed and host your voice solutions:
19
19
 
20
20
  #### Alan Studio
21
- A web portal where you can write, test and manage dialog scenarios for your voice assistant or chatbot.
21
+ A powerful web-based IDE where you can write, test and debug dialog scenarios for your voice assistant or chatbot.
22
22
 
23
23
  #### Alan Client SDKs
24
24
 
25
- With Alan Client SDKs, you can quickly embed Alan's voice to your app.
25
+ Alan's lightweight SDKs to quickly embed a voice assistant to your app.
26
26
 
27
27
  #### Alan Cloud
28
28
 
29
- Alan's AI-backend that maintains voice deployments and accomplishes all Spoken Language Understanding (SLU) and Natural Language Processing (NLP) tasks.
29
+ Alan's AI-backend powered by the industry’s best Automatic Speech Recognition (ASR), Natural Language Understanding (NLU) and Speech Synthesis. The Alan Cloud provisions and handles the infrastructure required to maintain your voice deployments and perform all the voice processing tasks.
30
30
 
31
31
  To get more details on how Alan works, see <a href="https://alan.app/platform" target="_blank">Alan Platform</a>.
32
32
 
33
33
  ## Why Alan?
34
34
 
35
35
  * **No or minimum changes to your UI**: To voice enable your app, you only need to get the Alan Client SDK and drop it to your app.
36
- * **Serverless environment**: No need to plan for, deploy and maintain any infrastructure or speech components. Alan does all maintenance and voice processing tasks on behalf of your app.
36
+ * **Serverless environment**: No need to plan for, deploy and maintain any infrastructure or speech components - the Alan Platform does the bulk of the work.
37
37
  * **On-the-fly updates**: All changes to the dialogs become available immediately.
38
38
  * **Voice flow testing and analytics**: Alan Studio provides advanced tools for testing your dialog flows and getting the analytics data on users' interactions, all in the same console.
39
39
 
40
40
 
41
41
  ## How to start
42
42
 
43
- To add voice a web app or page:
43
+ To create a voice assistant for your web app or page:
44
44
 
45
45
  1. <a href="https://studio.alan.app/register" target="_blank">Sign up for Alan Studio</a> to build voice scripts in JavaScript and test them.
46
- 2. Use the Alan Web SDK to embed the Alan button to your app or page. For details, see Alan AI documentation for the necessary framework:
47
-
48
- * <img src="https://alan.app/assets/about/js.svg" height="35px" align="center" style="border:0px"/> <a href="https://alan.app/docs/client-api/web/vanilla" target="_blank">JavaScript</a>
49
- * <img src="https://alan.app/assets/about/react.svg" height="35px" align="center" style="border:0px"/> <a href="https://alan.app/docs/client-api/web/react" target="_blank">React</a>
50
- * <img src="https://alan.app/assets/about/angular.svg" height="35px" align="center" style="border:0px"/> <a href="https://alan.app/docs/client-api/web/angular" target="_blank">Angular</a>
51
- * <img src="https://alan.app/assets/about/vue.svg" height="35px" align="center" style="border:0px"/> <a href="https://alan.app/docs/client-api/web/vue" target="_blank">Vue</a>
52
- * <img src="https://alan.app/assets/about/ember.svg" height="35px" align="center" style="border:0px"/> <a href="https://alan.app/docs/client-api/web/ember" target="_blank">Ember</a>
53
- * <img src="https://alan.app/assets/about/electron.svg" height="35px" align="center" style="border:0px"/> <a href="https://alan.app/docs/client-api/web/electron" target="_blank">Electron</a>
46
+ 2. Use the Alan Web SDK to embed a voice assistant to your app or page. For details, see Alan AI documentation for the necessary framework:
47
+
48
+ * <a href="https://alan.app/docs/client-api/web/vanilla" target="_blank">JavaScript</a>
49
+ * <a href="https://alan.app/docs/client-api/web/react" target="_blank">React</a>
50
+ * <a href="https://alan.app/docs/client-api/web/angular" target="_blank">Angular</a>
51
+ * <a href="https://alan.app/docs/client-api/web/vue" target="_blank">Vue</a>
52
+ * <a href="https://alan.app/docs/client-api/web/ember" target="_blank">Ember</a>
53
+ * <a href="https://alan.app/docs/client-api/web/electron" target="_blank">Electron</a>
54
54
 
55
55
 
56
56
  Check out our <a href="https://alan-ai.github.io/alan-sdk-web/" target="_blank">demo</a>.
@@ -7,6 +7,7 @@ export interface AlanButtonOptions {
7
7
  top?: number | string;
8
8
  position?: string;
9
9
  pinned?: boolean;
10
+ showOverlayOnMicPermissionPrompt?: boolean;
10
11
  zIndex?: number;
11
12
  onCommand?(commandData: object): void;
12
13
  onEvent?(event: object): void;
package/dist/alan_lib.js CHANGED
@@ -319,6 +319,9 @@
319
319
 
320
320
  function fillAuth(values, ext) {
321
321
  var auth = {};
322
+ for (var k in ext) {
323
+ auth[k] = ext[k];
324
+ }
322
325
  for (var k in values) {
323
326
  auth[k] = values[k];
324
327
  }
@@ -695,6 +698,10 @@
695
698
  }
696
699
  };
697
700
 
701
+ ns.resumeAudioCtx = function() {
702
+ audioContext.resume();
703
+ };
704
+
698
705
  var micAllowed = false;
699
706
 
700
707
  function setMicAllowed(value) {
@@ -773,8 +780,8 @@
773
780
 
774
781
  (function(ns) {
775
782
  "use strict";
776
-
777
- var alanButtonVersion = '1.8.26';
783
+
784
+ var alanButtonVersion = '1.8.30';
778
785
 
779
786
  if (window.alanBtn) {
780
787
  console.warn('Alan: the Alan Button source code has already added (v.' + alanButtonVersion + ')');
@@ -896,9 +903,25 @@ function alanBtn(options) {
896
903
  var absolutePosition = false;
897
904
  var micWasStoppedByTimeout = false;
898
905
  var keepButtonPositionAfterDnD = false;
906
+
907
+ // Btn modes
908
+ var mode;
909
+
910
+ if (options.mode === 'tutor') {
911
+ mode = 'tutor';
912
+ pinned = true;
913
+ } else if (options.mode === 'demo') {
914
+ mode = 'demo';
915
+ } else {
916
+ mode = 'component';
917
+ }
899
918
 
900
919
  console.log('Alan: v.' + alanButtonVersion);
901
920
 
921
+ if (window.tutorProject && !isTutorMode()) {
922
+ throw new Error('The Alan Button instance has already been created. There cannot be two Alan Button instances created at the same time');
923
+ }
924
+
902
925
  var btnInstance = {
903
926
  // Common public API
904
927
  version: alanButtonVersion,
@@ -995,15 +1018,33 @@ function alanBtn(options) {
995
1018
  alanAudio.stop();
996
1019
  window.tutorProject.close();
997
1020
  rootEl.remove();
1021
+ if(!isTutorMode()) {
1022
+ window.tutorProject = null;
1023
+ }
998
1024
  },
999
1025
  stop: function () {
1000
1026
  alanAudio.stop();
1001
1027
  },
1002
1028
  updateButtonState: function (state) {
1003
1029
  onConnectStatusChange(state);
1004
- }
1030
+ },
1031
+ sendEvent: sendUserEvent
1005
1032
  };
1006
1033
 
1034
+ document.addEventListener('click', resumeAudioCtx);
1035
+
1036
+ function resumeAudioCtx() {
1037
+ alanAudio.resumeAudioCtx();
1038
+ document.removeEventListener('click', resumeAudioCtx);
1039
+ }
1040
+
1041
+ function sendUserEvent(eventName, eventValue) {
1042
+ var obj = eventValue ? {name: eventName, value: eventValue} : {name: eventName};
1043
+ // var obj = {};
1044
+ // obj[eventName] = eventValue ? eventValue : true;
1045
+ sendClientEvent(obj);
1046
+ }
1047
+
1007
1048
  function sendClientEvent(param) {
1008
1049
  if (window.tutorProject) {
1009
1050
  window.tutorProject.call('clientEvent', param);
@@ -1021,18 +1062,6 @@ function alanBtn(options) {
1021
1062
  baseUrl = 'https://' + options.host;
1022
1063
  }
1023
1064
 
1024
- // Btn modes
1025
- var mode;
1026
-
1027
- if (options.mode === 'tutor') {
1028
- mode = 'tutor';
1029
- pinned = true;
1030
- } else if (options.mode === 'demo') {
1031
- mode = 'demo';
1032
- } else {
1033
- mode = 'component';
1034
- }
1035
-
1036
1065
  if (options.position === 'absolute' || options.pinned) {
1037
1066
  pinned = true;
1038
1067
  }
@@ -1368,18 +1397,23 @@ function alanBtn(options) {
1368
1397
  initRightPos = parseInt(sideBtnPos, 10);
1369
1398
  }
1370
1399
 
1400
+ rootEl.style[isLeftAligned ? 'left' : 'right'] = sideBtnPos;
1401
+ setDefaultBtnHorizontalPosition();
1402
+ }
1403
+
1404
+ function setDefaultBtnHorizontalPosition(){
1371
1405
  if (isTopAligned) {
1372
1406
  topBtnPos = setDefautlPositionProps(options.top !== undefined ? options.top : btnModes[mode].topPos);
1373
1407
  } else {
1374
1408
  bottomBtnPos = setDefautlPositionProps(options.bottom !== undefined ? options.bottom : btnModes[mode].bottomPos);
1375
1409
  }
1376
1410
 
1377
- rootEl.style[isLeftAligned ? 'left' : 'right'] = sideBtnPos;
1378
-
1379
1411
  if (isTopAligned) {
1380
1412
  rootEl.style.top = topBtnPos;
1413
+ rootEl.style.setProperty('bottom', '');
1381
1414
  } else {
1382
1415
  rootEl.style.bottom = bottomBtnPos;
1416
+ rootEl.style.setProperty('top', '');
1383
1417
  }
1384
1418
  }
1385
1419
 
@@ -1408,6 +1442,7 @@ function alanBtn(options) {
1408
1442
 
1409
1443
  if (absolutePosition) {
1410
1444
  el.style.position = 'absolute';
1445
+ el.classList.add('absolute-positioned');
1411
1446
  }
1412
1447
  if (topPos) {
1413
1448
  el.style.bottom = '';
@@ -1452,11 +1487,13 @@ function alanBtn(options) {
1452
1487
  }
1453
1488
 
1454
1489
  applySizeSettingsToBlurLayers([btnOval1, btnOval2]);
1490
+ setTextPanelPosition(recognisedTextHolder);
1455
1491
  }
1456
1492
 
1457
1493
  // Define base styles for btn
1458
1494
  btn.style.color = '#fff';
1459
1495
  btn.style.position = 'absolute';
1496
+ var transitionCss = 'transform 0.4s ease-in-out, opacity 0.4s ease-in-out';
1460
1497
 
1461
1498
  applyBtnSizeOptions(btnSize);
1462
1499
 
@@ -1467,9 +1504,9 @@ function alanBtn(options) {
1467
1504
  }
1468
1505
  setStylesBasedOnSide();
1469
1506
  btn.style.borderRadius = '50%';
1470
- btn.style.boxShadow = '0 8px 10px 0 rgba(0, 75, 144, 0.35)';
1507
+ // btn.style.boxShadow = '0 8px 10px 0 rgba(0, 75, 144, 0.35)';
1471
1508
  btn.style.textAlign = 'center';
1472
- btn.style.transition = 'all 0.4s ease-in-out';
1509
+ btn.style.transition = transitionCss;
1473
1510
  btn.style.zIndex = btnZIndex;
1474
1511
 
1475
1512
  // Specify tabIndex if it exists in options
@@ -1494,7 +1531,7 @@ function alanBtn(options) {
1494
1531
  micIconDiv.style.left = '0%';
1495
1532
  micIconDiv.style.zIndex = btnIconsZIndex;
1496
1533
  micIconDiv.style.position = 'relative';
1497
- micIconDiv.style.transition = 'all 0.4s ease-in-out';
1534
+ micIconDiv.style.transition = transitionCss;
1498
1535
 
1499
1536
  function setUpStylesForAnimatedLogoParts(logos) {
1500
1537
  for (var i = 0; i < logos.length; i++) {
@@ -1581,7 +1618,7 @@ function alanBtn(options) {
1581
1618
  roundedTriangleIconDiv.style.zIndex = btnIconsZIndex;
1582
1619
  roundedTriangleIconDiv.style.position = 'absolute';
1583
1620
  roundedTriangleIconDiv.style.opacity = 0;
1584
- roundedTriangleIconDiv.style.transition = 'all 0.4s ease-in-out';
1621
+ roundedTriangleIconDiv.style.transition = transitionCss;
1585
1622
  roundedTriangleIconDiv.style.overflow = 'hidden';
1586
1623
  roundedTriangleIconDiv.style.borderRadius = '50%';
1587
1624
  roundedTriangleIconDiv.style.backgroundSize = '100% 100%';
@@ -1602,7 +1639,7 @@ function alanBtn(options) {
1602
1639
  circleIconDiv.style.zIndex = btnIconsZIndex;
1603
1640
  circleIconDiv.style.position = 'absolute';
1604
1641
  circleIconDiv.style.opacity = 0;
1605
- circleIconDiv.style.transition = 'all 0.4s ease-in-out';
1642
+ circleIconDiv.style.transition = transitionCss;
1606
1643
  circleIconDiv.style.overflow = 'hidden';
1607
1644
  circleIconDiv.style.borderRadius = '50%';
1608
1645
  circleIconDiv.style.backgroundSize = '0% 0%';
@@ -1619,7 +1656,7 @@ function alanBtn(options) {
1619
1656
  disconnectedMicLoaderIconImg.style.left = '15%';
1620
1657
  disconnectedMicLoaderIconImg.style.zIndex = btnIconsZIndex;
1621
1658
  disconnectedMicLoaderIconImg.style.position = 'absolute';
1622
- disconnectedMicLoaderIconImg.style.transition = 'all 0.4s ease-in-out';
1659
+ disconnectedMicLoaderIconImg.style.transition = transitionCss;
1623
1660
  disconnectedMicLoaderIconImg.style.opacity = '0';
1624
1661
  disconnectedMicLoaderIconImg.alt = alanAltText + ' disconnected microphone icon';
1625
1662
  disconnectedMicLoaderIconImg.src = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOTIiIGhlaWdodD0iMTkyIiB2aWV3Qm94PSIwIDAgMTkyIDE5MiI+CiAgICA8ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTk2IDBjNTMuMDIgMCA5NiA0Mi45OCA5NiA5NnMtNDIuOTggOTYtOTYgOTZTMCAxNDkuMDIgMCA5NiA0Mi45OCAwIDk2IDB6IiBvcGFjaXR5PSIuMDIiLz4KICAgICAgICA8cGF0aCBkPSJNMTMxLjk2NiAxOS4wOTJjLTMwLTE0LTY1LjI4NC05Ljg0OS05MS4xNDIgMTIuNTc1QzE0Ljk2NiA1NC4wOTIgNi44NSA4My44MSAxMi45MDggMTEzLjk1YzYuMDU4IDMwLjE0MiAzMC4zMDIgNTYuMTkgNjAuMDU4IDY0LjE0MiAzNS4xODMgOS40MDYgNzMtNCA5My0zNC0xNy45MjQgMjMuOTE2LTUyLjM2NiAzOC4yOTMtODMgMzMtMzAuMTY4LTUuMjEtNTcuMTA0LTMxLjExLTY0LTYxLTcuMzQ3LTMxLjgzNS43NzktNTYgMjctODBzODAtMjYgMTA5IDljNS41MzYgNi42ODEgMTMgMTkgMTUgMzQgMSA2IDEgNyAyIDEyIDAgMiAyIDQgNCA0IDMgMCA1LjM3NC0yLjI1NiA1LTYtMy0zMC0yMS41NTYtNTcuMTkzLTQ5LTcweiIgb3BhY2l0eT0iLjQiLz4KICAgIDwvZz4KPC9zdmc+Cg==";
@@ -1633,7 +1670,7 @@ function alanBtn(options) {
1633
1670
  lowVolumeMicIconImg.style.left = '0%';
1634
1671
  lowVolumeMicIconImg.style.zIndex = btnIconsZIndex;
1635
1672
  lowVolumeMicIconImg.style.position = 'absolute';
1636
- lowVolumeMicIconImg.style.transition = 'all 0.4s ease-in-out';
1673
+ lowVolumeMicIconImg.style.transition = transitionCss;
1637
1674
  lowVolumeMicIconImg.style.opacity = '0';
1638
1675
  lowVolumeMicIconImg.alt = alanAltText + ' low volume icon';
1639
1676
  lowVolumeMicIconImg.src = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODBweCIgaGVpZ2h0PSI4MHB4IiB2aWV3Qm94PSIwIDAgODAgODAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjEgKDY3MDQ4KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5BbGFuIEJ1dHRvbiAvIEFuaW1hdGlvbiAvIGJ1dHRvbi1uby1taWM8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZyBpZD0iQWxhbi1CdXR0b24tLy1BbmltYXRpb24tLy1idXR0b24tbm8tbWljIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iaWNvbiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjIuMDAwMDAwLCAxOS4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iPgogICAgICAgICAgICA8cGF0aCBkPSJNMzIsMTguNDczNjg0MiBDMzIsMjUuNzE5NDczNyAyNi43OCwzMS42OTI2MzE2IDIwLDMyLjY5ODQyMTEgTDIwLDQwIEMyMCw0MS4xMDQ1Njk1IDE5LjEwNDU2OTUsNDIgMTgsNDIgQzE2Ljg5NTQzMDUsNDIgMTYsNDEuMTA0NTY5NSAxNiw0MCBMMTYsMzIuNjk4NDIxMSBDOS4yMiwzMS42OTI2MzE2IDQsMjUuNzE5NDczNyA0LDE4LjQ3MzY4NDIgTDQsMTggQzQsMTYuODk1NDMwNSA0Ljg5NTQzMDUsMTYgNiwxNiBDNy4xMDQ1Njk1LDE2IDgsMTYuODk1NDMwNSA4LDE4IEw4LDE4LjQ3MzY4NDIgQzgsMjQuMTQxODY5OCAxMi40NzcxNTI1LDI4LjczNjg0MjEgMTgsMjguNzM2ODQyMSBDMjMuNTIyODQ3NSwyOC43MzY4NDIxIDI4LDI0LjE0MTg2OTggMjgsMTguNDczNjg0MiBMMjgsMTggQzI4LDE2Ljg5NTQzMDUgMjguODk1NDMwNSwxNiAzMCwxNiBDMzEuMTA0NTY5NSwxNiAzMiwxNi44OTU0MzA1IDMyLDE4IEwzMiwxOC40NzM2ODQyIFoiIGlkPSJTaGFwZSIgZmlsbC1vcGFjaXR5PSIwLjgiPjwvcGF0aD4KICAgICAgICAgICAgPHBhdGggZD0iTTE4LC00LjUyNzM3MjYzZS0xNCBDMjEuMzEzNzA4NSwtNC42MTg1Mjc3OGUtMTQgMjQsMi43NTY5ODMzOCAyNCw2LjE1Nzg5NDc0IEwyNCwxOC40NzM2ODQyIEMyNCwyMS44NzQ1OTU2IDIxLjMxMzcwODUsMjQuNjMxNTc4OSAxOCwyNC42MzE1Nzg5IEMxNC42ODYyOTE1LDI0LjYzMTU3ODkgMTIsMjEuODc0NTk1NiAxMiwxOC40NzM2ODQyIEwxMiw2LjE1Nzg5NDc0IEMxMiwyLjc1Njk4MzM4IDE0LjY4NjI5MTUsLTQuNTI3MzcyNjNlLTE0IDE4LC00LjYxODUyNzc4ZS0xNCBaIiBpZD0iU2hhcGUiIGZpbGwtb3BhY2l0eT0iMC42Ij48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0zLjgxLDMuMjcgTDM0LjczLDM0LjE5IEMzNS40MzE0MDE2LDM0Ljg5MTQwMTYgMzUuNDMxNDAxNiwzNi4wMjg1OTg0IDM0LjczLDM2LjczIEMzNC4wMjg1OTg0LDM3LjQzMTQwMTYgMzIuODkxNDAxNiwzNy40MzE0MDE2IDMyLjE5LDM2LjczIEwxLjI3LDUuODEgQzAuNTY4NTk4MzY4LDUuMTA4NTk4MzcgMC41Njg1OTgzNjgsMy45NzE0MDE2MyAxLjI3LDMuMjcgQzEuOTcxNDAxNjMsMi41Njg1OTgzNyAzLjEwODU5ODM3LDIuNTY4NTk4MzcgMy44MSwzLjI3IFoiIGlkPSJQYXRoIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=\n";
@@ -1646,7 +1683,7 @@ function alanBtn(options) {
1646
1683
  noVoiceSupportMicIconImg.style.left = '0%';
1647
1684
  noVoiceSupportMicIconImg.style.zIndex = btnIconsZIndex;
1648
1685
  noVoiceSupportMicIconImg.style.position = 'absolute';
1649
- noVoiceSupportMicIconImg.style.transition = 'all 0.4s ease-in-out';
1686
+ noVoiceSupportMicIconImg.style.transition = transitionCss;
1650
1687
  noVoiceSupportMicIconImg.style.opacity = '0';
1651
1688
  noVoiceSupportMicIconImg.alt = alanAltText + ' no voice support icon';
1652
1689
  noVoiceSupportMicIconImg.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIuSURBVHgB7dvxUYMwFAbwpxMwAhvoBtVJygZ1A92gI1Qn6AjoBO0GsEG7wfPlgCtNA7xASzX5fnf5oyThLp+BQDiJAAAAAAAAAAAAAAAAxmHmDyk5n+ykLAn6SUhpHVaXwrQhcBsIr5FTLGSwb1IOmpkj9RnrxXE5+1x+fH7Pwyw0+PKSLLpCrGeq1oFiwNWiUGhCZE8UC22I7IliogmRPVFshkJkTxSjvhDZE8WqJ0QEqNURIgL0MTVEgmkhElTGhkix4WqzoNlYWFp1k1fhvvMHgc9n2cFRPzXAou/8t/JAM7EH/SD66ocM9bfrb+WR7kTGm1iHjqR3HDjXbOYMsLR+p9bvPentr3iuSeYM0B7Uwvr9RXqfA+cqKTRyma2sdSB3tMlZJ7X62Ru3Qa7CiSOIF6uN9pmw4NMuTjYUcDAcM8wEkTjaZdasytm9AfHsOL6lUJkZx5c2yr7a2ZlSyGSAa8egt5qBK0JU/TH+Na7uha4QzLHBm7+0ee8Iz/Sf/XlwtjeRtnq2mVU4dVSXUr6l/NDpccS0e5KSSekKybR9lReQkmLAV9hU7ZiFKcWCq8t5zeOtWfndOWhczcYN6+VSFq2+RfQhGnUYWUeY5ph5m0k6+iHENjs9RXuE2OYbYN3HFeKOYjQmwLrfRYgUo7EB1n2bEM03khXd0F0epDXs0Obaovd1ty39UCDAif5ygO0PRyWBH64eqJuFAP9kAwAAAAAAAAAAAAAAU/wC52820szaQtwAAAAASUVORK5CYII=";
@@ -1730,7 +1767,7 @@ function alanBtn(options) {
1730
1767
  el.style.left = 0;
1731
1768
  el.style.zIndex = btnBgLayerZIndex;
1732
1769
  el.style.position = 'absolute';
1733
- el.style.transition = 'all 0.4s ease-in-out';
1770
+ el.style.transition = transitionCss;
1734
1771
  el.style.opacity = '.5';
1735
1772
  el.style.borderRadius = '100px';
1736
1773
  el.classList.add('alanBtn-oval-bg-default');
@@ -1745,7 +1782,7 @@ function alanBtn(options) {
1745
1782
  offlineIconImg.style.left = '0%';
1746
1783
  offlineIconImg.style.zIndex = btnIconsZIndex;
1747
1784
  offlineIconImg.style.position = 'absolute';
1748
- offlineIconImg.style.transition = 'all 0.4s ease-in-out';
1785
+ offlineIconImg.style.transition = transitionCss;
1749
1786
  offlineIconImg.style.opacity = '0';
1750
1787
  offlineIconImg.alt = alanAltText + ' offline icon';
1751
1788
  offlineIconImg.src = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODBweCIgaGVpZ2h0PSI4MHB4IiB2aWV3Qm94PSIwIDAgODAgODAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjEgKDY3MDQ4KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5BbGFuIEJ1dHRvbiAvIEFuaW1hdGlvbiAvIGJ1dHRvbi1uby1uZXR3b3JrPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGcgaWQ9IkFsYW4tQnV0dG9uLS8tQW5pbWF0aW9uLS8tYnV0dG9uLW5vLW5ldHdvcmsiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJpY29uIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMS4wMDAwMDAsIDIyLjAwMDAwMCkiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNMzMsMiBDMzQuNjU2ODU0MiwyIDM2LDMuMzQzMTQ1NzUgMzYsNSBMMzYsMjkgQzM2LDMwLjY1Njg1NDIgMzQuNjU2ODU0MiwzMiAzMywzMiBDMzEuMzQzMTQ1OCwzMiAzMCwzMC42NTY4NTQyIDMwLDI5IEwzMCw1IEMzMCwzLjM0MzE0NTc1IDMxLjM0MzE0NTgsMiAzMywyIFoiIGlkPSJTaGFwZSIgZmlsbC1vcGFjaXR5PSIwLjQiPjwvcGF0aD4KICAgICAgICAgICAgPHBhdGggZD0iTTIzLDggQzI0LjY1Njg1NDIsOCAyNiw5LjM0MzE0NTc1IDI2LDExIEwyNiwyOSBDMjYsMzAuNjU2ODU0MiAyNC42NTY4NTQyLDMyIDIzLDMyIEMyMS4zNDMxNDU4LDMyIDIwLDMwLjY1Njg1NDIgMjAsMjkgTDIwLDExIEMyMCw5LjM0MzE0NTc1IDIxLjM0MzE0NTgsOCAyMyw4IFoiIGlkPSJTaGFwZSIgZmlsbC1vcGFjaXR5PSIwLjYiPjwvcGF0aD4KICAgICAgICAgICAgPHBhdGggZD0iTTEzLDE2IEMxNC42NTY4NTQyLDE2IDE2LDE3LjM0MzE0NTggMTYsMTkgTDE2LDI5IEMxNiwzMC42NTY4NTQyIDE0LjY1Njg1NDIsMzIgMTMsMzIgQzExLjM0MzE0NTgsMzIgMTAsMzAuNjU2ODU0MiAxMCwyOSBMMTAsMTkgQzEwLDE3LjM0MzE0NTggMTEuMzQzMTQ1OCwxNiAxMywxNiBaIiBpZD0iU2hhcGUiIGZpbGwtb3BhY2l0eT0iMC44Ij48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0zLDIyIEM0LjY1Njg1NDI1LDIyIDYsMjMuMzQzMTQ1OCA2LDI1IEw2LDI5IEM2LDMwLjY1Njg1NDIgNC42NTY4NTQyNSwzMiAzLDMyIEMxLjM0MzE0NTc1LDMyIDIuMDI5MDYxMjVlLTE2LDMwLjY1Njg1NDIgMCwyOSBMMCwyNSBDLTIuMDI5MDYxMjVlLTE2LDIzLjM0MzE0NTggMS4zNDMxNDU3NSwyMiAzLDIyIFoiIGlkPSJTaGFwZSI+PC9wYXRoPgogICAgICAgICAgICA8cGF0aCBkPSJNNS44MSwxLjI3IEwzNi43MywzMi4xOSBDMzcuNDMxNDAxNiwzMi44OTE0MDE2IDM3LjQzMTQwMTYsMzQuMDI4NTk4NCAzNi43MywzNC43MyBDMzYuMDI4NTk4NCwzNS40MzE0MDE2IDM0Ljg5MTQwMTYsMzUuNDMxNDAxNiAzNC4xOSwzNC43MyBMMy4yNywzLjgxIEMyLjU2ODU5ODM3LDMuMTA4NTk4MzcgMi41Njg1OTgzNywxLjk3MTQwMTYzIDMuMjcsMS4yNyBDMy45NzE0MDE2MywwLjU2ODU5ODM2OCA1LjEwODU5ODM3LDAuNTY4NTk4MzY4IDUuODEsMS4yNyBaIiBpZD0iUGF0aCIgZmlsbC1ydWxlPSJub256ZXJvIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=\n";
@@ -1856,7 +1893,7 @@ function alanBtn(options) {
1856
1893
  var hoverSelector = !isMobile() ? ':hover' : ':active';
1857
1894
 
1858
1895
  if (!isMobile()) {
1859
- keyFrames += getStyleSheetMarker() + '.alanBtn{transform: scale(1);transition:all 0.4s ease-in-out;} .alanBtn' + hoverSelector + '{transform: scale(1.11111);transition:all 0.4s ease-in-out;}.alanBtn:focus {transform: scale(1);transition:all 0.4s ease-in-out; border: solid 3px #50e3c2; outline: none; }';
1896
+ keyFrames += getStyleSheetMarker() + '.alanBtn{transform: scale(1);'+ transitionCss +';} .alanBtn' + hoverSelector + '{transform: scale(1.11111);transition:' + transitionCss + ';}.alanBtn:focus {transform: scale(1);' + transitionCss + '; border: solid 3px #50e3c2; outline: none; }';
1860
1897
  }
1861
1898
 
1862
1899
  keyFrames += getStyleSheetMarker() + '.alanBtn-recognised-text-holder { position:fixed; transform: translateY(' + (isTopAligned ? '-' : '') +'50%); max-width:236px; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 18px; min-height: 40px; color: #000; font-weight: normal; background-color: #fff; border-radius:10px; box-shadow: 0px 1px 14px rgba(0, 0, 0, 0.35); display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack: activate;-ms-flex-pack: start;justify-content: start;}';
@@ -2168,7 +2205,11 @@ function alanBtn(options) {
2168
2205
  tryReadSettingsFromLocalStorage();
2169
2206
  switchState(getDefaultBtnState(DISCONNECTED));
2170
2207
 
2171
- window.tutorProject = alan.project(options.key, getAuthData(options.authData), options.host, null, { platform: (mode === 'demo' ? 'alanplayground' : null), appName: window.location.hostname });
2208
+ window.tutorProject = alan.project(options.key, getAuthData(options.authData), options.host, null, {
2209
+ platform: (mode === 'demo' ? 'alanplayground' : null),
2210
+ userAgent: navigator.userAgent,
2211
+ appName: window.location.hostname
2212
+ });
2172
2213
  window.tutorProject.on('connectStatus', onConnectStatusChange);
2173
2214
  window.tutorProject.on('options', onOptionsReceived);
2174
2215
  //window.tutorProject.on('popup', onPopup);
@@ -2210,10 +2251,50 @@ function alanBtn(options) {
2210
2251
  togglePopupVisibility(true);
2211
2252
  }, 400);
2212
2253
 
2254
+ var windowPrevInnerHeight = window.innerHeight;
2255
+ var windowPrevOrientation = window.orientation;
2256
+
2257
+ function isSafari(){
2258
+ return /apple/i.test(navigator.vendor);
2259
+ }
2260
+
2213
2261
  window.onresize = function () {
2214
- if (btnWasMoved) {
2262
+ if (isTutorMode()) return;
2263
+ var innerHeightDelta = Math.abs(windowPrevInnerHeight - window.innerHeight);
2264
+ var isMobileIos = (isMobile() || isIpadOS()) && isSafari();
2265
+ var orientationWasChanged = windowPrevOrientation !== window.orientation;
2266
+ // Here we describe different cases when browser's panel on mobile are shown or hidden
2267
+ // We cannot detect it other way, so we have to use this magic constants here
2268
+ // innerHeightDelta === 50 - top brawser panel is shown in landscape mode
2269
+ // innerHeightDelta === 84 - mobile ios smart banner is shown
2270
+ // innerHeightDelta === 95 - tablet ios smart banner is shown
2271
+ // innerHeightDelta === 0 - ios smart banner is hidden
2272
+
2273
+ var isVerticalResize = innerHeightDelta !== 0;
2274
+
2275
+ var mobilePanelsWereShownOrHidden = isMobileIos &&
2276
+ (innerHeightDelta === 84 || innerHeightDelta === 95 || innerHeightDelta === 50 || innerHeightDelta === 0);
2277
+
2278
+ windowPrevOrientation = window.orientation;
2279
+ windowPrevInnerHeight = window.innerHeight;
2280
+
2281
+ if ((orientationWasChanged ||
2282
+ btnWasMoved ||
2283
+ mobilePanelsWereShownOrHidden) &&
2284
+ isVerticalResize) {
2215
2285
  var rootElClientRect = rootEl.getBoundingClientRect();
2216
- rootEl.style.setProperty('top', correctYPos(rootElClientRect.top) + 'px', 'important');
2286
+ var newYPos;
2287
+ if (innerHeightDelta === 0) {
2288
+ newYPos = rootElClientRect.top + 84;
2289
+ } else {
2290
+ newYPos = rootElClientRect.top;
2291
+ }
2292
+
2293
+ if (orientationWasChanged && window.orientation === 0) {//portrait
2294
+ setDefaultBtnHorizontalPosition();
2295
+ } else {
2296
+ rootEl.style.setProperty('top', correctYPos(newYPos) + 'px', 'important');
2297
+ }
2217
2298
  }
2218
2299
  togglePopupVisibility(false);
2219
2300
  onresizeDebounced();
@@ -2223,6 +2304,9 @@ function alanBtn(options) {
2223
2304
  if (navigator.permissions) {
2224
2305
  navigator.permissions.query({ name: 'microphone' }).then(function (result) {
2225
2306
  if (result.state === 'prompt') {
2307
+ if (options.showOverlayOnMicPermissionPrompt) {
2308
+ showPopup({ overlay: true, buttonUnderOverlay: true });
2309
+ }
2226
2310
  sendClientEvent({ micPermissionPrompt: true });
2227
2311
  }
2228
2312
  if (result.state !== 'granted') {
@@ -2334,6 +2418,7 @@ function alanBtn(options) {
2334
2418
  }
2335
2419
 
2336
2420
  function showPopup(popupOptions) {
2421
+ if (btnDisabled) return;
2337
2422
  savedPopupOptions = popupOptions;
2338
2423
  var message = popupOptions.message;
2339
2424
  var buttonMarginInPopup = popupOptions.buttonMarginInPopup;
@@ -2352,7 +2437,10 @@ function alanBtn(options) {
2352
2437
  overlay.classList.add('alan-overlay');
2353
2438
  popup.classList.add('alan-overlay-popup');
2354
2439
 
2355
- btn.style.zIndex = maxZIndex;
2440
+ if (popupOptions.buttonUnderOverlay !== true) {
2441
+ btn.style.zIndex = maxZIndex;
2442
+ }
2443
+
2356
2444
  overlay.style.zIndex = maxZIndex - 3;
2357
2445
  popup.style.zIndex = maxZIndex - 2;
2358
2446
 
@@ -2400,8 +2488,10 @@ function alanBtn(options) {
2400
2488
  }
2401
2489
 
2402
2490
  if (!popupOptions.html) {
2403
- popup.classList.add('default-popup');
2404
- popup.innerHTML = '<div class="alan-overlay-popup__body">' + message + '</div>';
2491
+ if (message) {
2492
+ popup.classList.add('default-popup');
2493
+ popup.innerHTML = '<div class="alan-overlay-popup__body">' + message + '</div>';
2494
+ }
2405
2495
  } else {
2406
2496
  popup.innerHTML = popupOptions.html;
2407
2497
  }
@@ -2409,20 +2499,35 @@ function alanBtn(options) {
2409
2499
  var closeIconImg = document.createElement('div');
2410
2500
  closeIconImg.id = 'alan-overlay-ok-btn';
2411
2501
  closeIconImg.classList.add('alan-overlay-popup__ok');
2412
- popup.appendChild(closeIconImg);
2502
+ if (popupOptions.html && popup.children[0]) {
2503
+ popup.children[0].appendChild(closeIconImg);
2504
+ } else {
2505
+ popup.appendChild(closeIconImg);
2506
+ }
2413
2507
 
2414
2508
  rootEl.appendChild(popup);
2415
2509
  if (withOverlay) {
2416
2510
  rootEl.appendChild(overlay);
2417
2511
  }
2418
- closeIconImg.addEventListener('click', hidePopup);
2512
+ closeIconImg.addEventListener('click', hidePopupByCloseIcon);
2419
2513
  overlay.addEventListener('click', hidePopup);
2420
2514
  document.addEventListener('keyup', hidePopupByEsc);
2515
+ let showPopupEvent = "showPopup";
2516
+ if (popupOptions.name) {
2517
+ showPopupEvent += ":" + popupOptions.name;
2518
+ }
2519
+ sendUserEvent(showPopupEvent);
2520
+ }
2521
+
2522
+ function hidePopupByCloseIcon() {
2523
+ hidePopup();
2524
+ sendClientEvent({popupCloseClicked: true});
2421
2525
  }
2422
2526
 
2423
2527
  function hidePopupByEsc(e) {
2424
2528
  if (e.keyCode === 27) {
2425
2529
  hidePopup();
2530
+ sendClientEvent({popupCloseClicked: true});
2426
2531
  }
2427
2532
  }
2428
2533
 
@@ -2519,6 +2624,15 @@ function alanBtn(options) {
2519
2624
  }
2520
2625
  recognisedTextContent.innerHTML = recognisedText;
2521
2626
  }
2627
+ if (recognisedTextHolder.classList.contains('absolute-positioned')) {
2628
+ if (recognisedText.length < 33) {
2629
+ recognisedTextHolder.style.whiteSpace = 'nowrap';
2630
+ recognisedTextHolder.style.minWidth = 'auto';
2631
+ } else {
2632
+ recognisedTextHolder.style.minWidth = '236px';
2633
+ recognisedTextHolder.style.whiteSpace = 'normal';
2634
+ }
2635
+ }
2522
2636
 
2523
2637
  if (recognisedText.length > 60 && recognisedText.length <= 80) {
2524
2638
  recognisedTextHolder.classList.add('alanBtn-recognised-text-holder-long');
@@ -2609,10 +2723,10 @@ function alanBtn(options) {
2609
2723
  }
2610
2724
 
2611
2725
  if (data && data.web && data.web.hidden === true) {
2612
- hideAlanBtn();
2726
+ hideBtn();
2613
2727
  } else {
2614
2728
  // sendClientEvent({ buttonReady: true });
2615
- showAlanBtn();
2729
+ showBtn();
2616
2730
  }
2617
2731
  }
2618
2732
 
@@ -2825,7 +2939,9 @@ function alanBtn(options) {
2825
2939
  if (options.onCommand) {
2826
2940
  options.onCommand(e.data);
2827
2941
  }
2828
- switchState(LISTENING);
2942
+ if (isAlanActive) {
2943
+ switchState(LISTENING);
2944
+ }
2829
2945
  turnOffVoiceFn();
2830
2946
  }
2831
2947
 
@@ -3111,6 +3227,7 @@ function alanBtn(options) {
3111
3227
  } else if (newState === PERMISSION_DENIED) {
3112
3228
  rootEl.classList.add("alan-btn-permission-denied");
3113
3229
  currentErrMsg = MIC_BLOCKED_MSG;
3230
+ console.warn(MIC_BLOCKED_MSG);
3114
3231
  } else if (newState === NO_VOICE_SUPPORT || newState === NOT_SECURE_ORIGIN) {
3115
3232
  rootEl.classList.add("alan-btn-no-voice-support");
3116
3233
  if (newState === NO_VOICE_SUPPORT) {
@@ -3246,12 +3363,18 @@ function alanBtn(options) {
3246
3363
  }
3247
3364
 
3248
3365
  function isMobile() {
3249
- if (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
3366
+ if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
3250
3367
  return true;
3251
3368
  }
3252
3369
  return false;
3253
3370
  }
3254
3371
 
3372
+ function isIpadOS() {
3373
+ return navigator.maxTouchPoints &&
3374
+ navigator.maxTouchPoints > 2 &&
3375
+ /MacIntel/.test(navigator.platform);
3376
+ }
3377
+
3255
3378
  function isOriginSecure() {
3256
3379
  var isSecure = false;
3257
3380
  var protocol = window.location.protocol;
@@ -3297,7 +3420,7 @@ function alanBtn(options) {
3297
3420
  //#endregion
3298
3421
 
3299
3422
  //#region Append layers to the rootEl
3300
- function showAlanBtn() {
3423
+ function showBtn() {
3301
3424
  rootEl.innerHTML = '';
3302
3425
 
3303
3426
  recognisedTextHolder.appendChild(recognisedTextContent);
@@ -3308,7 +3431,7 @@ function alanBtn(options) {
3308
3431
  sendClientEvent({ buttonReady: true });
3309
3432
  }
3310
3433
 
3311
- function hideAlanBtn() {
3434
+ function hideBtn() {
3312
3435
  if (!isTutorMode()) {
3313
3436
  alanAudio.stop();
3314
3437
  rootEl.innerHTML = '';
@@ -3385,7 +3508,7 @@ function alanBtn(options) {
3385
3508
  var alanBtnSavedOptions = null;
3386
3509
 
3387
3510
  if (isTutorMode()) {
3388
- showAlanBtn();
3511
+ showBtn();
3389
3512
  } else {
3390
3513
  if (isLocalStorageAvailable) {
3391
3514
  try {
@@ -3421,8 +3544,8 @@ function alanBtn(options) {
3421
3544
  //#region Drag-n-drop btn logic
3422
3545
 
3423
3546
  if (!pinned) {
3424
- rootEl.addEventListener('mousedown', onMouseDown, true);
3425
- rootEl.addEventListener('touchstart', onMouseDown, { passive: false });
3547
+ btn.addEventListener('mousedown', onMouseDown, true);
3548
+ btn.addEventListener('touchstart', onMouseDown, { passive: false });
3426
3549
 
3427
3550
  document.addEventListener('mouseup', onMouseUp, true);
3428
3551
  document.addEventListener('touchend', onMouseUp, { passive: false });
@@ -3481,7 +3604,10 @@ function alanBtn(options) {
3481
3604
  tempDeltaY = posInfo.clientY - dndInitMousePos[1];
3482
3605
  rootEl.style.setProperty('left', correctXPos(newLeftPos) + 'px', 'important');
3483
3606
  rootEl.style.setProperty('top', correctYPos(newTopPos) + 'px', 'important');
3607
+ e.preventDefault();
3608
+ return false;
3484
3609
  }
3610
+
3485
3611
  }
3486
3612
 
3487
3613
  function onMouseUp(e) {
@@ -3495,6 +3621,13 @@ function alanBtn(options) {
3495
3621
  curX = parseInt(rootEl.style.left, 10);
3496
3622
  curY = parseInt(rootEl.style.top, 10);
3497
3623
 
3624
+ if (Math.abs(tempDeltaX) < 15 && Math.abs(tempDeltaY) < 15) {
3625
+ afterMouseMove = false;
3626
+ dndBackAnimFinished = true;
3627
+ setButtonPosition();
3628
+ return;
3629
+ }
3630
+
3498
3631
  if (curX <= window.innerWidth / 2) {
3499
3632
  rootEl.style.setProperty('left', dndFinalHorPos + 'px', 'important');
3500
3633
  changeBtnSide('to-left');
@@ -3524,11 +3657,6 @@ function alanBtn(options) {
3524
3657
  setTimeout(function () {
3525
3658
  afterMouseMove = false;
3526
3659
  }, 300);
3527
-
3528
- if (Math.abs(tempDeltaX) < 15 || Math.abs(tempDeltaY) < 15) {
3529
- afterMouseMove = false;
3530
- dndBackAnimFinished = true;
3531
- }
3532
3660
  }
3533
3661
  }
3534
3662