@alan-ai/alan-sdk-web 1.8.30 → 1.8.31
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/.DS_Store +0 -0
- package/dist/alan_lib.js +26 -16
- package/dist/alan_lib.min.js +1 -1
- package/package.json +1 -1
package/dist/.DS_Store
ADDED
|
Binary file
|
package/dist/alan_lib.js
CHANGED
|
@@ -781,7 +781,7 @@
|
|
|
781
781
|
(function(ns) {
|
|
782
782
|
"use strict";
|
|
783
783
|
|
|
784
|
-
var alanButtonVersion = '1.8.
|
|
784
|
+
var alanButtonVersion = '1.8.31';
|
|
785
785
|
|
|
786
786
|
if (window.alanBtn) {
|
|
787
787
|
console.warn('Alan: the Alan Button source code has already added (v.' + alanButtonVersion + ')');
|
|
@@ -986,6 +986,7 @@ function alanBtn(options) {
|
|
|
986
986
|
},
|
|
987
987
|
//deprecated
|
|
988
988
|
callClientApi: function (method, data, callback) {
|
|
989
|
+
console.error('The "callClientApi" method is deprecated. Please use the "callProjectApi: instead.\n\nSee more info here: https://alan.app/docs/client-api/methods/common-api/?highlight=callprojectapi#callprojectapi');
|
|
989
990
|
if (btnDisabled) {
|
|
990
991
|
return;
|
|
991
992
|
}
|
|
@@ -996,6 +997,7 @@ function alanBtn(options) {
|
|
|
996
997
|
},
|
|
997
998
|
// deprecated
|
|
998
999
|
setAuthData: function (data) {
|
|
1000
|
+
console.error('The "setAuthData" method is deprecated. Please use the "authData" property when you create the Alan Button.\n\nSee more info here: https://alan.app/docs/server-api/sending-data/authdata/?highlight=authdata');
|
|
999
1001
|
if (btnDisabled) {
|
|
1000
1002
|
return;
|
|
1001
1003
|
}
|
|
@@ -2216,6 +2218,7 @@ function alanBtn(options) {
|
|
|
2216
2218
|
|
|
2217
2219
|
// console.info('BTN: tutorProject', options.key);
|
|
2218
2220
|
} else {
|
|
2221
|
+
console.error("The Alan Button key wasn't provided");
|
|
2219
2222
|
switchState(getDefaultBtnState());
|
|
2220
2223
|
}
|
|
2221
2224
|
}
|
|
@@ -2248,7 +2251,7 @@ function alanBtn(options) {
|
|
|
2248
2251
|
}
|
|
2249
2252
|
|
|
2250
2253
|
var onresizeDebounced = debounce(function (e) {
|
|
2251
|
-
togglePopupVisibility(true);
|
|
2254
|
+
togglePopupVisibility(true, true);
|
|
2252
2255
|
}, 400);
|
|
2253
2256
|
|
|
2254
2257
|
var windowPrevInnerHeight = window.innerHeight;
|
|
@@ -2260,6 +2263,7 @@ function alanBtn(options) {
|
|
|
2260
2263
|
|
|
2261
2264
|
window.onresize = function () {
|
|
2262
2265
|
if (isTutorMode()) return;
|
|
2266
|
+
if (absolutePosition) return;
|
|
2263
2267
|
var innerHeightDelta = Math.abs(windowPrevInnerHeight - window.innerHeight);
|
|
2264
2268
|
var isMobileIos = (isMobile() || isIpadOS()) && isSafari();
|
|
2265
2269
|
var orientationWasChanged = windowPrevOrientation !== window.orientation;
|
|
@@ -2304,9 +2308,9 @@ function alanBtn(options) {
|
|
|
2304
2308
|
if (navigator.permissions) {
|
|
2305
2309
|
navigator.permissions.query({ name: 'microphone' }).then(function (result) {
|
|
2306
2310
|
if (result.state === 'prompt') {
|
|
2307
|
-
if (options.showOverlayOnMicPermissionPrompt) {
|
|
2311
|
+
// if (options.showOverlayOnMicPermissionPrompt) {
|
|
2308
2312
|
showPopup({ overlay: true, buttonUnderOverlay: true });
|
|
2309
|
-
}
|
|
2313
|
+
// }
|
|
2310
2314
|
sendClientEvent({ micPermissionPrompt: true });
|
|
2311
2315
|
}
|
|
2312
2316
|
if (result.state !== 'granted') {
|
|
@@ -2417,14 +2421,15 @@ function alanBtn(options) {
|
|
|
2417
2421
|
}
|
|
2418
2422
|
}
|
|
2419
2423
|
|
|
2420
|
-
function showPopup(popupOptions) {
|
|
2424
|
+
function showPopup(popupOptions, keepPopupOverlay) {
|
|
2421
2425
|
if (btnDisabled) return;
|
|
2426
|
+
if (popupIsVisible) return;
|
|
2427
|
+
|
|
2422
2428
|
savedPopupOptions = popupOptions;
|
|
2423
2429
|
var message = popupOptions.message;
|
|
2424
2430
|
var buttonMarginInPopup = popupOptions.buttonMarginInPopup;
|
|
2425
2431
|
var withOverlay = popupOptions.overlay;
|
|
2426
2432
|
var _btnSize = parseInt(btnSize, 10);
|
|
2427
|
-
var overlay = document.createElement('div');
|
|
2428
2433
|
var popup = document.createElement('div');
|
|
2429
2434
|
var rootElClientRect = rootEl.getBoundingClientRect();
|
|
2430
2435
|
var maxZIndex = 2147483647;
|
|
@@ -2432,16 +2437,13 @@ function alanBtn(options) {
|
|
|
2432
2437
|
|
|
2433
2438
|
popupIsVisible = true;
|
|
2434
2439
|
|
|
2435
|
-
overlay.id = 'alan-overlay';
|
|
2436
2440
|
popup.id = 'alan-overlay-popup';
|
|
2437
|
-
overlay.classList.add('alan-overlay');
|
|
2438
2441
|
popup.classList.add('alan-overlay-popup');
|
|
2439
2442
|
|
|
2440
2443
|
if (popupOptions.buttonUnderOverlay !== true) {
|
|
2441
2444
|
btn.style.zIndex = maxZIndex;
|
|
2442
2445
|
}
|
|
2443
2446
|
|
|
2444
|
-
overlay.style.zIndex = maxZIndex - 3;
|
|
2445
2447
|
popup.style.zIndex = maxZIndex - 2;
|
|
2446
2448
|
|
|
2447
2449
|
if (popupOptions.preventClick) {
|
|
@@ -2506,11 +2508,18 @@ function alanBtn(options) {
|
|
|
2506
2508
|
}
|
|
2507
2509
|
|
|
2508
2510
|
rootEl.appendChild(popup);
|
|
2509
|
-
|
|
2511
|
+
|
|
2512
|
+
if (withOverlay && keepPopupOverlay !== true) {
|
|
2513
|
+
var overlay = document.createElement('div');
|
|
2514
|
+
overlay.id = 'alan-overlay';
|
|
2515
|
+
overlay.classList.add('alan-overlay');
|
|
2516
|
+
overlay.style.zIndex = maxZIndex - 3;
|
|
2510
2517
|
rootEl.appendChild(overlay);
|
|
2518
|
+
overlay.addEventListener('click', hidePopup);
|
|
2511
2519
|
}
|
|
2520
|
+
|
|
2512
2521
|
closeIconImg.addEventListener('click', hidePopupByCloseIcon);
|
|
2513
|
-
|
|
2522
|
+
|
|
2514
2523
|
document.addEventListener('keyup', hidePopupByEsc);
|
|
2515
2524
|
let showPopupEvent = "showPopup";
|
|
2516
2525
|
if (popupOptions.name) {
|
|
@@ -2531,7 +2540,7 @@ function alanBtn(options) {
|
|
|
2531
2540
|
}
|
|
2532
2541
|
}
|
|
2533
2542
|
|
|
2534
|
-
function hidePopup(keepOptionsInMemory) {
|
|
2543
|
+
function hidePopup(keepOptionsInMemory, keepPopupOverlay) {
|
|
2535
2544
|
if (keepOptionsInMemory !== true) {
|
|
2536
2545
|
savedPopupOptions = null;
|
|
2537
2546
|
}
|
|
@@ -2542,7 +2551,7 @@ function alanBtn(options) {
|
|
|
2542
2551
|
if (overlayCloseIcon) {
|
|
2543
2552
|
overlayCloseIcon.removeEventListener('click', hidePopup);
|
|
2544
2553
|
}
|
|
2545
|
-
if (overlay) {
|
|
2554
|
+
if (overlay && keepPopupOverlay !== true) {
|
|
2546
2555
|
overlay.remove();
|
|
2547
2556
|
overlay.removeEventListener('click', hidePopup);
|
|
2548
2557
|
}
|
|
@@ -2557,14 +2566,14 @@ function alanBtn(options) {
|
|
|
2557
2566
|
|
|
2558
2567
|
var savedPopupOptions;
|
|
2559
2568
|
|
|
2560
|
-
function togglePopupVisibility(isVisible) {
|
|
2569
|
+
function togglePopupVisibility(isVisible, keepPopupOverlay) {
|
|
2561
2570
|
var popup = rootEl.querySelector('#alan-overlay-popup');
|
|
2562
2571
|
if (popup) {
|
|
2563
2572
|
popup.style.visibility = isVisible ? 'visible' : 'hidden';
|
|
2564
2573
|
if (isVisible) {
|
|
2565
|
-
hidePopup(true);
|
|
2574
|
+
hidePopup(true, keepPopupOverlay);
|
|
2566
2575
|
if (savedPopupOptions) {
|
|
2567
|
-
showPopup(savedPopupOptions);
|
|
2576
|
+
showPopup(savedPopupOptions, keepPopupOverlay);
|
|
2568
2577
|
}
|
|
2569
2578
|
}
|
|
2570
2579
|
}
|
|
@@ -3326,6 +3335,7 @@ function alanBtn(options) {
|
|
|
3326
3335
|
el.style.opacity = 0;
|
|
3327
3336
|
el.style.transition = 'opacity 300ms ease-in-out';
|
|
3328
3337
|
el.style.animation = gradientAnimation;
|
|
3338
|
+
el.style.display = 'block';
|
|
3329
3339
|
}
|
|
3330
3340
|
|
|
3331
3341
|
function hideLayers(layers) {
|