react-autoql 3.4.7 → 3.5.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/dist/.autoql.esm.css.icloud +0 -0
- package/dist/autoql.esm 2.css +4247 -0
- package/dist/autoql.esm.css +2437 -2297
- package/dist/autoql.esm.js +1020 -521
- package/package.json +8 -2
package/dist/autoql.esm.js
CHANGED
|
@@ -6,6 +6,7 @@ import LocalizedFormat from 'dayjs/plugin/localizedFormat';
|
|
|
6
6
|
import utc from 'dayjs/plugin/utc';
|
|
7
7
|
import timezone from 'dayjs/plugin/timezone';
|
|
8
8
|
import axios from 'axios';
|
|
9
|
+
import _$1 from 'lodash';
|
|
9
10
|
import React, { Fragment, Component } from 'react';
|
|
10
11
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
11
12
|
import PropTypes, { shape, string, number, bool, oneOf, arrayOf, func, instanceOf, oneOfType, array } from 'prop-types';
|
|
@@ -15,7 +16,7 @@ import { MdError, MdLockOpen, MdPlayCircleOutline, MdLock, MdInfoOutline, MdCont
|
|
|
15
16
|
import { FiAlertTriangle, FiTrash2, FiSettings, FiSend, FiPlus, FiPauseCircle, FiBellOff, FiBell, FiMoreHorizontal, FiMoreVertical, FiFilter, FiEye, FiDownload, FiDatabase, FiCheck, FiCalendar, FiArrowLeft } from 'react-icons/fi';
|
|
16
17
|
import { IoIosSearch, IoIosHourglass, IoIosGlobe, IoIosCloseCircleOutline } from 'react-icons/io';
|
|
17
18
|
import { TiSortNumerically } from 'react-icons/ti';
|
|
18
|
-
import { AiOutlineBook, AiOutlineQuestionCircle, AiOutlineMenu, AiOutlineBulb, AiOutlineEdit, AiOutlineFileText, AiOutlineDashboard, AiFillCaretLeft, AiFillCaretRight } from 'react-icons/ai';
|
|
19
|
+
import { AiOutlineBook, AiOutlineQuestionCircle, AiOutlineMenu, AiOutlineBulb, AiOutlineEdit, AiOutlineFileText, AiOutlineDashboard, AiFillCaretUp, AiFillCaretDown, AiFillCaretLeft, AiFillCaretRight } from 'react-icons/ai';
|
|
19
20
|
import { FaMicrophoneAlt } from 'react-icons/fa';
|
|
20
21
|
import { GoReport } from 'react-icons/go';
|
|
21
22
|
import ReactTooltip from 'react-tooltip';
|
|
@@ -23,7 +24,6 @@ import _isEqual from 'lodash.isequal';
|
|
|
23
24
|
import _cloneDeep from 'lodash.clonedeep';
|
|
24
25
|
import InfiniteScroll from 'react-infinite-scroller';
|
|
25
26
|
import uuid from 'uuid';
|
|
26
|
-
import _$1 from 'lodash';
|
|
27
27
|
import parseNum from 'parse-num';
|
|
28
28
|
import Popover from 'react-tiny-popover';
|
|
29
29
|
import momentTZ from 'moment-timezone';
|
|
@@ -31,6 +31,8 @@ import ReactSelect from 'react-select';
|
|
|
31
31
|
import ReactModal from 'react-modal';
|
|
32
32
|
import _isEmpty from 'lodash.isempty';
|
|
33
33
|
import disableScroll from 'disable-scroll';
|
|
34
|
+
import moment from 'moment';
|
|
35
|
+
import { UnmountClosed } from 'react-collapse';
|
|
34
36
|
import HTMLRenderer from 'react-html-renderer';
|
|
35
37
|
import { scaleOrdinal, scaleBand, scaleLinear } from 'd3-scale';
|
|
36
38
|
import Autosuggest from 'react-autosuggest';
|
|
@@ -46,11 +48,12 @@ import { symbol, symbolCircle, pie, arc } from 'd3-shape';
|
|
|
46
48
|
import { entries } from 'd3-collection';
|
|
47
49
|
import 'd3-transition';
|
|
48
50
|
import Drawer from 'rc-drawer';
|
|
49
|
-
import
|
|
51
|
+
import 'lodash.includes';
|
|
50
52
|
import _has from 'lodash.has';
|
|
51
53
|
import { Scrollbars } from 'react-custom-scrollbars';
|
|
52
54
|
import LocalizedStrings from 'react-localization';
|
|
53
55
|
import 'rc-drawer/assets/index.css';
|
|
56
|
+
import Switch from 'react-switch';
|
|
54
57
|
import sqlFormatter from 'sql-formatter';
|
|
55
58
|
import ReactPaginate from 'react-paginate';
|
|
56
59
|
import RGL, { WidthProvider } from 'react-grid-layout';
|
|
@@ -354,6 +357,63 @@ function _nonIterableSpread() {
|
|
|
354
357
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
355
358
|
}
|
|
356
359
|
|
|
360
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
361
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
362
|
+
|
|
363
|
+
if (!it) {
|
|
364
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
365
|
+
if (it) o = it;
|
|
366
|
+
var i = 0;
|
|
367
|
+
|
|
368
|
+
var F = function () {};
|
|
369
|
+
|
|
370
|
+
return {
|
|
371
|
+
s: F,
|
|
372
|
+
n: function () {
|
|
373
|
+
if (i >= o.length) return {
|
|
374
|
+
done: true
|
|
375
|
+
};
|
|
376
|
+
return {
|
|
377
|
+
done: false,
|
|
378
|
+
value: o[i++]
|
|
379
|
+
};
|
|
380
|
+
},
|
|
381
|
+
e: function (e) {
|
|
382
|
+
throw e;
|
|
383
|
+
},
|
|
384
|
+
f: F
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
var normalCompletion = true,
|
|
392
|
+
didErr = false,
|
|
393
|
+
err;
|
|
394
|
+
return {
|
|
395
|
+
s: function () {
|
|
396
|
+
it = it.call(o);
|
|
397
|
+
},
|
|
398
|
+
n: function () {
|
|
399
|
+
var step = it.next();
|
|
400
|
+
normalCompletion = step.done;
|
|
401
|
+
return step;
|
|
402
|
+
},
|
|
403
|
+
e: function (e) {
|
|
404
|
+
didErr = true;
|
|
405
|
+
err = e;
|
|
406
|
+
},
|
|
407
|
+
f: function () {
|
|
408
|
+
try {
|
|
409
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
410
|
+
} finally {
|
|
411
|
+
if (didErr) throw err;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
357
417
|
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
358
418
|
_inherits(ErrorBoundary, _React$Component);
|
|
359
419
|
|
|
@@ -473,13 +533,16 @@ var autoQLConfigDefault = {
|
|
|
473
533
|
debug: false,
|
|
474
534
|
test: false,
|
|
475
535
|
enableAutocomplete: true,
|
|
536
|
+
enableQueryInterpretation: true,
|
|
537
|
+
defaultShowInterpretation: false,
|
|
476
538
|
enableQueryValidation: true,
|
|
477
539
|
enableQuerySuggestions: true,
|
|
478
540
|
enableColumnVisibilityManager: true,
|
|
479
541
|
enableDrilldowns: true,
|
|
480
542
|
enableNotifications: false,
|
|
481
543
|
enableSlackSharing: true,
|
|
482
|
-
enableTeamsSharing: true
|
|
544
|
+
enableTeamsSharing: true,
|
|
545
|
+
enableCSVDownload: false
|
|
483
546
|
};
|
|
484
547
|
var themeConfigDefault = {
|
|
485
548
|
theme: 'light',
|
|
@@ -923,7 +986,8 @@ var formatChartLabel = function formatChartLabel(_ref) {
|
|
|
923
986
|
case 'PERCENT':
|
|
924
987
|
{
|
|
925
988
|
if (Number(d)) {
|
|
926
|
-
|
|
989
|
+
var p = Number(d) / 100;
|
|
990
|
+
formattedLabel = Numbro(p).format({
|
|
927
991
|
output: 'percent',
|
|
928
992
|
mantissa: 0
|
|
929
993
|
});
|
|
@@ -1050,7 +1114,8 @@ var formatElement = function formatElement(_ref2) {
|
|
|
1050
1114
|
case 'PERCENT':
|
|
1051
1115
|
{
|
|
1052
1116
|
if (Number(element)) {
|
|
1053
|
-
|
|
1117
|
+
var p = Number(element) / 100;
|
|
1118
|
+
formattedElement = Numbro(p).format('0.00%');
|
|
1054
1119
|
|
|
1055
1120
|
if (htmlElement) {
|
|
1056
1121
|
htmlElement.classList.add("comparison-value-".concat(element < 0 ? 'negative' : 'positive'));
|
|
@@ -1211,7 +1276,7 @@ var supportsPieChart = function supportsPieChart(columns, chartData) {
|
|
|
1211
1276
|
|
|
1212
1277
|
return true;
|
|
1213
1278
|
};
|
|
1214
|
-
var getSupportedDisplayTypes = function getSupportedDisplayTypes(response, chartData) {
|
|
1279
|
+
var getSupportedDisplayTypes = function getSupportedDisplayTypes(response, chartData, shouldExcludePieChart) {
|
|
1215
1280
|
try {
|
|
1216
1281
|
if (!_get(response, 'data.data.display_type')) {
|
|
1217
1282
|
return [];
|
|
@@ -1248,7 +1313,7 @@ var getSupportedDisplayTypes = function getSupportedDisplayTypes(response, chart
|
|
|
1248
1313
|
// column, we should be able to chart anything
|
|
1249
1314
|
var _supportedDisplayTypes = ['table', 'column', 'bar', 'line'];
|
|
1250
1315
|
|
|
1251
|
-
if (supportsPieChart(columns, chartData)) {
|
|
1316
|
+
if (supportsPieChart(columns, chartData) && !shouldExcludePieChart) {
|
|
1252
1317
|
_supportedDisplayTypes.push('pie');
|
|
1253
1318
|
} // create pivot based on month and year
|
|
1254
1319
|
|
|
@@ -1656,8 +1721,10 @@ var lang = new LocalizedStrings({
|
|
|
1656
1721
|
queryPrompt: 'Type your queries here ',
|
|
1657
1722
|
seeMore: 'See more',
|
|
1658
1723
|
dataMessengerOptions: 'Options menu',
|
|
1659
|
-
|
|
1660
|
-
|
|
1724
|
+
openFilterLocking: 'Open filter locking menu',
|
|
1725
|
+
closeFilterLocking: 'Close filter menu',
|
|
1726
|
+
filterLockingTitle: 'Filter Locking',
|
|
1727
|
+
noFiltersLocked: 'No Filters are locked yet',
|
|
1661
1728
|
clearDataResponses: 'Clear all queries & responses',
|
|
1662
1729
|
closeDataMessenger: 'Close Data Messenger',
|
|
1663
1730
|
searchQueries: 'Search relevant queries by topic',
|
|
@@ -1694,8 +1761,10 @@ var lang = new LocalizedStrings({
|
|
|
1694
1761
|
queryPrompt: 'Escribe tus consultas aquí',
|
|
1695
1762
|
seeMore: 'Ver más',
|
|
1696
1763
|
dataMessengerOptions: 'Menú de opciones',
|
|
1697
|
-
|
|
1698
|
-
|
|
1764
|
+
openFilterLocking: 'Abrir menú de filtrar',
|
|
1765
|
+
closeFilterLocking: 'Cerrar menú de filtrar',
|
|
1766
|
+
filterLockingTitle: 'Menú de Filtro',
|
|
1767
|
+
noFiltersLocked: 'Ningún filtro está bloqueado todavía',
|
|
1699
1768
|
clearDataResponses: 'Borrar todas las consultas y respuestas',
|
|
1700
1769
|
closeDataMessenger: 'Cerrar Data mesenger',
|
|
1701
1770
|
searchQueries: 'Buscar consultas relevantes por tema',
|
|
@@ -2175,6 +2244,18 @@ var Icon = /*#__PURE__*/function (_React$Component) {
|
|
|
2175
2244
|
break;
|
|
2176
2245
|
}
|
|
2177
2246
|
|
|
2247
|
+
case 'caret-down':
|
|
2248
|
+
{
|
|
2249
|
+
icon = /*#__PURE__*/React.createElement(AiFillCaretDown, null);
|
|
2250
|
+
break;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
case 'caret-up':
|
|
2254
|
+
{
|
|
2255
|
+
icon = /*#__PURE__*/React.createElement(AiFillCaretUp, null);
|
|
2256
|
+
break;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2178
2259
|
case 'react-autoql-bubbles':
|
|
2179
2260
|
{
|
|
2180
2261
|
icon = /*#__PURE__*/React.createElement("img", {
|
|
@@ -2723,12 +2804,37 @@ var runQueryOnly = function runQueryOnly() {
|
|
|
2723
2804
|
|
|
2724
2805
|
var url = "".concat(domain, "/autoql/api/v1/query?key=").concat(apiKey);
|
|
2725
2806
|
var finalUserSelection = transformUserSelection(userSelection);
|
|
2807
|
+
var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
|
|
2808
|
+
var conditions = {};
|
|
2809
|
+
|
|
2810
|
+
if (sessionConditions !== null) {
|
|
2811
|
+
var _loop = function _loop(i) {
|
|
2812
|
+
if (Object.keys(conditions).some(function (item) {
|
|
2813
|
+
return item === sessionConditions[i].key;
|
|
2814
|
+
})) {
|
|
2815
|
+
item = Object.keys(conditions).find(function (key) {
|
|
2816
|
+
return key === sessionConditions[i].key;
|
|
2817
|
+
});
|
|
2818
|
+
conditions[item].push(sessionConditions[i].value);
|
|
2819
|
+
} else {
|
|
2820
|
+
conditions[sessionConditions[i].key] = [sessionConditions[i].value];
|
|
2821
|
+
}
|
|
2822
|
+
};
|
|
2823
|
+
|
|
2824
|
+
for (var i = 0; i < sessionConditions.length; i++) {
|
|
2825
|
+
var item;
|
|
2826
|
+
|
|
2827
|
+
_loop(i);
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2726
2831
|
var data = {
|
|
2727
2832
|
text: query,
|
|
2728
2833
|
source: formatSourceString(source),
|
|
2729
2834
|
translation: debug ? 'include' : 'exclude',
|
|
2730
2835
|
user_selection: finalUserSelection,
|
|
2731
|
-
test: test
|
|
2836
|
+
test: test,
|
|
2837
|
+
session_locked_conditions: conditions
|
|
2732
2838
|
};
|
|
2733
2839
|
|
|
2734
2840
|
if (!query || !query.trim()) {
|
|
@@ -2993,10 +3099,9 @@ var fetchConditions = function fetchConditions() {
|
|
|
2993
3099
|
token = _ref10.token,
|
|
2994
3100
|
domain = _ref10.domain;
|
|
2995
3101
|
|
|
2996
|
-
if (!domain || !apiKey || !token) {
|
|
2997
|
-
|
|
2998
|
-
}
|
|
2999
|
-
|
|
3102
|
+
// if (!domain || !apiKey || !token) {
|
|
3103
|
+
// return Promise.reject(new Error('Unauthenticated'))
|
|
3104
|
+
// }
|
|
3000
3105
|
var url = "".concat(domain, "/autoql/api/v1/query/condition-locking?key=").concat(apiKey);
|
|
3001
3106
|
var config = {
|
|
3002
3107
|
headers: {
|
|
@@ -3032,8 +3137,7 @@ var setConditions = function setConditions() {
|
|
|
3032
3137
|
array.push({
|
|
3033
3138
|
key: obj.key,
|
|
3034
3139
|
keyword: obj.keyword,
|
|
3035
|
-
|
|
3036
|
-
lock_flag: 1,
|
|
3140
|
+
lock_flag: obj.lock_flag,
|
|
3037
3141
|
show_message: obj.show_message,
|
|
3038
3142
|
value: obj.value
|
|
3039
3143
|
});
|
|
@@ -3306,15 +3410,24 @@ _defineProperty(Dictaphone, "defaultProps", {});
|
|
|
3306
3410
|
|
|
3307
3411
|
var SpeechToTextButtonBrowser = SpeechRecognition(options$1)(Dictaphone);
|
|
3308
3412
|
|
|
3309
|
-
|
|
3310
|
-
|
|
3413
|
+
function LoadingDots() {
|
|
3414
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3415
|
+
className: "response-loading",
|
|
3416
|
+
"data-test": "loading-dots"
|
|
3417
|
+
}, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null));
|
|
3418
|
+
}
|
|
3311
3419
|
|
|
3312
|
-
|
|
3420
|
+
var autoCompleteArray$2 = [];
|
|
3313
3421
|
|
|
3314
|
-
|
|
3422
|
+
var QueryInput = /*#__PURE__*/function (_React$Component) {
|
|
3423
|
+
_inherits(QueryInput, _React$Component);
|
|
3424
|
+
|
|
3425
|
+
var _super = _createSuper(QueryInput);
|
|
3426
|
+
|
|
3427
|
+
function QueryInput() {
|
|
3315
3428
|
var _this;
|
|
3316
3429
|
|
|
3317
|
-
_classCallCheck(this,
|
|
3430
|
+
_classCallCheck(this, QueryInput);
|
|
3318
3431
|
|
|
3319
3432
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3320
3433
|
args[_key] = arguments[_key];
|
|
@@ -3322,14 +3435,15 @@ var SpeechToTextBtn = /*#__PURE__*/function (_React$Component) {
|
|
|
3322
3435
|
|
|
3323
3436
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
3324
3437
|
|
|
3438
|
+
_defineProperty(_assertThisInitialized(_this), "UNIQUE_ID", uuid.v4());
|
|
3439
|
+
|
|
3440
|
+
_defineProperty(_assertThisInitialized(_this), "autoCompleteTimer", undefined);
|
|
3441
|
+
|
|
3325
3442
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
currentBlob: '',
|
|
3331
|
-
showPopoverMessage: false,
|
|
3332
|
-
errorMessage: ''
|
|
3443
|
+
inputValue: '',
|
|
3444
|
+
lastQuery: '',
|
|
3445
|
+
suggestions: [],
|
|
3446
|
+
isQueryRunning: false
|
|
3333
3447
|
});
|
|
3334
3448
|
|
|
3335
3449
|
_defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
|
|
@@ -3337,323 +3451,109 @@ var SpeechToTextBtn = /*#__PURE__*/function (_React$Component) {
|
|
|
3337
3451
|
});
|
|
3338
3452
|
|
|
3339
3453
|
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps) {
|
|
3340
|
-
if (_this.props.
|
|
3341
|
-
|
|
3342
|
-
} else if (_this.props.transcript !== prevProps.transcript) {
|
|
3343
|
-
_this.props.onTranscriptChange(_this.props.transcript);
|
|
3344
|
-
} else if (_this.props.interimTranscript !== prevProps.interimTranscript) {
|
|
3345
|
-
_this.props.onTranscriptChange(_this.props.interimTranscript);
|
|
3454
|
+
if (!_isEqual(getThemeConfig(_this.props.themeConfig), getThemeConfig(prevProps.themeConfig))) {
|
|
3455
|
+
setCSSVars(getThemeConfig(_this.props.themeConfig));
|
|
3346
3456
|
}
|
|
3347
3457
|
});
|
|
3348
3458
|
|
|
3349
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
3350
|
-
_this.
|
|
3351
|
-
|
|
3352
|
-
}
|
|
3353
|
-
|
|
3354
|
-
navigator.getUserMedia({
|
|
3355
|
-
audio: true
|
|
3356
|
-
}, function (stream) {
|
|
3357
|
-
_this.stream = stream;
|
|
3358
|
-
_this.recordAudio = RecordRTC(_this.stream, {
|
|
3359
|
-
type: 'audio',
|
|
3360
|
-
mimeType: 'audio/webm',
|
|
3361
|
-
desiredSampRate: 16000,
|
|
3362
|
-
recorderType: StereoAudioRecorder,
|
|
3363
|
-
numberOfAudioChannels: 1
|
|
3364
|
-
});
|
|
3365
|
-
|
|
3366
|
-
_this.recordAudio.startRecording();
|
|
3367
|
-
}, function (error) {
|
|
3368
|
-
console.error(JSON.stringify(error));
|
|
3369
|
-
});
|
|
3370
|
-
});
|
|
3371
|
-
|
|
3372
|
-
_defineProperty(_assertThisInitialized(_this), "onRecordStop", function (file, blob) {
|
|
3373
|
-
_this.setState({
|
|
3374
|
-
// isConfirmingRecording: true,
|
|
3375
|
-
currentFile: file,
|
|
3376
|
-
currentBlob: blob //hasPlayedBack: false,
|
|
3459
|
+
_defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
|
|
3460
|
+
if (_this.autoCompleteTimer) {
|
|
3461
|
+
clearTimeout(_this.autoCompleteTimer);
|
|
3462
|
+
}
|
|
3377
3463
|
|
|
3378
|
-
|
|
3379
|
-
_this.
|
|
3380
|
-
}
|
|
3464
|
+
if (_this.queryValidationTimer) {
|
|
3465
|
+
clearTimeout(_this.queryValidationTimer);
|
|
3466
|
+
}
|
|
3381
3467
|
});
|
|
3382
3468
|
|
|
3383
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3469
|
+
_defineProperty(_assertThisInitialized(_this), "animateInputTextAndSubmit", function (_ref) {
|
|
3470
|
+
var query = _ref.query,
|
|
3471
|
+
userSelection = _ref.userSelection;
|
|
3472
|
+
_ref.skipQueryValidation;
|
|
3473
|
+
var source = _ref.source;
|
|
3387
3474
|
|
|
3388
|
-
|
|
3389
|
-
var
|
|
3475
|
+
if (typeof query === 'string' && _get(query, 'length')) {
|
|
3476
|
+
var _loop = function _loop(i) {
|
|
3477
|
+
setTimeout(function () {
|
|
3478
|
+
_this.setState({
|
|
3479
|
+
inputValue: query.slice(0, i)
|
|
3480
|
+
});
|
|
3390
3481
|
|
|
3391
|
-
|
|
3482
|
+
if (i === query.length) {
|
|
3483
|
+
setTimeout(function () {
|
|
3484
|
+
_this.submitQuery({
|
|
3485
|
+
queryText: query,
|
|
3486
|
+
userSelection: userSelection,
|
|
3487
|
+
skipQueryValidation: true,
|
|
3488
|
+
source: source
|
|
3489
|
+
});
|
|
3490
|
+
}, 300);
|
|
3491
|
+
}
|
|
3492
|
+
}, i * 50);
|
|
3493
|
+
};
|
|
3392
3494
|
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
return track.stop();
|
|
3396
|
-
});
|
|
3397
|
-
} catch (error) {
|
|
3398
|
-
console.error(error);
|
|
3495
|
+
for (var i = 1; i <= query.length; i++) {
|
|
3496
|
+
_loop(i);
|
|
3399
3497
|
}
|
|
3400
|
-
}
|
|
3498
|
+
}
|
|
3401
3499
|
});
|
|
3402
3500
|
|
|
3403
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3501
|
+
_defineProperty(_assertThisInitialized(_this), "submitQuery", function () {
|
|
3502
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
3503
|
+
queryText = _ref2.queryText,
|
|
3504
|
+
userSelection = _ref2.userSelection,
|
|
3505
|
+
skipQueryValidation = _ref2.skipQueryValidation,
|
|
3506
|
+
source = _ref2.source;
|
|
3409
3507
|
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
}
|
|
3414
|
-
|
|
3508
|
+
// Cancel subscription to autocomplete since query was already submitted
|
|
3509
|
+
if (_this.autoCompleteTimer) {
|
|
3510
|
+
clearTimeout(_this.autoCompleteTimer);
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3513
|
+
_this.setState({
|
|
3514
|
+
isQueryRunning: true,
|
|
3515
|
+
inputValue: '',
|
|
3516
|
+
suggestions: [],
|
|
3517
|
+
queryValidationResponse: undefined,
|
|
3518
|
+
queryValidationComponentId: uuid.v4()
|
|
3415
3519
|
});
|
|
3416
|
-
});
|
|
3417
3520
|
|
|
3418
|
-
|
|
3419
|
-
|
|
3521
|
+
var query = queryText || _this.state.inputValue;
|
|
3522
|
+
var newSource = [].concat(_toConsumableArray(_this.props.source), [source || 'user']);
|
|
3420
3523
|
|
|
3421
|
-
|
|
3422
|
-
|
|
3524
|
+
if (query.trim()) {
|
|
3525
|
+
_this.props.onSubmit(query);
|
|
3526
|
+
|
|
3527
|
+
if (skipQueryValidation) {
|
|
3528
|
+
runQueryOnly(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
3529
|
+
query: query,
|
|
3530
|
+
userSelection: userSelection
|
|
3531
|
+
}, getAuthentication(_this.props.authentication)), getAutoQLConfig$1(_this.props.autoQLConfig)), {}, {
|
|
3532
|
+
source: newSource,
|
|
3533
|
+
AutoAEId: _this.props.AutoAEId
|
|
3534
|
+
})).then(function (response) {
|
|
3535
|
+
_this.props.onResponseCallback(response, query);
|
|
3423
3536
|
|
|
3424
|
-
_defineProperty(_assertThisInitialized(_this), "sendWavFile", function (file) {
|
|
3425
|
-
var url = "".concat(_this.props.authentication.domain, "/autoql/api/v1/query/speech-to-text?key=").concat(_this.props.authentication.apiKey);
|
|
3426
|
-
var data = new FormData();
|
|
3427
|
-
data.append('file', file, 'speech.wav');
|
|
3428
|
-
var config = {
|
|
3429
|
-
headers: {
|
|
3430
|
-
Authorization: "Bearer ".concat(_this.props.authentication.token)
|
|
3431
|
-
},
|
|
3432
|
-
timeout: 30000
|
|
3433
|
-
};
|
|
3434
|
-
axios.post(url, data, config).then(function (res) {
|
|
3435
|
-
_this.props.onTranscriptChange(res.data.data.transcription);
|
|
3436
|
-
}).catch(function (error) {
|
|
3437
|
-
if (error.response.status === 404) {
|
|
3438
|
-
_this.setState({
|
|
3439
|
-
errorMessage: 'Oops! Speech-to-text has not been enabled. Try typing a query instead.'
|
|
3440
|
-
}, function () {
|
|
3441
3537
|
_this.setState({
|
|
3442
|
-
|
|
3538
|
+
isQueryRunning: false
|
|
3443
3539
|
});
|
|
3444
|
-
})
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3540
|
+
}).catch(function (error) {
|
|
3541
|
+
console.error(error);
|
|
3542
|
+
|
|
3543
|
+
_this.props.onResponseCallback(error);
|
|
3544
|
+
|
|
3449
3545
|
_this.setState({
|
|
3450
|
-
|
|
3546
|
+
isQueryRunning: false
|
|
3451
3547
|
});
|
|
3452
3548
|
});
|
|
3453
|
-
}
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
content: function content() {
|
|
3462
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
3463
|
-
style: {
|
|
3464
|
-
backgroundColor: '#FFD2D2',
|
|
3465
|
-
opacity: 1,
|
|
3466
|
-
paddingLeft: '10px',
|
|
3467
|
-
paddingRight: '10px'
|
|
3468
|
-
}
|
|
3469
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
3470
|
-
type: "warning-triangle"
|
|
3471
|
-
}), " ", _this.state.errorMessage);
|
|
3472
|
-
},
|
|
3473
|
-
onClickOutside: function onClickOutside() {
|
|
3474
|
-
return _this.setState({
|
|
3475
|
-
showPopoverMessage: false
|
|
3476
|
-
});
|
|
3477
|
-
}
|
|
3478
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
3479
|
-
id: "react-autoql-voice-record-button",
|
|
3480
|
-
"data-test": "speech-to-text-btn",
|
|
3481
|
-
className: "chat-voice-record-button".concat(_this.state.isRecording ? ' listening' : ''),
|
|
3482
|
-
onMouseDown: _this.onMouseDown,
|
|
3483
|
-
onMouseUp: _this.stopRecording,
|
|
3484
|
-
onMouseLeave: _this.state.isRecording ? _this.stopRecording : undefined,
|
|
3485
|
-
"data-tip": "Hold for voice-to-text",
|
|
3486
|
-
"data-for": "react-autoql-speech-to-text-tooltip",
|
|
3487
|
-
"data-tip-disable": _this.state.isRecording
|
|
3488
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
3489
|
-
type: "microphone"
|
|
3490
|
-
}))), /*#__PURE__*/React.createElement(ReactTooltip, {
|
|
3491
|
-
className: "react-autoql-tooltip",
|
|
3492
|
-
id: "react-autoql-speech-to-text-tooltip",
|
|
3493
|
-
effect: "solid",
|
|
3494
|
-
delayShow: 800
|
|
3495
|
-
}));
|
|
3496
|
-
});
|
|
3497
|
-
|
|
3498
|
-
return _this;
|
|
3499
|
-
}
|
|
3500
|
-
|
|
3501
|
-
return SpeechToTextBtn;
|
|
3502
|
-
}(React.Component);
|
|
3503
|
-
|
|
3504
|
-
_defineProperty(SpeechToTextBtn, "propTypes", {
|
|
3505
|
-
authentication: authenticationType,
|
|
3506
|
-
themeConfig: themeConfigType,
|
|
3507
|
-
transcript: PropTypes.string,
|
|
3508
|
-
interimTranscript: PropTypes.string,
|
|
3509
|
-
finalTranscript: PropTypes.string,
|
|
3510
|
-
resetTranscript: PropTypes.func,
|
|
3511
|
-
onTranscriptChange: PropTypes.func,
|
|
3512
|
-
onFinalTranscript: PropTypes.func
|
|
3513
|
-
});
|
|
3514
|
-
|
|
3515
|
-
_defineProperty(SpeechToTextBtn, "defaultProps", {
|
|
3516
|
-
authentication: authenticationDefault,
|
|
3517
|
-
themeConfig: themeConfigDefault
|
|
3518
|
-
});
|
|
3519
|
-
|
|
3520
|
-
function LoadingDots() {
|
|
3521
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
3522
|
-
className: "response-loading",
|
|
3523
|
-
"data-test": "loading-dots"
|
|
3524
|
-
}, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null));
|
|
3525
|
-
}
|
|
3526
|
-
|
|
3527
|
-
var autoCompleteArray$2 = [];
|
|
3528
|
-
|
|
3529
|
-
var QueryInput = /*#__PURE__*/function (_React$Component) {
|
|
3530
|
-
_inherits(QueryInput, _React$Component);
|
|
3531
|
-
|
|
3532
|
-
var _super = _createSuper(QueryInput);
|
|
3533
|
-
|
|
3534
|
-
function QueryInput() {
|
|
3535
|
-
var _this;
|
|
3536
|
-
|
|
3537
|
-
_classCallCheck(this, QueryInput);
|
|
3538
|
-
|
|
3539
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3540
|
-
args[_key] = arguments[_key];
|
|
3541
|
-
}
|
|
3542
|
-
|
|
3543
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
3544
|
-
|
|
3545
|
-
_defineProperty(_assertThisInitialized(_this), "UNIQUE_ID", uuid.v4());
|
|
3546
|
-
|
|
3547
|
-
_defineProperty(_assertThisInitialized(_this), "autoCompleteTimer", undefined);
|
|
3548
|
-
|
|
3549
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
3550
|
-
inputValue: '',
|
|
3551
|
-
lastQuery: '',
|
|
3552
|
-
suggestions: [],
|
|
3553
|
-
isQueryRunning: false
|
|
3554
|
-
});
|
|
3555
|
-
|
|
3556
|
-
_defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
|
|
3557
|
-
setCSSVars(getThemeConfig(_this.props.themeConfig));
|
|
3558
|
-
});
|
|
3559
|
-
|
|
3560
|
-
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps) {
|
|
3561
|
-
if (!_isEqual(getThemeConfig(_this.props.themeConfig), getThemeConfig(prevProps.themeConfig))) {
|
|
3562
|
-
setCSSVars(getThemeConfig(_this.props.themeConfig));
|
|
3563
|
-
}
|
|
3564
|
-
});
|
|
3565
|
-
|
|
3566
|
-
_defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
|
|
3567
|
-
if (_this.autoCompleteTimer) {
|
|
3568
|
-
clearTimeout(_this.autoCompleteTimer);
|
|
3569
|
-
}
|
|
3570
|
-
});
|
|
3571
|
-
|
|
3572
|
-
_defineProperty(_assertThisInitialized(_this), "animateInputTextAndSubmit", function (_ref) {
|
|
3573
|
-
var query = _ref.query,
|
|
3574
|
-
userSelection = _ref.userSelection;
|
|
3575
|
-
_ref.skipQueryValidation;
|
|
3576
|
-
var source = _ref.source;
|
|
3577
|
-
|
|
3578
|
-
if (typeof query === 'string' && _get(query, 'length')) {
|
|
3579
|
-
var _loop = function _loop(i) {
|
|
3580
|
-
setTimeout(function () {
|
|
3581
|
-
_this.setState({
|
|
3582
|
-
inputValue: query.slice(0, i)
|
|
3583
|
-
});
|
|
3584
|
-
|
|
3585
|
-
if (i === query.length) {
|
|
3586
|
-
setTimeout(function () {
|
|
3587
|
-
_this.submitQuery({
|
|
3588
|
-
queryText: query,
|
|
3589
|
-
userSelection: userSelection,
|
|
3590
|
-
skipQueryValidation: true,
|
|
3591
|
-
source: source
|
|
3592
|
-
});
|
|
3593
|
-
}, 300);
|
|
3594
|
-
}
|
|
3595
|
-
}, i * 50);
|
|
3596
|
-
};
|
|
3597
|
-
|
|
3598
|
-
for (var i = 1; i <= query.length; i++) {
|
|
3599
|
-
_loop(i);
|
|
3600
|
-
}
|
|
3601
|
-
}
|
|
3602
|
-
});
|
|
3603
|
-
|
|
3604
|
-
_defineProperty(_assertThisInitialized(_this), "submitQuery", function () {
|
|
3605
|
-
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
3606
|
-
queryText = _ref2.queryText,
|
|
3607
|
-
userSelection = _ref2.userSelection,
|
|
3608
|
-
skipQueryValidation = _ref2.skipQueryValidation,
|
|
3609
|
-
source = _ref2.source;
|
|
3610
|
-
|
|
3611
|
-
// Cancel subscription to autocomplete since query was already submitted
|
|
3612
|
-
if (_this.autoCompleteTimer) {
|
|
3613
|
-
clearTimeout(_this.autoCompleteTimer);
|
|
3614
|
-
}
|
|
3615
|
-
|
|
3616
|
-
var query = queryText || _this.state.inputValue;
|
|
3617
|
-
var newSource = [].concat(_toConsumableArray(_this.props.source), [source || 'user']);
|
|
3618
|
-
|
|
3619
|
-
_this.setState({
|
|
3620
|
-
isQueryRunning: true,
|
|
3621
|
-
inputValue: ''
|
|
3622
|
-
});
|
|
3623
|
-
|
|
3624
|
-
if (query.trim()) {
|
|
3625
|
-
_this.props.onSubmit(query);
|
|
3626
|
-
|
|
3627
|
-
if (skipQueryValidation) {
|
|
3628
|
-
runQueryOnly(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
3629
|
-
query: query,
|
|
3630
|
-
userSelection: userSelection
|
|
3631
|
-
}, getAuthentication(_this.props.authentication)), getAutoQLConfig$1(_this.props.autoQLConfig)), {}, {
|
|
3632
|
-
source: newSource,
|
|
3633
|
-
AutoAEId: _this.props.AutoAEId
|
|
3634
|
-
})).then(function (response) {
|
|
3635
|
-
_this.props.onResponseCallback(response, query);
|
|
3636
|
-
|
|
3637
|
-
_this.setState({
|
|
3638
|
-
isQueryRunning: false
|
|
3639
|
-
});
|
|
3640
|
-
}).catch(function (error) {
|
|
3641
|
-
console.error(error);
|
|
3642
|
-
|
|
3643
|
-
_this.props.onResponseCallback(error);
|
|
3644
|
-
|
|
3645
|
-
_this.setState({
|
|
3646
|
-
isQueryRunning: false
|
|
3647
|
-
});
|
|
3648
|
-
});
|
|
3649
|
-
} else {
|
|
3650
|
-
runQuery(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
3651
|
-
query: query
|
|
3652
|
-
}, getAuthentication(_this.props.authentication)), getAutoQLConfig$1(_this.props.autoQLConfig)), {}, {
|
|
3653
|
-
source: newSource,
|
|
3654
|
-
AutoAEId: _this.props.AutoAEId
|
|
3655
|
-
})).then(function (response) {
|
|
3656
|
-
_this.props.onResponseCallback(response, query);
|
|
3549
|
+
} else {
|
|
3550
|
+
runQuery(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
3551
|
+
query: query
|
|
3552
|
+
}, getAuthentication(_this.props.authentication)), getAutoQLConfig$1(_this.props.autoQLConfig)), {}, {
|
|
3553
|
+
source: newSource,
|
|
3554
|
+
AutoAEId: _this.props.AutoAEId
|
|
3555
|
+
})).then(function (response) {
|
|
3556
|
+
_this.props.onResponseCallback(response, query);
|
|
3657
3557
|
|
|
3658
3558
|
_this.setState({
|
|
3659
3559
|
isQueryRunning: false
|
|
@@ -3713,6 +3613,9 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
|
|
|
3713
3613
|
});
|
|
3714
3614
|
|
|
3715
3615
|
_defineProperty(_assertThisInitialized(_this), "focus", function () {
|
|
3616
|
+
// if (this.queryValidationInputRef) {
|
|
3617
|
+
// this.queryValidationInputRef.focus()
|
|
3618
|
+
// }
|
|
3716
3619
|
if (_this.inputRef) {
|
|
3717
3620
|
_this.inputRef.focus();
|
|
3718
3621
|
} else {
|
|
@@ -3735,8 +3638,37 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
|
|
|
3735
3638
|
}
|
|
3736
3639
|
});
|
|
3737
3640
|
|
|
3738
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
3739
|
-
var
|
|
3641
|
+
_defineProperty(_assertThisInitialized(_this), "runQueryValidation", function (_ref3) {
|
|
3642
|
+
var text = _ref3.text;
|
|
3643
|
+
|
|
3644
|
+
// Reset validation configuration since text has changed
|
|
3645
|
+
_this.setState({
|
|
3646
|
+
queryValidationResponse: undefined,
|
|
3647
|
+
queryValidationComponentId: uuid.v4()
|
|
3648
|
+
});
|
|
3649
|
+
|
|
3650
|
+
if (_this.queryValidationTimer) {
|
|
3651
|
+
clearTimeout(_this.queryValidationTimer);
|
|
3652
|
+
}
|
|
3653
|
+
|
|
3654
|
+
_this.queryValidationTimer = setTimeout(function () {
|
|
3655
|
+
runQueryValidation(_objectSpread2({
|
|
3656
|
+
text: text
|
|
3657
|
+
}, getAuthentication(_this.props.authentication))).then(function (response) {
|
|
3658
|
+
if (_this.state.inputValue === _get(response, 'data.data.query')) {
|
|
3659
|
+
_this.setState({
|
|
3660
|
+
queryValidationResponse: response,
|
|
3661
|
+
queryValidationComponentId: uuid.v4()
|
|
3662
|
+
});
|
|
3663
|
+
}
|
|
3664
|
+
}).catch(function (error) {
|
|
3665
|
+
console.error(error);
|
|
3666
|
+
});
|
|
3667
|
+
}, 300);
|
|
3668
|
+
});
|
|
3669
|
+
|
|
3670
|
+
_defineProperty(_assertThisInitialized(_this), "onSuggestionsFetchRequested", function (_ref4) {
|
|
3671
|
+
var value = _ref4.value;
|
|
3740
3672
|
|
|
3741
3673
|
if (_this.autoCompleteTimer) {
|
|
3742
3674
|
clearTimeout(_this.autoCompleteTimer);
|
|
@@ -3788,6 +3720,8 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
|
|
|
3788
3720
|
});
|
|
3789
3721
|
|
|
3790
3722
|
_defineProperty(_assertThisInitialized(_this), "onInputChange", function (e) {
|
|
3723
|
+
//WIP
|
|
3724
|
+
// this.runQueryValidation({ text: e.target.value })
|
|
3791
3725
|
if (_this.userSelectedSuggestion && (e.keyCode === 38 || e.keyCode === 40)) {
|
|
3792
3726
|
// keyup or keydown
|
|
3793
3727
|
return; // return to let the component handle it...
|
|
@@ -3815,14 +3749,16 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
|
|
|
3815
3749
|
return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("div", {
|
|
3816
3750
|
className: "react-autoql-bar-container ".concat(_this.props.className, " ").concat(_this.props.autoCompletePlacement === 'below' ? 'autosuggest-bottom' : 'autosuggest-top'),
|
|
3817
3751
|
"data-test": "chat-bar"
|
|
3752
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3753
|
+
className: "react-autoql-chatbar-input-container"
|
|
3818
3754
|
}, getAutoQLConfig$1(_this.props.autoQLConfig).enableAutocomplete ? /*#__PURE__*/React.createElement(Autosuggest, {
|
|
3819
|
-
|
|
3755
|
+
lassName: "auto-complete-chata",
|
|
3820
3756
|
onSuggestionsFetchRequested: _this.onSuggestionsFetchRequested,
|
|
3821
3757
|
onSuggestionsClearRequested: _this.onSuggestionsClearRequested,
|
|
3822
3758
|
getSuggestionValue: _this.userSelectedSuggestionHandler,
|
|
3823
3759
|
suggestions: _this.state.suggestions,
|
|
3824
|
-
ref: function ref(
|
|
3825
|
-
_this.autoSuggest =
|
|
3760
|
+
ref: function ref(_ref5) {
|
|
3761
|
+
_this.autoSuggest = _ref5;
|
|
3826
3762
|
},
|
|
3827
3763
|
renderSuggestion: function renderSuggestion(suggestion) {
|
|
3828
3764
|
return /*#__PURE__*/React.createElement(Fragment, null, suggestion.name);
|
|
@@ -3838,9 +3774,24 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
|
|
|
3838
3774
|
onFocus: _this.moveCaretAtEnd,
|
|
3839
3775
|
autoFocus: true
|
|
3840
3776
|
}
|
|
3841
|
-
})
|
|
3842
|
-
|
|
3843
|
-
}
|
|
3777
|
+
}) // <QueryInputWithValidation
|
|
3778
|
+
// authentication={getAuthentication(this.props.authentication)}
|
|
3779
|
+
// themeConfig={getThemeConfig(this.props.themeConfig)}
|
|
3780
|
+
// ref={(ref) => (this.queryValidationInputRef = ref)}
|
|
3781
|
+
// key={this.state.queryValidationComponentId}
|
|
3782
|
+
// response={this.state.queryValidationResponse}
|
|
3783
|
+
// placeholder={this.props.placeholder}
|
|
3784
|
+
// disabled={this.props.isDisabled}
|
|
3785
|
+
// showChataIcon={this.props.showChataIcon}
|
|
3786
|
+
// showLoadingDots={this.props.showLoadingDots}
|
|
3787
|
+
// submitQuery={this.submitQuery}
|
|
3788
|
+
// onKeyDown={this.onKeyDown}
|
|
3789
|
+
// onQueryValidationSelectOption={(query) => {
|
|
3790
|
+
// this.setState({ inputValue: query })
|
|
3791
|
+
// this.focus()
|
|
3792
|
+
// }}
|
|
3793
|
+
// />
|
|
3794
|
+
: /*#__PURE__*/React.createElement("input", {
|
|
3844
3795
|
className: "react-autoql-chatbar-input".concat(_this.props.showChataIcon ? ' left-padding' : ''),
|
|
3845
3796
|
placeholder: _this.props.placeholder || 'Type your queries here',
|
|
3846
3797
|
value: _this.state.inputValue,
|
|
@@ -3862,12 +3813,21 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
|
|
|
3862
3813
|
type: "react-autoql-bubbles-outlined"
|
|
3863
3814
|
})), _this.props.showLoadingDots && _this.state.isQueryRunning && /*#__PURE__*/React.createElement("div", {
|
|
3864
3815
|
className: "input-response-loading-container"
|
|
3865
|
-
}, /*#__PURE__*/React.createElement(LoadingDots, null)), _this.props.enableVoiceRecord &&
|
|
3816
|
+
}, /*#__PURE__*/React.createElement(LoadingDots, null)), _this.props.enableVoiceRecord &&
|
|
3817
|
+
/*#__PURE__*/
|
|
3818
|
+
// KEEP THIS FOR NOW
|
|
3819
|
+
// <SpeechToTextBtn
|
|
3820
|
+
// onTranscriptChange={this.onTranscriptChange}
|
|
3821
|
+
// onFinalTranscript={this.onFinalTranscript}
|
|
3822
|
+
// themeConfig={this.props.themeConfig}
|
|
3823
|
+
// authentication={getAuthentication(this.props.authentication)}
|
|
3824
|
+
// />
|
|
3825
|
+
React.createElement(SpeechToTextButtonBrowser, {
|
|
3866
3826
|
onTranscriptChange: _this.onTranscriptChange,
|
|
3867
3827
|
onFinalTranscript: _this.onFinalTranscript,
|
|
3868
3828
|
themeConfig: _this.props.themeConfig,
|
|
3869
3829
|
authentication: getAuthentication(_this.props.authentication)
|
|
3870
|
-
})))
|
|
3830
|
+
})));
|
|
3871
3831
|
});
|
|
3872
3832
|
|
|
3873
3833
|
return _this;
|
|
@@ -3993,7 +3953,7 @@ var ChataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
3993
3953
|
_defineProperty(_assertThisInitialized(_this), "saveAsCSV", function () {
|
|
3994
3954
|
if (_this.ref && _this.ref.table) {
|
|
3995
3955
|
_this.ref.table.download('csv', 'table.csv', {
|
|
3996
|
-
delimiter: '
|
|
3956
|
+
delimiter: ','
|
|
3997
3957
|
});
|
|
3998
3958
|
}
|
|
3999
3959
|
});
|
|
@@ -4061,7 +4021,7 @@ var ChataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
4061
4021
|
options: options,
|
|
4062
4022
|
"data-custom-attr": "test-custom-attribute",
|
|
4063
4023
|
className: "react-autoql-table",
|
|
4064
|
-
height: "
|
|
4024
|
+
height: "98%",
|
|
4065
4025
|
clipboard: true,
|
|
4066
4026
|
download: true
|
|
4067
4027
|
})));
|
|
@@ -7516,6 +7476,7 @@ var Button = /*#__PURE__*/function (_React$Component) {
|
|
|
7516
7476
|
return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("button", {
|
|
7517
7477
|
className: "react-autoql-btn\n ".concat(_this.props.className || '', "\n ").concat(type, "\n ").concat(size, "\n ").concat(isDisabled ? ' disabled' : ''),
|
|
7518
7478
|
"data-test": "react-autoql-btn",
|
|
7479
|
+
"data-multiline": _this.props.multiline,
|
|
7519
7480
|
style: _objectSpread2({}, _this.props.style),
|
|
7520
7481
|
onClick: _this.props.onClick,
|
|
7521
7482
|
"data-tip": _this.props.tooltip,
|
|
@@ -7543,6 +7504,7 @@ _defineProperty(Button, "propTypes", {
|
|
|
7543
7504
|
onClick: PropTypes.func,
|
|
7544
7505
|
loading: PropTypes.bool,
|
|
7545
7506
|
disabled: PropTypes.bool,
|
|
7507
|
+
multiline: PropTypes.bool,
|
|
7546
7508
|
tooltip: PropTypes.string
|
|
7547
7509
|
});
|
|
7548
7510
|
|
|
@@ -7551,6 +7513,7 @@ _defineProperty(Button, "defaultProps", {
|
|
|
7551
7513
|
loading: false,
|
|
7552
7514
|
size: 'large',
|
|
7553
7515
|
disabled: false,
|
|
7516
|
+
multiline: false,
|
|
7554
7517
|
tooltip: undefined,
|
|
7555
7518
|
onClick: function onClick() {}
|
|
7556
7519
|
});
|
|
@@ -7932,6 +7895,10 @@ var ChataChart = /*#__PURE__*/function (_Component) {
|
|
|
7932
7895
|
_this.updateMargins();
|
|
7933
7896
|
}
|
|
7934
7897
|
|
|
7898
|
+
if (!_isEqual(_this.props.isShowingInterpretation, prevProps.isShowingInterpretation)) {
|
|
7899
|
+
_this.updateMargins();
|
|
7900
|
+
}
|
|
7901
|
+
|
|
7935
7902
|
if (_this.props.type && _this.props.type !== prevProps.type && _this.props.type !== 'pie') {
|
|
7936
7903
|
_this.updateMargins();
|
|
7937
7904
|
|
|
@@ -9235,14 +9202,15 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
|
|
|
9235
9202
|
|
|
9236
9203
|
_defineProperty(_assertThisInitialized(_this), "supportedDisplayTypes", []);
|
|
9237
9204
|
|
|
9238
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
9205
|
+
_defineProperty(_assertThisInitialized(_this), "QUERY_VALIDATION_KEY", uuid.v4());
|
|
9239
9206
|
|
|
9240
9207
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
9241
9208
|
displayType: null,
|
|
9242
9209
|
tableFilters: [],
|
|
9243
9210
|
suggestionSelection: _this.props.selectedSuggestion,
|
|
9244
9211
|
QandAResponseCorrect: false,
|
|
9245
|
-
QandASuggestions: []
|
|
9212
|
+
QandASuggestions: [],
|
|
9213
|
+
isShowingInterpretation: false
|
|
9246
9214
|
});
|
|
9247
9215
|
|
|
9248
9216
|
_defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
|
|
@@ -9264,6 +9232,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
|
|
|
9264
9232
|
|
|
9265
9233
|
|
|
9266
9234
|
_this.setState({
|
|
9235
|
+
isShowingInterpretation: getAutoQLConfig$1(_this.props.autoQLConfig).defaultShowInterpretation,
|
|
9267
9236
|
displayType: isDisplayTypeValid(_this.props.queryResponse, _this.props.displayType) ? _this.props.displayType : getDefaultDisplayType(_this.props.queryResponse, _this.props.autoChartAggregations)
|
|
9268
9237
|
});
|
|
9269
9238
|
|
|
@@ -9339,6 +9308,10 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
|
|
|
9339
9308
|
disableScroll.off();
|
|
9340
9309
|
}
|
|
9341
9310
|
|
|
9311
|
+
if (prevState.isShowingInterpretation !== _this.state.isShowingInterpretation) {
|
|
9312
|
+
_this.forceUpdate();
|
|
9313
|
+
}
|
|
9314
|
+
|
|
9342
9315
|
if (_this.props.optionsToolbarRef) {
|
|
9343
9316
|
_this.props.optionsToolbarRef._isMounted && _this.props.optionsToolbarRef.forceUpdate();
|
|
9344
9317
|
}
|
|
@@ -10260,11 +10233,22 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
|
|
|
10260
10233
|
}
|
|
10261
10234
|
|
|
10262
10235
|
var formattedColumns = columns.map(function (col, i) {
|
|
10236
|
+
/**
|
|
10237
|
+
* EDIT:
|
|
10238
|
+
* We no longer want to default to one over the other. Howeever,
|
|
10239
|
+
* I would like to hang onto this code for now incase we do want to
|
|
10240
|
+
* include either/or in some cases in the future
|
|
10241
|
+
*/
|
|
10263
10242
|
// Regardless of the BE response, we want to default to percent
|
|
10264
|
-
if (
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10243
|
+
// if (
|
|
10244
|
+
// (col.type === 'RATIO' || col.type === 'NUMBER') &&
|
|
10245
|
+
// _get(
|
|
10246
|
+
// getDataFormatting(this.props.dataFormatting),
|
|
10247
|
+
// 'comparisonDisplay'
|
|
10248
|
+
// ) === 'PERCENT'
|
|
10249
|
+
// ) {
|
|
10250
|
+
// col.type = 'PERCENT'
|
|
10251
|
+
// }
|
|
10268
10252
|
col.field = "".concat(i);
|
|
10269
10253
|
col.title = col.display_name;
|
|
10270
10254
|
col.id = uuid.v4();
|
|
@@ -10653,7 +10637,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
|
|
|
10653
10637
|
}
|
|
10654
10638
|
|
|
10655
10639
|
if (_this.state.displayType === 'pivot_table') {
|
|
10656
|
-
return /*#__PURE__*/React.createElement(ChataTable, {
|
|
10640
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(ChataTable, {
|
|
10657
10641
|
themeConfig: getThemeConfig(_this.props.themeConfig),
|
|
10658
10642
|
key: _this.pivotTableID,
|
|
10659
10643
|
ref: function ref(_ref6) {
|
|
@@ -10666,7 +10650,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
|
|
|
10666
10650
|
onFilterCallback: _this.onTableFilter,
|
|
10667
10651
|
setFilterTagsCallback: _this.props.setFilterTagsCallback,
|
|
10668
10652
|
enableColumnHeaderContextMenu: _this.props.enableColumnHeaderContextMenu
|
|
10669
|
-
});
|
|
10653
|
+
}));
|
|
10670
10654
|
}
|
|
10671
10655
|
|
|
10672
10656
|
return /*#__PURE__*/React.createElement(Fragment, null, _this.renderAllColumnsHiddenMessage(), /*#__PURE__*/React.createElement(ChataTable, {
|
|
@@ -10708,6 +10692,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
|
|
|
10708
10692
|
columns: _this.chartTableColumns,
|
|
10709
10693
|
height: height,
|
|
10710
10694
|
width: width,
|
|
10695
|
+
isShowingInterpretation: _this.state.isShowingInterpretation,
|
|
10711
10696
|
dataFormatting: getDataFormatting(_this.props.dataFormatting),
|
|
10712
10697
|
backgroundColor: _this.props.backgroundColor,
|
|
10713
10698
|
activeChartElementKey: _this.props.activeChartElementKey,
|
|
@@ -10842,7 +10827,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
|
|
|
10842
10827
|
if (_get(queryResponse, 'data.data.replacements')) {
|
|
10843
10828
|
return /*#__PURE__*/React.createElement(QueryValidationMessage, {
|
|
10844
10829
|
themeConfig: getThemeConfig(_this.props.themeConfig),
|
|
10845
|
-
key: _this.
|
|
10830
|
+
key: _this.QUERY_VALIDATION_KEY,
|
|
10846
10831
|
response: _this.props.queryResponse,
|
|
10847
10832
|
onSuggestionClick: function onSuggestionClick(_ref9) {
|
|
10848
10833
|
var query = _ref9.query,
|
|
@@ -10967,31 +10952,104 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
|
|
|
10967
10952
|
}, /*#__PURE__*/React.createElement("div", null));
|
|
10968
10953
|
});
|
|
10969
10954
|
|
|
10970
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
10971
|
-
var responseContainer = document.getElementById("react-autoql-response-content-container-".concat(_this.COMPONENT_KEY));
|
|
10972
|
-
var height = 0;
|
|
10973
|
-
var width = 0;
|
|
10955
|
+
_defineProperty(_assertThisInitialized(_this), "handleShowHide", function (e) {
|
|
10956
|
+
var responseContainer = document.getElementById("react-autoql-response-content-container-".concat(_this.COMPONENT_KEY)); // make room in response container for reverse translation text
|
|
10974
10957
|
|
|
10975
|
-
if (
|
|
10976
|
-
|
|
10977
|
-
|
|
10958
|
+
if (document.getElementById("reverse-translation-".concat(_this.COMPONENT_KEY)) && getAutoQLConfig$1(_this.props.autoQLConfig).enableQueryInterpretation) {
|
|
10959
|
+
if (e.isFullyOpened) {
|
|
10960
|
+
responseContainer.style.height = "calc(100% - ".concat(e.contentHeight, "px)");
|
|
10961
|
+
} else {
|
|
10962
|
+
responseContainer.style.height = "calc(100% - 26px)";
|
|
10963
|
+
}
|
|
10978
10964
|
}
|
|
10965
|
+
});
|
|
10979
10966
|
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10967
|
+
_defineProperty(_assertThisInitialized(_this), "renderReverseTranslation", function () {
|
|
10968
|
+
var queryResponse = _this.props.queryResponse;
|
|
10969
|
+
var id = "reverse-translation-".concat(_this.COMPONENT_KEY);
|
|
10970
|
+
var responseContainer = document.getElementById("react-autoql-response-content-container-".concat(_this.COMPONENT_KEY));
|
|
10983
10971
|
|
|
10984
|
-
if (
|
|
10985
|
-
|
|
10986
|
-
|
|
10972
|
+
if (responseContainer && _get(queryResponse, 'data.data.interpretation')) {
|
|
10973
|
+
// manipulate interpretation string to properly format various substrings
|
|
10974
|
+
var reverseTranslation = _get(queryResponse, 'data.data.interpretation').replace(/(["'])(?:(?=(\\?))\2.)*?\1/gi, function (output) {
|
|
10975
|
+
var text = output.replace(/'/g, '');
|
|
10987
10976
|
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10977
|
+
if (_get(queryResponse, 'data.data.persistent_locked_conditions').includes(text) || _get(queryResponse, 'data.data.session_locked_conditions').includes(text)) {
|
|
10978
|
+
return "\n <a class=\"react-autoql-condition-link-filtered\">\n <span class=\"material-icons react-autoql-custom-icon\">lock</span>\n ".concat(' ', text, "\n </a>\n ");
|
|
10979
|
+
} else {
|
|
10980
|
+
return "<a class=\"react-autoql-condition-link\">".concat(text, "</a>");
|
|
10981
|
+
}
|
|
10982
|
+
}).replace(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/gi, function (output) {
|
|
10983
|
+
return moment.utc(output).format('ll').toString();
|
|
10984
|
+
});
|
|
10985
|
+
|
|
10986
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
10987
|
+
id: id,
|
|
10988
|
+
className: "react-autoql-condition-lock-reverse-translation"
|
|
10989
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
10990
|
+
style: {
|
|
10991
|
+
float: 'left',
|
|
10992
|
+
minHeight: 20
|
|
10993
|
+
} // onClick={() => {
|
|
10994
|
+
// this.setState({
|
|
10995
|
+
// isShowingInterpretation: !this.state.isShowingInterpretation
|
|
10996
|
+
// })
|
|
10997
|
+
// }}
|
|
10998
|
+
|
|
10999
|
+
}, /*#__PURE__*/React.createElement(Icon // type={this.state.isShowingInterpretation ? 'caret-down' : 'caret-right' }
|
|
11000
|
+
// data-tip={this.state.isShowingInterpretation ? "Hide query interpretation" : "Show query interpretation" }
|
|
11001
|
+
, {
|
|
11002
|
+
type: "info" // data-for="react-autoql-interpretation"
|
|
11003
|
+
|
|
11004
|
+
}), ' '), /*#__PURE__*/React.createElement(UnmountClosed, {
|
|
11005
|
+
onRest: _this.handleShowHide,
|
|
11006
|
+
isOpened: true // isOpened={this.state.isShowingInterpretation}
|
|
11007
|
+
|
|
11008
|
+
}, /*#__PURE__*/React.createElement("strong", null, "Interpreted as:", ' '), /*#__PURE__*/React.createElement("span", {
|
|
11009
|
+
onClick: function onClick() {
|
|
11010
|
+
return _this.props.onConditionClickCallback();
|
|
11011
|
+
},
|
|
11012
|
+
dangerouslySetInnerHTML: {
|
|
11013
|
+
__html: "".concat(reverseTranslation)
|
|
11014
|
+
}
|
|
11015
|
+
})));
|
|
11016
|
+
}
|
|
11017
|
+
});
|
|
11018
|
+
|
|
11019
|
+
_defineProperty(_assertThisInitialized(_this), "render", function () {
|
|
11020
|
+
var responseContainer = document.getElementById("react-autoql-response-content-container-".concat(_this.COMPONENT_KEY));
|
|
11021
|
+
var translationContainer = document.getElementById("reverse-translation-".concat(_this.COMPONENT_KEY));
|
|
11022
|
+
var height = 0;
|
|
11023
|
+
var width = 0;
|
|
11024
|
+
|
|
11025
|
+
if (responseContainer) {
|
|
11026
|
+
height = responseContainer.clientHeight - getPadding(responseContainer).top - getPadding(responseContainer).bottom;
|
|
11027
|
+
width = responseContainer.clientWidth - getPadding(responseContainer).left - getPadding(responseContainer).right;
|
|
11028
|
+
}
|
|
11029
|
+
|
|
11030
|
+
if (_this.props.height) {
|
|
11031
|
+
if (translationContainer && getAutoQLConfig$1(_this.props.autoQLConfig).enableQueryInterpretation && _this.state.isShowingInterpretation) {
|
|
11032
|
+
if (_this.state.isShowingInterpretation) {
|
|
11033
|
+
height = _this.props.height - translationContainer.offsetHeight - 20;
|
|
11034
|
+
} else {
|
|
11035
|
+
height = _this.props.height - translationContainer.offsetHeight - 40;
|
|
11036
|
+
}
|
|
11037
|
+
} else {
|
|
11038
|
+
height = _this.props.height;
|
|
11039
|
+
}
|
|
11040
|
+
}
|
|
11041
|
+
|
|
11042
|
+
if (_this.props.width) {
|
|
11043
|
+
width = _this.props.width;
|
|
11044
|
+
}
|
|
11045
|
+
|
|
11046
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("div", {
|
|
11047
|
+
key: _this.COMPONENT_KEY,
|
|
11048
|
+
id: "react-autoql-response-content-container-".concat(_this.COMPONENT_KEY),
|
|
11049
|
+
"data-test": "query-response-wrapper",
|
|
11050
|
+
className: "react-autoql-response-content-container\n ".concat(isTableType(_this.state.displayType) ? 'table' : '', "\n ").concat(_this.state.displayType === 'html' ? 'html-content' : '')
|
|
11051
|
+
}, _this.renderResponse(width, height), _get(getAuthentication(_this.props.authentication), 'isQandA') && _this.renderQandAResponseConfirmation()), !_this.props.isDashboardQuery && getAutoQLConfig$1(_this.props.autoQLConfig).enableQueryInterpretation ? _this.renderReverseTranslation() : null, _this.renderContextMenu());
|
|
11052
|
+
});
|
|
10995
11053
|
|
|
10996
11054
|
return _this;
|
|
10997
11055
|
}
|
|
@@ -11005,13 +11063,13 @@ _defineProperty(QueryOutput, "propTypes", (_defineProperty2$1 = {
|
|
|
11005
11063
|
authentication: authenticationType,
|
|
11006
11064
|
themeConfig: themeConfigType,
|
|
11007
11065
|
autoQLConfig: autoQLConfigType
|
|
11008
|
-
}, _defineProperty(_defineProperty2$1, "authentication", authenticationType), _defineProperty(_defineProperty2$1, "dataFormatting", dataFormattingType), _defineProperty(_defineProperty2$1, "dataConfig", shape({})), _defineProperty(_defineProperty2$1, "onSuggestionClick", func), _defineProperty(_defineProperty2$1, "displayType", string), _defineProperty(_defineProperty2$1, "renderTooltips", bool), _defineProperty(_defineProperty2$1, "onQueryValidationSelectOption", func), _defineProperty(_defineProperty2$1, "autoSelectQueryValidationSuggestion", bool), _defineProperty(_defineProperty2$1, "queryValidationSelections", arrayOf(shape({}))), _defineProperty(_defineProperty2$1, "renderSuggestionsAsDropdown", bool), _defineProperty(_defineProperty2$1, "suggestionSelection", string), _defineProperty(_defineProperty2$1, "height", number), _defineProperty(_defineProperty2$1, "width", number), _defineProperty(_defineProperty2$1, "hideColumnCallback", func), _defineProperty(_defineProperty2$1, "activeChartElementKey", string), _defineProperty(_defineProperty2$1, "onTableFilterCallback", func), _defineProperty(_defineProperty2$1, "enableColumnHeaderContextMenu", bool), _defineProperty(_defineProperty2$1, "isResizing", bool), _defineProperty(_defineProperty2$1, "enableDynamicCharting", bool), _defineProperty(_defineProperty2$1, "onDataConfigChange", func), _defineProperty(_defineProperty2$1, "onDisplayTypeUpdate", func), _defineProperty(_defineProperty2$1, "onColumnsUpdate", func), _defineProperty(_defineProperty2$1, "onNoneOfTheseClick", func), _defineProperty(_defineProperty2$1, "autoChartAggregations", bool), _defineProperty(_defineProperty2$1, "onSupportedDisplayTypesChange", func), _defineProperty2$1));
|
|
11066
|
+
}, _defineProperty(_defineProperty2$1, "authentication", authenticationType), _defineProperty(_defineProperty2$1, "dataFormatting", dataFormattingType), _defineProperty(_defineProperty2$1, "dataConfig", shape({})), _defineProperty(_defineProperty2$1, "onSuggestionClick", func), _defineProperty(_defineProperty2$1, "displayType", string), _defineProperty(_defineProperty2$1, "renderTooltips", bool), _defineProperty(_defineProperty2$1, "onQueryValidationSelectOption", func), _defineProperty(_defineProperty2$1, "autoSelectQueryValidationSuggestion", bool), _defineProperty(_defineProperty2$1, "queryValidationSelections", arrayOf(shape({}))), _defineProperty(_defineProperty2$1, "renderSuggestionsAsDropdown", bool), _defineProperty(_defineProperty2$1, "suggestionSelection", string), _defineProperty(_defineProperty2$1, "height", number), _defineProperty(_defineProperty2$1, "width", number), _defineProperty(_defineProperty2$1, "hideColumnCallback", func), _defineProperty(_defineProperty2$1, "activeChartElementKey", string), _defineProperty(_defineProperty2$1, "onTableFilterCallback", func), _defineProperty(_defineProperty2$1, "enableColumnHeaderContextMenu", bool), _defineProperty(_defineProperty2$1, "isResizing", bool), _defineProperty(_defineProperty2$1, "enableDynamicCharting", bool), _defineProperty(_defineProperty2$1, "onDataConfigChange", func), _defineProperty(_defineProperty2$1, "onDisplayTypeUpdate", func), _defineProperty(_defineProperty2$1, "onColumnsUpdate", func), _defineProperty(_defineProperty2$1, "onNoneOfTheseClick", func), _defineProperty(_defineProperty2$1, "autoChartAggregations", bool), _defineProperty(_defineProperty2$1, "onSupportedDisplayTypesChange", func), _defineProperty(_defineProperty2$1, "onConditionClickCallback", func), _defineProperty(_defineProperty2$1, "isDashboardQuery", bool), _defineProperty(_defineProperty2$1, "enableQueryInterpretation", bool), _defineProperty(_defineProperty2$1, "defaultShowInterpretation", bool), _defineProperty2$1));
|
|
11009
11067
|
|
|
11010
11068
|
_defineProperty(QueryOutput, "defaultProps", (_defineProperty3 = {
|
|
11011
11069
|
authentication: authenticationDefault,
|
|
11012
11070
|
themeConfig: themeConfigDefault,
|
|
11013
11071
|
autoQLConfig: autoQLConfigDefault
|
|
11014
|
-
}, _defineProperty(_defineProperty3, "authentication", authenticationDefault), _defineProperty(_defineProperty3, "dataFormatting", dataFormattingDefault), _defineProperty(_defineProperty3, "dataConfig", undefined), _defineProperty(_defineProperty3, "queryResponse", undefined), _defineProperty(_defineProperty3, "displayType", undefined), _defineProperty(_defineProperty3, "queryInputRef", undefined), _defineProperty(_defineProperty3, "onSuggestionClick", undefined), _defineProperty(_defineProperty3, "renderTooltips", true), _defineProperty(_defineProperty3, "autoSelectQueryValidationSuggestion", true), _defineProperty(_defineProperty3, "queryValidationSelections", undefined), _defineProperty(_defineProperty3, "renderSuggestionsAsDropdown", false), _defineProperty(_defineProperty3, "selectedSuggestion", undefined), _defineProperty(_defineProperty3, "height", undefined), _defineProperty(_defineProperty3, "width", undefined), _defineProperty(_defineProperty3, "activeChartElementKey", undefined), _defineProperty(_defineProperty3, "enableColumnHeaderContextMenu", false), _defineProperty(_defineProperty3, "isResizing", false), _defineProperty(_defineProperty3, "enableDynamicCharting", true), _defineProperty(_defineProperty3, "onNoneOfTheseClick", undefined), _defineProperty(_defineProperty3, "autoChartAggregations", true), _defineProperty(_defineProperty3, "onDataClick", function onDataClick() {}), _defineProperty(_defineProperty3, "onQueryValidationSelectOption", function onQueryValidationSelectOption() {}), _defineProperty(_defineProperty3, "onSupportedDisplayTypesChange", function onSupportedDisplayTypesChange() {}), _defineProperty(_defineProperty3, "hideColumnCallback", function hideColumnCallback() {}), _defineProperty(_defineProperty3, "onTableFilterCallback", function onTableFilterCallback() {}), _defineProperty(_defineProperty3, "onDataConfigChange", function onDataConfigChange() {}), _defineProperty(_defineProperty3, "onErrorCallback", function onErrorCallback() {}), _defineProperty(_defineProperty3, "onDisplayTypeUpdate", function onDisplayTypeUpdate() {}), _defineProperty(_defineProperty3, "onColumnsUpdate", function onColumnsUpdate() {}), _defineProperty3));
|
|
11072
|
+
}, _defineProperty(_defineProperty3, "authentication", authenticationDefault), _defineProperty(_defineProperty3, "dataFormatting", dataFormattingDefault), _defineProperty(_defineProperty3, "dataConfig", undefined), _defineProperty(_defineProperty3, "queryResponse", undefined), _defineProperty(_defineProperty3, "displayType", undefined), _defineProperty(_defineProperty3, "queryInputRef", undefined), _defineProperty(_defineProperty3, "onSuggestionClick", undefined), _defineProperty(_defineProperty3, "renderTooltips", true), _defineProperty(_defineProperty3, "autoSelectQueryValidationSuggestion", true), _defineProperty(_defineProperty3, "queryValidationSelections", undefined), _defineProperty(_defineProperty3, "renderSuggestionsAsDropdown", false), _defineProperty(_defineProperty3, "selectedSuggestion", undefined), _defineProperty(_defineProperty3, "height", undefined), _defineProperty(_defineProperty3, "width", undefined), _defineProperty(_defineProperty3, "activeChartElementKey", undefined), _defineProperty(_defineProperty3, "enableColumnHeaderContextMenu", false), _defineProperty(_defineProperty3, "isResizing", false), _defineProperty(_defineProperty3, "enableDynamicCharting", true), _defineProperty(_defineProperty3, "onNoneOfTheseClick", undefined), _defineProperty(_defineProperty3, "autoChartAggregations", true), _defineProperty(_defineProperty3, "isDashboardQuery", false), _defineProperty(_defineProperty3, "enableFilterLocking", false), _defineProperty(_defineProperty3, "onDataClick", function onDataClick() {}), _defineProperty(_defineProperty3, "onQueryValidationSelectOption", function onQueryValidationSelectOption() {}), _defineProperty(_defineProperty3, "onSupportedDisplayTypesChange", function onSupportedDisplayTypesChange() {}), _defineProperty(_defineProperty3, "hideColumnCallback", function hideColumnCallback() {}), _defineProperty(_defineProperty3, "onTableFilterCallback", function onTableFilterCallback() {}), _defineProperty(_defineProperty3, "onDataConfigChange", function onDataConfigChange() {}), _defineProperty(_defineProperty3, "onErrorCallback", function onErrorCallback() {}), _defineProperty(_defineProperty3, "onDisplayTypeUpdate", function onDisplayTypeUpdate() {}), _defineProperty(_defineProperty3, "onColumnsUpdate", function onColumnsUpdate() {}), _defineProperty(_defineProperty3, "onConditionClickCallback", function onConditionClickCallback() {}), _defineProperty3));
|
|
11015
11073
|
|
|
11016
11074
|
var VizToolbar = /*#__PURE__*/function (_React$Component) {
|
|
11017
11075
|
_inherits(VizToolbar, _React$Component);
|
|
@@ -12069,8 +12127,18 @@ var NotificationIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
12069
12127
|
switch (_context.prev = _context.next) {
|
|
12070
12128
|
case 0:
|
|
12071
12129
|
_this._isMounted = true;
|
|
12072
|
-
|
|
12073
|
-
|
|
12130
|
+
/**
|
|
12131
|
+
* If Data Messenger has enableNotificationsTab = true and
|
|
12132
|
+
* the NotificationIcon is also present, subscribeToNotificationCount()
|
|
12133
|
+
* will occasionally trigger an infinite loop.
|
|
12134
|
+
*
|
|
12135
|
+
* Data Messenger will first check to see that the NotificationIcon
|
|
12136
|
+
* isn't already present before triggering this function inside.
|
|
12137
|
+
*/
|
|
12138
|
+
|
|
12139
|
+
if (!_this.props.isAlreadyMountedInDOM) {
|
|
12140
|
+
_this.subscribeToNotificationCount();
|
|
12141
|
+
}
|
|
12074
12142
|
|
|
12075
12143
|
case 2:
|
|
12076
12144
|
case "end":
|
|
@@ -12204,7 +12272,8 @@ _defineProperty(NotificationIcon, "propTypes", {
|
|
|
12204
12272
|
useDot: PropTypes.bool,
|
|
12205
12273
|
clearCountOnClick: PropTypes.bool,
|
|
12206
12274
|
onNewNotification: PropTypes.func,
|
|
12207
|
-
onErrorCallback: PropTypes.func
|
|
12275
|
+
onErrorCallback: PropTypes.func,
|
|
12276
|
+
isAlreadyMountedInDOM: PropTypes.bool
|
|
12208
12277
|
});
|
|
12209
12278
|
|
|
12210
12279
|
_defineProperty(NotificationIcon, "defaultProps", {
|
|
@@ -12214,7 +12283,8 @@ _defineProperty(NotificationIcon, "defaultProps", {
|
|
|
12214
12283
|
style: {},
|
|
12215
12284
|
clearCountOnClick: true,
|
|
12216
12285
|
onNewNotification: function onNewNotification() {},
|
|
12217
|
-
onErrorCallback: function onErrorCallback() {}
|
|
12286
|
+
onErrorCallback: function onErrorCallback() {},
|
|
12287
|
+
isAlreadyMountedInDOM: false
|
|
12218
12288
|
});
|
|
12219
12289
|
|
|
12220
12290
|
var _excluded$1 = ["icon", "type"];
|
|
@@ -12521,7 +12591,7 @@ var RuleSimple = /*#__PURE__*/function (_React$Component) {
|
|
|
12521
12591
|
return '<';
|
|
12522
12592
|
}
|
|
12523
12593
|
|
|
12524
|
-
case '
|
|
12594
|
+
case 'EQUAL_TO':
|
|
12525
12595
|
{
|
|
12526
12596
|
return '=';
|
|
12527
12597
|
}
|
|
@@ -12579,9 +12649,9 @@ var RuleSimple = /*#__PURE__*/function (_React$Component) {
|
|
|
12579
12649
|
label: '<',
|
|
12580
12650
|
tooltip: 'Less Than'
|
|
12581
12651
|
}, {
|
|
12582
|
-
value: '
|
|
12652
|
+
value: 'EQUAL_TO',
|
|
12583
12653
|
label: '=',
|
|
12584
|
-
tooltip: '
|
|
12654
|
+
tooltip: 'EQUAL_TO'
|
|
12585
12655
|
}, {
|
|
12586
12656
|
value: 'EXISTS',
|
|
12587
12657
|
label: 'Exists',
|
|
@@ -12924,8 +12994,8 @@ var NotificationItem = /*#__PURE__*/function (_React$Component) {
|
|
|
12924
12994
|
var queryResponse = {
|
|
12925
12995
|
data: _this.props.activeNotificationData
|
|
12926
12996
|
};
|
|
12927
|
-
_this.supportedDisplayTypes = getSupportedDisplayTypes(queryResponse);
|
|
12928
|
-
var displayType = _this.supportedDisplayTypes.includes('column') ? 'column' : getDefaultDisplayType(queryResponse, _this.props.autoChartAggregations);
|
|
12997
|
+
_this.supportedDisplayTypes = getSupportedDisplayTypes(queryResponse, undefined, true);
|
|
12998
|
+
var displayType = _this.props.autoChartAggregations && _this.supportedDisplayTypes.includes('column') ? 'column' : getDefaultDisplayType(queryResponse, _this.props.autoChartAggregations);
|
|
12929
12999
|
|
|
12930
13000
|
_this.setState({
|
|
12931
13001
|
displayType: displayType
|
|
@@ -13254,7 +13324,7 @@ _defineProperty(NotificationItem, "defaultProps", {
|
|
|
13254
13324
|
themeConfig: themeConfigDefault,
|
|
13255
13325
|
activeNotificationData: undefined,
|
|
13256
13326
|
showNotificationDetails: true,
|
|
13257
|
-
autoChartAggregations:
|
|
13327
|
+
autoChartAggregations: false,
|
|
13258
13328
|
onRuleFetchCallback: function onRuleFetchCallback() {},
|
|
13259
13329
|
onExpandCallback: function onExpandCallback() {},
|
|
13260
13330
|
onDismissCallback: function onDismissCallback() {},
|
|
@@ -14886,7 +14956,7 @@ _defineProperty(NotificationFeed, "defaultProps", {
|
|
|
14886
14956
|
themeConfig: themeConfigDefault,
|
|
14887
14957
|
activeNotificationData: undefined,
|
|
14888
14958
|
showNotificationDetails: true,
|
|
14889
|
-
autoChartAggregations:
|
|
14959
|
+
autoChartAggregations: false,
|
|
14890
14960
|
showCreateAlertBtn: false,
|
|
14891
14961
|
onCollapseCallback: function onCollapseCallback() {},
|
|
14892
14962
|
onExpandCallback: function onExpandCallback() {},
|
|
@@ -15173,14 +15243,19 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
|
|
|
15173
15243
|
type: "hour-glass"
|
|
15174
15244
|
}), _this.hasError(notification) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
15175
15245
|
type: "primary",
|
|
15246
|
+
tooltip: "This Alert is no longer active. <br /> Click to re-initialze it.",
|
|
15247
|
+
multiline: true,
|
|
15176
15248
|
className: "react-autoql-re-initialize-btn",
|
|
15177
|
-
tooltip: "Please re-initialize data alert",
|
|
15178
15249
|
onClick: function onClick() {
|
|
15179
|
-
|
|
15250
|
+
_this.props.onAlertInitializationCallback(notification, _this.props.selectedDemoProjectId, _this.props.authentication);
|
|
15251
|
+
|
|
15252
|
+
_this.getDataAlerts();
|
|
15180
15253
|
}
|
|
15181
15254
|
}, /*#__PURE__*/React.createElement("span", {
|
|
15182
15255
|
className: "react-autoql-re-initialize-btn-text"
|
|
15183
|
-
},
|
|
15256
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
15257
|
+
type: "warning-triangle"
|
|
15258
|
+
}), ' ', " Resend")), /*#__PURE__*/React.createElement(Checkbox, {
|
|
15184
15259
|
themeConfig: getThemeConfig(_this.props.themeConfig),
|
|
15185
15260
|
type: "switch",
|
|
15186
15261
|
className: "react-autoql-notification-disable-checkbox"
|
|
@@ -15267,7 +15342,8 @@ _defineProperty(DataAlerts, "defaultProps", {
|
|
|
15267
15342
|
authentication: authenticationDefault,
|
|
15268
15343
|
themeConfig: themeConfigDefault,
|
|
15269
15344
|
showCreateAlertBtn: false,
|
|
15270
|
-
onErrorCallback: function onErrorCallback() {}
|
|
15345
|
+
onErrorCallback: function onErrorCallback() {},
|
|
15346
|
+
onAlertInitializationCallback: function onAlertInitializationCallback() {}
|
|
15271
15347
|
});
|
|
15272
15348
|
|
|
15273
15349
|
var getInitialStateData$2 = function getInitialStateData(initialData) {
|
|
@@ -15536,7 +15612,7 @@ var Rule = /*#__PURE__*/function (_React$Component) {
|
|
|
15536
15612
|
return '<';
|
|
15537
15613
|
}
|
|
15538
15614
|
|
|
15539
|
-
case '
|
|
15615
|
+
case 'EQUAL_TO':
|
|
15540
15616
|
{
|
|
15541
15617
|
return '=';
|
|
15542
15618
|
}
|
|
@@ -15599,9 +15675,9 @@ var Rule = /*#__PURE__*/function (_React$Component) {
|
|
|
15599
15675
|
label: '<',
|
|
15600
15676
|
tooltip: 'Less Than'
|
|
15601
15677
|
}, {
|
|
15602
|
-
value: '
|
|
15678
|
+
value: 'EQUAL_TO',
|
|
15603
15679
|
label: '=',
|
|
15604
|
-
tooltip: '
|
|
15680
|
+
tooltip: 'EQUAL_TO'
|
|
15605
15681
|
}, {
|
|
15606
15682
|
value: 'EXISTS',
|
|
15607
15683
|
label: /*#__PURE__*/React.createElement("span", null, "\u2203"),
|
|
@@ -17884,30 +17960,21 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
17884
17960
|
});
|
|
17885
17961
|
|
|
17886
17962
|
_defineProperty(_assertThisInitialized(_this), "renderToolbar", function () {
|
|
17963
|
+
var _shouldShowButton;
|
|
17964
|
+
|
|
17887
17965
|
var displayType = _get(_this.props.responseRef, 'state.displayType');
|
|
17888
17966
|
|
|
17889
17967
|
var response = _get(_this.props.responseRef, 'props.queryResponse');
|
|
17890
17968
|
|
|
17891
17969
|
var isDataResponse = _get(response, 'data.data.display_type') === 'data';
|
|
17892
|
-
var shouldShowButton = {
|
|
17970
|
+
var shouldShowButton = (_shouldShowButton = {
|
|
17893
17971
|
showFilterButton: isTableResponse(response, displayType) && !_this.areAllColumnsHidden() && _get(response, 'data.data.rows.length') > 1,
|
|
17894
17972
|
showCopyButton: isTableResponse(response, displayType) && !_this.areAllColumnsHidden() && !!_get(response, 'data.data.rows.length'),
|
|
17895
17973
|
showSaveAsCSVButton: isTableResponse(response, displayType) && !_this.areAllColumnsHidden() && !!_get(response, 'data.data.rows.length'),
|
|
17896
17974
|
showSaveAsPNGButton: CHART_TYPES.includes(displayType),
|
|
17897
17975
|
showHideColumnsButton: getAutoQLConfig$1(_this.props.autoQLConfig).enableColumnVisibilityManager && isTableResponse(response, displayType) && displayType !== 'pivot_table' && _get(response, 'data.data.columns.length') > 0,
|
|
17898
|
-
showSQLButton: isDataResponse && getAutoQLConfig$1(_this.props.autoQLConfig).debug
|
|
17899
|
-
|
|
17900
|
-
showReportProblemButton: !!_get(response, 'data.data.query_id'),
|
|
17901
|
-
showCreateNotificationIcon: isDataResponse && getAutoQLConfig$1(_this.props.autoQLConfig).enableNotifications && !_this.isDrilldownResponse(),
|
|
17902
|
-
showShareToSlackButton: false,
|
|
17903
|
-
// This feature is disabled indefinitely
|
|
17904
|
-
// isDataResponse &&
|
|
17905
|
-
// getAutoQLConfig(this.props.autoQLConfig).enableSlackSharing,
|
|
17906
|
-
showShareToTeamsButton: false // This feature is disabled indefinitely
|
|
17907
|
-
// isDataResponse &&
|
|
17908
|
-
// getAutoQLConfig(this.props.autoQLConfig).enableTeamsSharing,
|
|
17909
|
-
|
|
17910
|
-
};
|
|
17976
|
+
showSQLButton: isDataResponse && getAutoQLConfig$1(_this.props.autoQLConfig).debug
|
|
17977
|
+
}, _defineProperty(_shouldShowButton, "showSaveAsCSVButton", isDataResponse && getAutoQLConfig$1(_this.props.autoQLConfig).enableCSVDownload), _defineProperty(_shouldShowButton, "showDeleteButton", _this.props.enableDeleteBtn), _defineProperty(_shouldShowButton, "showReportProblemButton", !!_get(response, 'data.data.query_id')), _defineProperty(_shouldShowButton, "showCreateNotificationIcon", isDataResponse && getAutoQLConfig$1(_this.props.autoQLConfig).enableNotifications && !_this.isDrilldownResponse()), _defineProperty(_shouldShowButton, "showShareToSlackButton", false), _defineProperty(_shouldShowButton, "showShareToTeamsButton", false), _shouldShowButton);
|
|
17911
17978
|
shouldShowButton.showMoreOptionsButton = shouldShowButton.showCopyButton || shouldShowButton.showSQLButton || shouldShowButton.showCreateNotificationIcon || shouldShowButton.showSaveAsCSVButton || shouldShowButton.showSaveAsPNGButton || shouldShowButton.showShareToSlackButton || shouldShowButton.showShareToTeamsButton; // If there is nothing to put in the toolbar, don't render it
|
|
17912
17979
|
|
|
17913
17980
|
if (!Object.values(shouldShowButton).find(function (showButton) {
|
|
@@ -18214,12 +18281,17 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
18214
18281
|
optionsToolbarRef: _this.optionsToolbarRef,
|
|
18215
18282
|
onNoneOfTheseClick: _this.props.onNoneOfTheseClick,
|
|
18216
18283
|
autoChartAggregations: _this.props.autoChartAggregations,
|
|
18284
|
+
enableQueryInterpretation: _this.props.enableQueryInterpretation,
|
|
18285
|
+
enableFilterLocking: _this.props.enableFilterLocking,
|
|
18217
18286
|
reportProblemCallback: function reportProblemCallback() {
|
|
18218
18287
|
if (_this.optionsToolbarRef) {
|
|
18219
18288
|
_this.optionsToolbarRef.setState({
|
|
18220
18289
|
activeMenu: 'other-problem'
|
|
18221
18290
|
});
|
|
18222
18291
|
}
|
|
18292
|
+
},
|
|
18293
|
+
onConditionClickCallback: function onConditionClickCallback() {
|
|
18294
|
+
_this.props.onConditionClickCallback();
|
|
18223
18295
|
}
|
|
18224
18296
|
}));
|
|
18225
18297
|
}
|
|
@@ -18373,7 +18445,7 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
18373
18445
|
if (_this.props.type === 'text' || _this.state.displayType === 'html') {
|
|
18374
18446
|
return undefined;
|
|
18375
18447
|
} else if (chartHeight) {
|
|
18376
|
-
return chartHeight +
|
|
18448
|
+
return chartHeight + 120;
|
|
18377
18449
|
}
|
|
18378
18450
|
|
|
18379
18451
|
return '85%';
|
|
@@ -18394,23 +18466,6 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
18394
18466
|
}
|
|
18395
18467
|
});
|
|
18396
18468
|
|
|
18397
|
-
_defineProperty(_assertThisInitialized(_this), "renderLockedConditions", function () {
|
|
18398
|
-
var response = _this.props.response;
|
|
18399
|
-
|
|
18400
|
-
var numRows = _get(response, 'data.data.rows.length');
|
|
18401
|
-
|
|
18402
|
-
var maxRowLimit = _get(response, 'data.data.row_limit');
|
|
18403
|
-
|
|
18404
|
-
if (_get(response, 'data.data.persistent_locked_conditions.length') > 0) {
|
|
18405
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
18406
|
-
type: "lock",
|
|
18407
|
-
className: maxRowLimit && numRows === maxRowLimit && !_this.allColumnsAreHidden() ? 'condition-info-icon-left-align' : 'condition-info-icon',
|
|
18408
|
-
"data-tip": response.data.data.persistent_locked_conditions,
|
|
18409
|
-
"data-for": "chart-element-tooltip"
|
|
18410
|
-
});
|
|
18411
|
-
}
|
|
18412
|
-
});
|
|
18413
|
-
|
|
18414
18469
|
_defineProperty(_assertThisInitialized(_this), "render", function () {
|
|
18415
18470
|
var _this$getChartDimensi2 = _this.getChartDimensions(),
|
|
18416
18471
|
chartWidth = _this$getChartDimensi2.chartWidth,
|
|
@@ -18435,7 +18490,7 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
18435
18490
|
return !col.visible;
|
|
18436
18491
|
}) || _this.allColumnsAreHidden() ? '400px' : undefined
|
|
18437
18492
|
}
|
|
18438
|
-
}, _this.renderContent(chartWidth, chartHeight), _this.props.isDataMessengerOpen && _this.renderRightToolbar(), _this.props.isDataMessengerOpen && _this.renderLeftToolbar(), _this.renderDataLimitWarning()
|
|
18493
|
+
}, _this.renderContent(chartWidth, chartHeight), _this.props.isDataMessengerOpen && _this.renderRightToolbar(), _this.props.isDataMessengerOpen && _this.renderLeftToolbar(), _this.renderDataLimitWarning())));
|
|
18439
18494
|
});
|
|
18440
18495
|
|
|
18441
18496
|
return _this;
|
|
@@ -18463,7 +18518,7 @@ _defineProperty(ChatMessage, "propTypes", (_defineProperty2 = {
|
|
|
18463
18518
|
content: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({})]),
|
|
18464
18519
|
tableOptions: PropTypes.shape({}),
|
|
18465
18520
|
enableColumnVisibilityManager: PropTypes.bool
|
|
18466
|
-
}, _defineProperty(_defineProperty2, "dataFormatting", dataFormattingType), _defineProperty(_defineProperty2, "onErrorCallback", PropTypes.func), _defineProperty(_defineProperty2, "onSuccessAlert", PropTypes.func), _defineProperty(_defineProperty2, "isResizing", PropTypes.bool), _defineProperty(_defineProperty2, "enableDynamicCharting", PropTypes.bool), _defineProperty(_defineProperty2, "scrollToBottom", PropTypes.func), _defineProperty(_defineProperty2, "onNoneOfTheseClick", PropTypes.func), _defineProperty(_defineProperty2, "autoChartAggregations", PropTypes.bool), _defineProperty2));
|
|
18521
|
+
}, _defineProperty(_defineProperty2, "dataFormatting", dataFormattingType), _defineProperty(_defineProperty2, "onErrorCallback", PropTypes.func), _defineProperty(_defineProperty2, "onSuccessAlert", PropTypes.func), _defineProperty(_defineProperty2, "isResizing", PropTypes.bool), _defineProperty(_defineProperty2, "enableDynamicCharting", PropTypes.bool), _defineProperty(_defineProperty2, "scrollToBottom", PropTypes.func), _defineProperty(_defineProperty2, "onNoneOfTheseClick", PropTypes.func), _defineProperty(_defineProperty2, "autoChartAggregations", PropTypes.bool), _defineProperty(_defineProperty2, "onConditionClickCallback", PropTypes.func), _defineProperty2));
|
|
18467
18522
|
|
|
18468
18523
|
_defineProperty(ChatMessage, "defaultProps", {
|
|
18469
18524
|
authentication: authenticationDefault,
|
|
@@ -18488,7 +18543,8 @@ _defineProperty(ChatMessage, "defaultProps", {
|
|
|
18488
18543
|
enableDynamicCharting: true,
|
|
18489
18544
|
autoChartAggregations: true,
|
|
18490
18545
|
scrollToBottom: function scrollToBottom() {},
|
|
18491
|
-
onNoneOfTheseClick: function onNoneOfTheseClick() {}
|
|
18546
|
+
onNoneOfTheseClick: function onNoneOfTheseClick() {},
|
|
18547
|
+
onConditionClickCallback: function onConditionClickCallback() {}
|
|
18492
18548
|
});
|
|
18493
18549
|
|
|
18494
18550
|
var QueryTipsTab = /*#__PURE__*/function (_React$Component) {
|
|
@@ -18794,11 +18850,22 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
18794
18850
|
inputValue: '',
|
|
18795
18851
|
lastQuery: '',
|
|
18796
18852
|
suggestions: [],
|
|
18797
|
-
selectedConditions: []
|
|
18853
|
+
selectedConditions: [],
|
|
18854
|
+
isFetchingConditions: false,
|
|
18855
|
+
isShowingInfo: false,
|
|
18856
|
+
isShowingSettingInfo: false,
|
|
18857
|
+
showMessage: {
|
|
18858
|
+
type: 'unlock',
|
|
18859
|
+
message: 'filter removed'
|
|
18860
|
+
}
|
|
18798
18861
|
});
|
|
18799
18862
|
|
|
18800
18863
|
_defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
|
|
18801
18864
|
try {
|
|
18865
|
+
_this.setState({
|
|
18866
|
+
isFetchingConditions: true
|
|
18867
|
+
});
|
|
18868
|
+
|
|
18802
18869
|
fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
|
|
18803
18870
|
var conditions = _get(response, 'data.data.data');
|
|
18804
18871
|
|
|
@@ -18815,9 +18882,25 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
18815
18882
|
});
|
|
18816
18883
|
}
|
|
18817
18884
|
|
|
18885
|
+
if (JSON.parse(sessionStorage.getItem("conditions")) !== null) {
|
|
18886
|
+
var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
|
|
18887
|
+
|
|
18888
|
+
for (var _i = 0; _i < sessionConditions.length; _i++) {
|
|
18889
|
+
array.push({
|
|
18890
|
+
id: sessionConditions[_i].id,
|
|
18891
|
+
keyword: sessionConditions[_i].value,
|
|
18892
|
+
value: sessionConditions[_i].value,
|
|
18893
|
+
show_message: sessionConditions[_i].show_message,
|
|
18894
|
+
key: sessionConditions[_i].key,
|
|
18895
|
+
lock_flag: sessionConditions[_i].lock_flag
|
|
18896
|
+
});
|
|
18897
|
+
}
|
|
18898
|
+
}
|
|
18899
|
+
|
|
18818
18900
|
_this.setState({
|
|
18819
|
-
selectedConditions: array,
|
|
18820
|
-
inputValue: ''
|
|
18901
|
+
selectedConditions: array.sort(),
|
|
18902
|
+
inputValue: '',
|
|
18903
|
+
isFetchingConditions: false
|
|
18821
18904
|
});
|
|
18822
18905
|
});
|
|
18823
18906
|
} catch (error) {
|
|
@@ -18825,32 +18908,34 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
18825
18908
|
}
|
|
18826
18909
|
});
|
|
18827
18910
|
|
|
18828
|
-
_defineProperty(_assertThisInitialized(_this), "getSuggestions", function (value) {
|
|
18829
|
-
var inputValue = value.trim().toLowerCase();
|
|
18830
|
-
var inputLength = inputValue.length;
|
|
18831
|
-
return inputLength === 0 ? [] : languages.filter(function (lang) {
|
|
18832
|
-
return lang.name.toLowerCase().slice(0, inputLength) === inputValue;
|
|
18833
|
-
});
|
|
18834
|
-
});
|
|
18835
|
-
|
|
18836
18911
|
_defineProperty(_assertThisInitialized(_this), "getSuggestionValue", function (suggestion) {
|
|
18837
18912
|
var array = _this.state.selectedConditions;
|
|
18838
|
-
|
|
18839
|
-
keyword: suggestion.name.keyword,
|
|
18840
|
-
value: suggestion.name.keyword,
|
|
18841
|
-
show_message: suggestion.name.show_message,
|
|
18842
|
-
key: suggestion.name.canonical,
|
|
18843
|
-
lock_flag: suggestion.name.lock_flag
|
|
18844
|
-
});
|
|
18913
|
+
var tempId = uuid.v4();
|
|
18845
18914
|
|
|
18846
|
-
|
|
18847
|
-
|
|
18848
|
-
|
|
18849
|
-
|
|
18850
|
-
|
|
18915
|
+
if (array.some(function (item) {
|
|
18916
|
+
return item.key === suggestion.name.canonical && item.value === suggestion.name.keyword;
|
|
18917
|
+
})) {
|
|
18918
|
+
_this.handleShowMessage('warning', 'This condition has already been applied.');
|
|
18919
|
+
} else {
|
|
18920
|
+
array.push({
|
|
18921
|
+
id: tempId,
|
|
18922
|
+
keyword: suggestion.name.keyword,
|
|
18923
|
+
value: suggestion.name.keyword,
|
|
18924
|
+
show_message: suggestion.name.show_message,
|
|
18925
|
+
key: suggestion.name.canonical,
|
|
18926
|
+
lock_flag: 1 // persist by default
|
|
18927
|
+
|
|
18928
|
+
});
|
|
18851
18929
|
|
|
18852
|
-
|
|
18853
|
-
|
|
18930
|
+
_this.setState({
|
|
18931
|
+
selectedConditions: array,
|
|
18932
|
+
inputValue: ''
|
|
18933
|
+
});
|
|
18934
|
+
|
|
18935
|
+
setConditions(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
|
|
18936
|
+
conditions: array
|
|
18937
|
+
}));
|
|
18938
|
+
}
|
|
18854
18939
|
});
|
|
18855
18940
|
|
|
18856
18941
|
_defineProperty(_assertThisInitialized(_this), "onInputChange", function (e) {
|
|
@@ -18867,27 +18952,64 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
18867
18952
|
});
|
|
18868
18953
|
|
|
18869
18954
|
_defineProperty(_assertThisInitialized(_this), "removeCondition", function (item, index) {
|
|
18870
|
-
var
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
|
|
18874
|
-
|
|
18875
|
-
|
|
18955
|
+
var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
|
|
18956
|
+
var sessionIndex;
|
|
18957
|
+
|
|
18958
|
+
if (sessionConditions) {
|
|
18959
|
+
sessionIndex = sessionConditions.findIndex(function (condition) {
|
|
18960
|
+
return _get(condition, 'key') === _get(item, 'key');
|
|
18876
18961
|
});
|
|
18962
|
+
}
|
|
18877
18963
|
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
18882
|
-
}
|
|
18964
|
+
if (sessionIndex !== -1 && sessionIndex !== undefined && sessionIndex !== null) {
|
|
18965
|
+
sessionConditions.splice(sessionIndex, 1);
|
|
18966
|
+
sessionStorage.setItem('conditions', JSON.stringify(sessionConditions));
|
|
18967
|
+
} else {
|
|
18968
|
+
unsetCondition(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
|
|
18969
|
+
condition: item
|
|
18970
|
+
}));
|
|
18971
|
+
}
|
|
18883
18972
|
|
|
18884
|
-
|
|
18885
|
-
|
|
18973
|
+
var array = _this.state.selectedConditions;
|
|
18974
|
+
array.splice(index, 1);
|
|
18886
18975
|
|
|
18976
|
+
_this.setState({
|
|
18977
|
+
selectedConditions: array
|
|
18978
|
+
});
|
|
18979
|
+
|
|
18980
|
+
_this.handleShowMessage('unlock', 'Filter removed.');
|
|
18981
|
+
|
|
18982
|
+
ReactTooltip.hide();
|
|
18983
|
+
});
|
|
18984
|
+
|
|
18985
|
+
_defineProperty(_assertThisInitialized(_this), "handlePersistConditionToggle", function (item) {
|
|
18986
|
+
var index = _this.state.selectedConditions.findIndex(function (condition) {
|
|
18987
|
+
return condition.id === item.id;
|
|
18988
|
+
});
|
|
18989
|
+
|
|
18990
|
+
var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
|
|
18991
|
+
|
|
18992
|
+
if (index === -1) ; else {
|
|
18887
18993
|
_this.setState({
|
|
18888
|
-
selectedConditions:
|
|
18994
|
+
selectedConditions: [].concat(_toConsumableArray(_this.state.selectedConditions.slice(0, index)), [Object.assign({}, _this.state.selectedConditions[index], item.lock_flag === 1 ? _this.state.selectedConditions[index].lock_flag = 0 : _this.state.selectedConditions[index].lock_flag = 1)], _toConsumableArray(_this.state.selectedConditions.slice(index + 1)))
|
|
18995
|
+
}, function () {
|
|
18996
|
+
setConditions(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
|
|
18997
|
+
conditions: _this.state.selectedConditions
|
|
18998
|
+
}));
|
|
18999
|
+
|
|
19000
|
+
if (item.lock_flag === 0) {
|
|
19001
|
+
if (sessionConditions == null) sessionConditions = [];
|
|
19002
|
+
sessionConditions.push(item);
|
|
19003
|
+
sessionStorage.setItem("conditions", JSON.stringify(sessionConditions));
|
|
19004
|
+
} else {
|
|
19005
|
+
var sessionIndex = sessionConditions.findIndex(function (condition) {
|
|
19006
|
+
return condition.id === item.id;
|
|
19007
|
+
});
|
|
19008
|
+
sessionConditions.splice(sessionIndex, 1);
|
|
19009
|
+
sessionStorage.setItem('conditions', JSON.stringify(sessionConditions));
|
|
19010
|
+
}
|
|
18889
19011
|
});
|
|
18890
|
-
}
|
|
19012
|
+
}
|
|
18891
19013
|
});
|
|
18892
19014
|
|
|
18893
19015
|
_defineProperty(_assertThisInitialized(_this), "onSuggestionsFetchRequested", function (_ref) {
|
|
@@ -18911,13 +19033,13 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
18911
19033
|
for (var i = 0; i < suggestionsMatchArray.length; i++) {
|
|
18912
19034
|
sortingArray.push(suggestionsMatchArray[i]);
|
|
18913
19035
|
|
|
18914
|
-
if (i ===
|
|
19036
|
+
if (i === 5) {
|
|
18915
19037
|
break;
|
|
18916
19038
|
}
|
|
18917
19039
|
}
|
|
18918
19040
|
|
|
18919
19041
|
sortingArray.sort(function (a, b) {
|
|
18920
|
-
return b.
|
|
19042
|
+
return a.keyword.toUpperCase() < b.keyword.toUpperCase() ? -1 : a.keyword > b.keyword ? 1 : 0;
|
|
18921
19043
|
});
|
|
18922
19044
|
|
|
18923
19045
|
for (var idx = 0; idx < sortingArray.length; idx++) {
|
|
@@ -18942,6 +19064,14 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
18942
19064
|
});
|
|
18943
19065
|
});
|
|
18944
19066
|
|
|
19067
|
+
_defineProperty(_assertThisInitialized(_this), "renderShowMessage", function () {
|
|
19068
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19069
|
+
id: "react-autoql-condition-show-message"
|
|
19070
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
19071
|
+
type: _this.state.showMessage.type
|
|
19072
|
+
}), " ", _this.state.showMessage.message);
|
|
19073
|
+
});
|
|
19074
|
+
|
|
18945
19075
|
_defineProperty(_assertThisInitialized(_this), "renderAcceptConditionsButton", function () {
|
|
18946
19076
|
return /*#__PURE__*/React.createElement("div", {
|
|
18947
19077
|
key: "accept-conditions-btn",
|
|
@@ -18972,72 +19102,138 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
18972
19102
|
style: {
|
|
18973
19103
|
width: containerWidth
|
|
18974
19104
|
}
|
|
18975
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
19105
|
+
}, _this.renderShowMessage(), /*#__PURE__*/React.createElement("div", {
|
|
18976
19106
|
className: "react-autoql-condition-lock-header"
|
|
18977
19107
|
}, /*#__PURE__*/React.createElement("div", {
|
|
18978
|
-
className: "autoql-
|
|
18979
|
-
}, /*#__PURE__*/React.createElement("
|
|
19108
|
+
className: "react-autoql-filter-locking-title-container"
|
|
19109
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
19110
|
+
className: "react-autoql-filter-locking-title"
|
|
19111
|
+
}, lang.filterLockingTitle, " ", ' ', /*#__PURE__*/React.createElement(Icon, {
|
|
19112
|
+
type: "info",
|
|
19113
|
+
onMouseEnter: function onMouseEnter() {
|
|
19114
|
+
return setTimeout(function () {
|
|
19115
|
+
_this.setState({
|
|
19116
|
+
isShowingInfo: true
|
|
19117
|
+
});
|
|
19118
|
+
}, 300);
|
|
19119
|
+
},
|
|
19120
|
+
onMouseLeave: function onMouseLeave() {
|
|
19121
|
+
return _this.setState({
|
|
19122
|
+
isShowingInfo: false
|
|
19123
|
+
});
|
|
19124
|
+
}
|
|
19125
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
18980
19126
|
onClick: function onClick() {
|
|
18981
19127
|
_this.props.onClose();
|
|
18982
19128
|
},
|
|
18983
19129
|
className: "autoql-close-button",
|
|
18984
|
-
"data-tip": lang.
|
|
19130
|
+
"data-tip": lang.closeFilterLocking,
|
|
18985
19131
|
"data-for": "react-autoql-header-tooltip"
|
|
18986
19132
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
18987
19133
|
type: "close"
|
|
18988
|
-
})), /*#__PURE__*/React.createElement(
|
|
19134
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
19135
|
+
className: "autoql-condition-locking-menu-container"
|
|
19136
|
+
}, _this.state.isShowingInfo ? /*#__PURE__*/React.createElement("div", {
|
|
19137
|
+
className: "react-autoql-filter-locking-empty-list"
|
|
19138
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
19139
|
+
type: "info"
|
|
19140
|
+
}), /*#__PURE__*/React.createElement("p", null, "Filters can be applied to narrow down your query results. Locking a filter ensures that only the specific data you wish to see is returned.")) : null, /*#__PURE__*/React.createElement(Autosuggest, {
|
|
18989
19141
|
ref: function ref(_ref2) {
|
|
18990
19142
|
_this.autoSuggest = _ref2;
|
|
18991
19143
|
},
|
|
19144
|
+
highlightFirstSuggestion: true,
|
|
18992
19145
|
suggestions: _this.state.suggestions,
|
|
18993
19146
|
onSuggestionsFetchRequested: _this.onSuggestionsFetchRequested,
|
|
18994
19147
|
onSuggestionsClearRequested: _this.onSuggestionsClearRequested,
|
|
18995
19148
|
getSuggestionValue: _this.getSuggestionValue,
|
|
18996
19149
|
renderSuggestion: function renderSuggestion(suggestion) {
|
|
18997
|
-
return /*#__PURE__*/React.createElement(Fragment, null,
|
|
19150
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("table", {
|
|
19151
|
+
className: "autoql-condition-locking-menu-list"
|
|
19152
|
+
}, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
19153
|
+
style: {
|
|
19154
|
+
width: 300
|
|
19155
|
+
}
|
|
19156
|
+
}, suggestion.name.keyword), /*#__PURE__*/React.createElement("td", null, suggestion.name.show_message)))));
|
|
18998
19157
|
},
|
|
18999
19158
|
inputProps: {
|
|
19000
19159
|
onChange: _this.onInputChange,
|
|
19001
19160
|
value: _this.state.inputValue,
|
|
19002
|
-
|
|
19161
|
+
disabled: _this.state.isFetchingConditions,
|
|
19162
|
+
placeholder: 'Search & select a filter',
|
|
19003
19163
|
className: 'react-autoql-condition-locking-input'
|
|
19004
19164
|
}
|
|
19005
|
-
})
|
|
19006
|
-
className: "
|
|
19165
|
+
}), _this.state.isShowingSettingInfo ? /*#__PURE__*/React.createElement("div", {
|
|
19166
|
+
className: "react-autoql-filter-setting-info-card"
|
|
19167
|
+
}, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Icon, {
|
|
19168
|
+
type: "info"
|
|
19169
|
+
}), ' ', /*#__PURE__*/React.createElement("strong", null, "Persistent"), " filters remain locked at all times, unless the filter is removed.", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Icon, {
|
|
19170
|
+
type: "info"
|
|
19171
|
+
}), ' ', /*#__PURE__*/React.createElement("strong", null, "Session"), " filters remain locked until you end your browser session.")) : null)), _this.state.isFetchingConditions ? /*#__PURE__*/React.createElement("div", {
|
|
19172
|
+
className: "react-autoql-condition-list-loading-container"
|
|
19173
|
+
}, /*#__PURE__*/React.createElement(LoadingDots, null)) : /*#__PURE__*/React.createElement("div", {
|
|
19174
|
+
className: "react-autoql-condition-list"
|
|
19007
19175
|
}, _get(_this.state.selectedConditions, 'length') === 0 ? /*#__PURE__*/React.createElement("div", {
|
|
19008
|
-
className: "empty-condition-list"
|
|
19009
|
-
}, /*#__PURE__*/React.createElement("p", null,
|
|
19176
|
+
className: "react-autoql-empty-condition-list"
|
|
19177
|
+
}, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("i", null, lang.noFiltersLocked))) : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
19010
19178
|
style: {
|
|
19011
|
-
minHeight:
|
|
19179
|
+
minHeight: 150
|
|
19012
19180
|
}
|
|
19013
19181
|
}, /*#__PURE__*/React.createElement("table", {
|
|
19014
|
-
className: "condition-table"
|
|
19182
|
+
className: "react-autoql-condition-table"
|
|
19015
19183
|
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("th", {
|
|
19016
19184
|
scope: "col"
|
|
19017
|
-
}, "
|
|
19018
|
-
scope: "col"
|
|
19019
|
-
|
|
19185
|
+
}, "Filter"), /*#__PURE__*/React.createElement("th", {
|
|
19186
|
+
scope: "col",
|
|
19187
|
+
style: {
|
|
19188
|
+
minWidth: 154
|
|
19189
|
+
}
|
|
19190
|
+
}, "Settings", /*#__PURE__*/React.createElement(Icon, {
|
|
19191
|
+
type: "info",
|
|
19192
|
+
onMouseEnter: function onMouseEnter() {
|
|
19193
|
+
return setTimeout(function () {
|
|
19194
|
+
_this.setState({
|
|
19195
|
+
isShowingSettingInfo: true
|
|
19196
|
+
});
|
|
19197
|
+
}, 300);
|
|
19198
|
+
},
|
|
19199
|
+
onMouseLeave: function onMouseLeave() {
|
|
19200
|
+
return _this.setState({
|
|
19201
|
+
isShowingSettingInfo: false
|
|
19202
|
+
});
|
|
19203
|
+
}
|
|
19204
|
+
})), /*#__PURE__*/React.createElement("th", {
|
|
19020
19205
|
scope: "col",
|
|
19021
19206
|
style: {
|
|
19022
19207
|
display: 'table-cell',
|
|
19023
19208
|
verticalAlign: 'middle',
|
|
19024
19209
|
textAlign: 'right'
|
|
19025
19210
|
}
|
|
19026
|
-
}
|
|
19211
|
+
})), /*#__PURE__*/React.createElement("tbody", null, _this.state.selectedConditions.map(function (item, index) {
|
|
19027
19212
|
return /*#__PURE__*/React.createElement("tr", {
|
|
19028
19213
|
key: index
|
|
19029
|
-
}, /*#__PURE__*/React.createElement("td",
|
|
19214
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
19215
|
+
className: "react-autoql-condition-table-list-item"
|
|
19216
|
+
}, item.keyword, ' ', "(".concat(item.show_message, ")")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Switch, {
|
|
19217
|
+
onChange: function onChange() {
|
|
19218
|
+
return _this.handlePersistConditionToggle(item, index);
|
|
19219
|
+
},
|
|
19220
|
+
checked: item.lock_flag,
|
|
19221
|
+
onColor: "#86d3ff",
|
|
19222
|
+
onHandleColor: "#2693e6",
|
|
19223
|
+
uncheckedIcon: false,
|
|
19224
|
+
checkedIcon: false,
|
|
19225
|
+
boxShadow: "0px 1px 5px rgba(0, 0, 0, 0.6)",
|
|
19226
|
+
activeBoxShadow: "0px 0px 1px 1px rgba(0, 0, 0, 0.2)",
|
|
19227
|
+
handleDiameter: 16,
|
|
19228
|
+
height: 18,
|
|
19229
|
+
width: 34
|
|
19230
|
+
}), ' ', item.lock_flag ? 'Persistent' : 'Session')), /*#__PURE__*/React.createElement("td", {
|
|
19030
19231
|
style: {
|
|
19031
19232
|
display: 'table-cell',
|
|
19032
19233
|
verticalAlign: 'middle',
|
|
19033
19234
|
textAlign: 'right'
|
|
19034
19235
|
}
|
|
19035
19236
|
}, /*#__PURE__*/React.createElement(ReactTooltip, {
|
|
19036
|
-
className: "react-autoql-chart-tooltip",
|
|
19037
|
-
id: "condition-lock-persist",
|
|
19038
|
-
effect: "solid",
|
|
19039
|
-
html: true
|
|
19040
|
-
}), /*#__PURE__*/React.createElement(ReactTooltip, {
|
|
19041
19237
|
className: "react-autoql-chart-tooltip",
|
|
19042
19238
|
id: "react-autoql-remove-condition",
|
|
19043
19239
|
effect: "solid",
|
|
@@ -19047,24 +19243,54 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
19047
19243
|
paddingLeft: 5,
|
|
19048
19244
|
color: 'red'
|
|
19049
19245
|
},
|
|
19050
|
-
"data-tip": "Remove
|
|
19246
|
+
"data-tip": "Remove filter",
|
|
19051
19247
|
"data-for": "react-autoql-remove-condition",
|
|
19052
19248
|
type: "trash",
|
|
19053
19249
|
onClick: function onClick() {
|
|
19054
19250
|
return _this.removeCondition(item, index);
|
|
19055
19251
|
}
|
|
19056
19252
|
})));
|
|
19057
|
-
})), /*#__PURE__*/React.createElement("tfoot", null)))),
|
|
19253
|
+
})), /*#__PURE__*/React.createElement("tfoot", null))))), /*#__PURE__*/React.createElement("div", {
|
|
19254
|
+
className: "react-autoql-condition-lock-menu-footer"
|
|
19255
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
19256
|
+
size: "small",
|
|
19257
|
+
disabled: _this.state.isFetchingConditions,
|
|
19258
|
+
onClick: function onClick() {
|
|
19259
|
+
_this.props.onClose();
|
|
19260
|
+
}
|
|
19261
|
+
}, "Continue"))));
|
|
19058
19262
|
});
|
|
19059
19263
|
|
|
19060
19264
|
return _this;
|
|
19061
19265
|
}
|
|
19062
19266
|
|
|
19267
|
+
_createClass(ConditionLockMenu, [{
|
|
19268
|
+
key: "handleShowMessage",
|
|
19269
|
+
value: function handleShowMessage(type, message) {
|
|
19270
|
+
var el = document.getElementById('react-autoql-condition-show-message');
|
|
19271
|
+
el.className = 'show';
|
|
19272
|
+
el.style.animation = 'none';
|
|
19273
|
+
setTimeout(function () {
|
|
19274
|
+
el.style.animation = '';
|
|
19275
|
+
}, 10);
|
|
19276
|
+
setTimeout(function () {
|
|
19277
|
+
el.className = el.className.replace('show', '');
|
|
19278
|
+
}, 3000);
|
|
19279
|
+
this.setState({
|
|
19280
|
+
inputValue: '',
|
|
19281
|
+
showMessage: {
|
|
19282
|
+
type: type,
|
|
19283
|
+
message: message
|
|
19284
|
+
}
|
|
19285
|
+
});
|
|
19286
|
+
}
|
|
19287
|
+
}]);
|
|
19288
|
+
|
|
19063
19289
|
return ConditionLockMenu;
|
|
19064
19290
|
}(React.Component);
|
|
19065
19291
|
|
|
19066
19292
|
_defineProperty(ConditionLockMenu, "propTypes", {
|
|
19067
|
-
containerWidth: PropTypes.
|
|
19293
|
+
containerWidth: PropTypes.number,
|
|
19068
19294
|
isOpen: PropTypes.bool,
|
|
19069
19295
|
onClose: PropTypes.func,
|
|
19070
19296
|
authentication: authenticationType
|
|
@@ -19131,11 +19357,20 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19131
19357
|
} // WIP
|
|
19132
19358
|
|
|
19133
19359
|
|
|
19134
|
-
|
|
19135
|
-
_this.
|
|
19136
|
-
|
|
19360
|
+
try {
|
|
19361
|
+
fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
|
|
19362
|
+
var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
|
|
19363
|
+
|
|
19364
|
+
_this.setState({
|
|
19365
|
+
conditions: {
|
|
19366
|
+
persistent: _get(response, 'data.data.data'),
|
|
19367
|
+
session: sessionConditions
|
|
19368
|
+
}
|
|
19369
|
+
});
|
|
19137
19370
|
});
|
|
19138
|
-
})
|
|
19371
|
+
} catch (e) {
|
|
19372
|
+
console.error(e);
|
|
19373
|
+
}
|
|
19139
19374
|
});
|
|
19140
19375
|
|
|
19141
19376
|
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps, prevState) {
|
|
@@ -19165,6 +19400,25 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19165
19400
|
if (thisTheme && thisTheme !== prevTheme) {
|
|
19166
19401
|
setCSSVars(getThemeConfig(getThemeConfig(_this.props.themeConfig)));
|
|
19167
19402
|
}
|
|
19403
|
+
|
|
19404
|
+
if (_this.state.isConditionLockingMenuOpen !== prevState.isConditionLockingMenuOpen) {
|
|
19405
|
+
fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
|
|
19406
|
+
var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
|
|
19407
|
+
|
|
19408
|
+
_this.setState({
|
|
19409
|
+
conditions: {
|
|
19410
|
+
persistent: _get(response, 'data.data.data'),
|
|
19411
|
+
session: sessionConditions
|
|
19412
|
+
}
|
|
19413
|
+
});
|
|
19414
|
+
});
|
|
19415
|
+
}
|
|
19416
|
+
|
|
19417
|
+
if (_this.state.activePage !== prevState.activePage) {
|
|
19418
|
+
_this.setState({
|
|
19419
|
+
isConditionLockingMenuOpen: false
|
|
19420
|
+
});
|
|
19421
|
+
}
|
|
19168
19422
|
} catch (error) {
|
|
19169
19423
|
console.error(error);
|
|
19170
19424
|
|
|
@@ -19346,6 +19600,10 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19346
19600
|
|
|
19347
19601
|
if (_this.props.onMaskClick) {
|
|
19348
19602
|
_this.props.onMaskClick();
|
|
19603
|
+
|
|
19604
|
+
_this.setState({
|
|
19605
|
+
isConditionLockingMenuOpen: false
|
|
19606
|
+
});
|
|
19349
19607
|
}
|
|
19350
19608
|
|
|
19351
19609
|
if (_this.props.onHandleClick) {
|
|
@@ -19719,6 +19977,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19719
19977
|
},
|
|
19720
19978
|
overflowCount: 9,
|
|
19721
19979
|
useDot: true,
|
|
19980
|
+
isAlreadyMountedInDOM: /*#__PURE__*/React.isValidElement( /*#__PURE__*/React.createElement(NotificationIcon, null)),
|
|
19722
19981
|
onNewNotification: function onNewNotification() {
|
|
19723
19982
|
// If a new notification is detected, refresh the list
|
|
19724
19983
|
if (_this.notificationListRef && _this.state.activePage === 'notifications') {
|
|
@@ -19739,7 +19998,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19739
19998
|
position: 'absolute',
|
|
19740
19999
|
right: 30
|
|
19741
20000
|
}
|
|
19742
|
-
},
|
|
20001
|
+
}, getAutoQLConfig$1(getAutoQLConfig$1(_this.props.autoQLConfig)).enableFilterLocking ? /*#__PURE__*/React.createElement("button", {
|
|
19743
20002
|
id: "condition-dropdown",
|
|
19744
20003
|
onClick: function onClick() {
|
|
19745
20004
|
_this.setState({
|
|
@@ -19747,15 +20006,13 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19747
20006
|
});
|
|
19748
20007
|
},
|
|
19749
20008
|
className: "react-autoql-drawer-header-btn clear-all",
|
|
19750
|
-
"data-tip": lang.
|
|
20009
|
+
"data-tip": lang.openFilterLocking,
|
|
19751
20010
|
"data-for": "react-autoql-header-tooltip"
|
|
19752
20011
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
19753
|
-
type: _get(_this.state.conditions, 'length') > 0 ? "lock" : "unlock"
|
|
20012
|
+
type: _get(_this.state.conditions, 'persistent.length') > 0 || _get(_this.state.conditions, 'session.length') > 0 ? "lock" : "unlock"
|
|
19754
20013
|
})) : /*#__PURE__*/React.createElement("span", null)), /*#__PURE__*/React.createElement(Popover, {
|
|
19755
20014
|
isOpen: _this.state.isOptionsDropdownOpen,
|
|
19756
20015
|
onClickOutside: function onClickOutside() {
|
|
19757
|
-
console.log(_this.state.isOptionsDropdownOpen);
|
|
19758
|
-
|
|
19759
20016
|
_this.setState({
|
|
19760
20017
|
isOptionsDropdownOpen: false
|
|
19761
20018
|
});
|
|
@@ -19800,7 +20057,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19800
20057
|
});
|
|
19801
20058
|
},
|
|
19802
20059
|
className: "react-autoql-drawer-header-btn clear-all",
|
|
19803
|
-
"data-tip": lang.
|
|
20060
|
+
"data-tip": lang.clearDataResponses,
|
|
19804
20061
|
"data-for": "react-autoql-header-tooltip"
|
|
19805
20062
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
19806
20063
|
type: "trash"
|
|
@@ -19828,14 +20085,6 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19828
20085
|
}, title);
|
|
19829
20086
|
});
|
|
19830
20087
|
|
|
19831
|
-
_defineProperty(_assertThisInitialized(_this), "renderShowSuccessMessage", function () {
|
|
19832
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
19833
|
-
id: "condition-lock-snackbar-success"
|
|
19834
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
19835
|
-
type: "check"
|
|
19836
|
-
}), " Conditions Applied");
|
|
19837
|
-
});
|
|
19838
|
-
|
|
19839
20088
|
_defineProperty(_assertThisInitialized(_this), "renderHeaderContent", function () {
|
|
19840
20089
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
19841
20090
|
className: "react-autoql-header-left-container"
|
|
@@ -19852,7 +20101,9 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19852
20101
|
"data-for": "react-autoql-header-tooltip"
|
|
19853
20102
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
19854
20103
|
type: "close"
|
|
19855
|
-
}))), /*#__PURE__*/React.createElement(
|
|
20104
|
+
}))), !getAutoQLConfig$1(getAutoQLConfig$1(_this.props.autoQLConfig)).enableFilterLocking ? /*#__PURE__*/React.createElement("div", {
|
|
20105
|
+
className: "react-autoql-header-center-container"
|
|
20106
|
+
}, _this.renderHeaderTitle()) : /*#__PURE__*/React.createElement(Popover, {
|
|
19856
20107
|
containerStyle: _this.getConditionMenuPosition(),
|
|
19857
20108
|
isOpen: _this.state.isConditionLockingMenuOpen,
|
|
19858
20109
|
position: "bottom",
|
|
@@ -19867,15 +20118,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19867
20118
|
authentication: getAuthentication(getAuthentication(_this.props.authentication)),
|
|
19868
20119
|
containerWidth: _this.getDrawerWidth(),
|
|
19869
20120
|
isOpen: _this.state.isConditionLockingMenuOpen,
|
|
19870
|
-
onClose: function onClose(
|
|
19871
|
-
if (isSaved) {
|
|
19872
|
-
var el = document.getElementById('condition-lock-snackbar-success');
|
|
19873
|
-
el.className = 'show';
|
|
19874
|
-
setTimeout(function () {
|
|
19875
|
-
el.className = el.className.replace('show', '');
|
|
19876
|
-
}, 3000);
|
|
19877
|
-
}
|
|
19878
|
-
|
|
20121
|
+
onClose: function onClose() {
|
|
19879
20122
|
_this.setState({
|
|
19880
20123
|
isConditionLockingMenuOpen: false
|
|
19881
20124
|
});
|
|
@@ -19883,7 +20126,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19883
20126
|
}))
|
|
19884
20127
|
}, /*#__PURE__*/React.createElement("div", {
|
|
19885
20128
|
className: "react-autoql-header-center-container"
|
|
19886
|
-
}, _this.renderHeaderTitle()
|
|
20129
|
+
}, _this.renderHeaderTitle())), /*#__PURE__*/React.createElement("div", {
|
|
19887
20130
|
className: "react-autoql-header-right-container"
|
|
19888
20131
|
}, _this.renderOptionsDropdown()));
|
|
19889
20132
|
});
|
|
@@ -19966,7 +20209,12 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
19966
20209
|
isResizing: _this.state.isResizing,
|
|
19967
20210
|
enableDynamicCharting: _this.props.enableDynamicCharting,
|
|
19968
20211
|
onNoneOfTheseClick: _this.onNoneOfTheseClick,
|
|
19969
|
-
autoChartAggregations: _this.props.autoChartAggregations
|
|
20212
|
+
autoChartAggregations: _this.props.autoChartAggregations,
|
|
20213
|
+
onConditionClickCallback: function onConditionClickCallback() {
|
|
20214
|
+
_this.setState({
|
|
20215
|
+
isConditionLockingMenuOpen: !_this.state.isConditionLockingMenuOpen
|
|
20216
|
+
});
|
|
20217
|
+
}
|
|
19970
20218
|
});
|
|
19971
20219
|
})), _this.state.isChataThinking && /*#__PURE__*/React.createElement("div", {
|
|
19972
20220
|
className: "response-loading-container"
|
|
@@ -20368,6 +20616,36 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
|
|
|
20368
20616
|
});
|
|
20369
20617
|
}
|
|
20370
20618
|
}
|
|
20619
|
+
}, {
|
|
20620
|
+
key: "removeDuplicateMessengerInstance",
|
|
20621
|
+
value:
|
|
20622
|
+
/**
|
|
20623
|
+
* For some indiscernible reason, the Data Messenger drawer duplicates itself in the DOM.
|
|
20624
|
+
* three times when first opened, then a number more times with each and every query
|
|
20625
|
+
* being made.
|
|
20626
|
+
*
|
|
20627
|
+
* This function removes unnecessary duplicate instances of the Data Messenger Drawer
|
|
20628
|
+
* and should help improve performance a bit by reducing the amount of renders.
|
|
20629
|
+
*
|
|
20630
|
+
* https://stackoverflow.com/questions/57946748/remove-duplicate-dom-element-javascript-not-jquery
|
|
20631
|
+
*/
|
|
20632
|
+
function removeDuplicateMessengerInstance() {
|
|
20633
|
+
var instance = {};
|
|
20634
|
+
|
|
20635
|
+
var _iterator = _createForOfIteratorHelper(document.querySelectorAll('.ReactModalPortal')),
|
|
20636
|
+
_step;
|
|
20637
|
+
|
|
20638
|
+
try {
|
|
20639
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
20640
|
+
var item = _step.value;
|
|
20641
|
+
if (instance[item]) item.parentNode.removeChild(item);else instance[item] = true;
|
|
20642
|
+
}
|
|
20643
|
+
} catch (err) {
|
|
20644
|
+
_iterator.e(err);
|
|
20645
|
+
} finally {
|
|
20646
|
+
_iterator.f();
|
|
20647
|
+
}
|
|
20648
|
+
}
|
|
20371
20649
|
}]);
|
|
20372
20650
|
|
|
20373
20651
|
return DataMessenger;
|
|
@@ -20403,6 +20681,9 @@ _defineProperty(DataMessenger, "propTypes", {
|
|
|
20403
20681
|
enableDynamicCharting: bool,
|
|
20404
20682
|
defaultTab: string,
|
|
20405
20683
|
autoChartAggregations: bool,
|
|
20684
|
+
enableQueryInterpretation: bool,
|
|
20685
|
+
defaultShowInterpretation: bool,
|
|
20686
|
+
enableFilterLocking: bool,
|
|
20406
20687
|
// Callbacks
|
|
20407
20688
|
onVisibleChange: func,
|
|
20408
20689
|
onHandleClick: func,
|
|
@@ -20440,6 +20721,9 @@ _defineProperty(DataMessenger, "defaultProps", {
|
|
|
20440
20721
|
enableDynamicCharting: true,
|
|
20441
20722
|
defaultTab: 'data-messenger',
|
|
20442
20723
|
autoChartAggregations: true,
|
|
20724
|
+
enableQueryInterpretation: false,
|
|
20725
|
+
defaultShowInterpretation: false,
|
|
20726
|
+
enableFilterLocking: false,
|
|
20443
20727
|
// Callbacks
|
|
20444
20728
|
onHandleClick: function onHandleClick() {},
|
|
20445
20729
|
onVisibleChange: function onVisibleChange() {},
|
|
@@ -21319,6 +21603,7 @@ var DashboardTile = /*#__PURE__*/function (_React$Component) {
|
|
|
21319
21603
|
renderSuggestionsAsDropdown: _this.props.tile.h < 4,
|
|
21320
21604
|
enableDynamicCharting: _this.props.enableDynamicCharting,
|
|
21321
21605
|
backgroundColor: document.documentElement.style.getPropertyValue('--react-autoql-background-color-primary'),
|
|
21606
|
+
isDashboardQuery: true,
|
|
21322
21607
|
onDisplayTypeUpdate: function onDisplayTypeUpdate() {
|
|
21323
21608
|
// This is necessary to update the toolbar with the newly rendered QueryOutput
|
|
21324
21609
|
setTimeout(function () {
|
|
@@ -21962,6 +22247,7 @@ var Dashboard = /*#__PURE__*/function (_React$Component) {
|
|
|
21962
22247
|
dataFormatting: getDataFormatting(_this.props.dataFormatting),
|
|
21963
22248
|
queryResponse: _this.state.activeDrilldownResponse,
|
|
21964
22249
|
renderTooltips: false,
|
|
22250
|
+
isDashboardQuery: true,
|
|
21965
22251
|
autoChartAggregations: _this.props.autoChartAggregations,
|
|
21966
22252
|
backgroundColor: document.documentElement.style.getPropertyValue('--react-autoql-background-color-primary'),
|
|
21967
22253
|
reportProblemCallback: _this.reportProblemCallback,
|
|
@@ -21983,6 +22269,7 @@ var Dashboard = /*#__PURE__*/function (_React$Component) {
|
|
|
21983
22269
|
dataFormatting: getDataFormatting(_this.props.dataFormatting),
|
|
21984
22270
|
queryResponse: _this.state.activeDrilldownResponse,
|
|
21985
22271
|
renderTooltips: false,
|
|
22272
|
+
isDashboardQuery: true,
|
|
21986
22273
|
autoChartAggregations: _this.props.autoChartAggregations,
|
|
21987
22274
|
backgroundColor: document.documentElement.style.getPropertyValue('--react-autoql-background-color-primary'),
|
|
21988
22275
|
reportProblemCallback: _this.reportProblemCallback,
|
|
@@ -22041,7 +22328,7 @@ var Dashboard = /*#__PURE__*/function (_React$Component) {
|
|
|
22041
22328
|
displayType = tile.secondDisplayType;
|
|
22042
22329
|
dataConfig = tile.secondDataConfig;
|
|
22043
22330
|
} else if (tile && !_this.state.isDrilldownSecondHalf) {
|
|
22044
|
-
title = tile.
|
|
22331
|
+
title = tile.title;
|
|
22045
22332
|
queryResponse = tile.queryResponse;
|
|
22046
22333
|
displayType = tile.displayType;
|
|
22047
22334
|
dataConfig = tile.dataConfig;
|
|
@@ -22080,6 +22367,7 @@ var Dashboard = /*#__PURE__*/function (_React$Component) {
|
|
|
22080
22367
|
queryResponse: queryResponse,
|
|
22081
22368
|
displayType: displayType,
|
|
22082
22369
|
dataConfig: dataConfig,
|
|
22370
|
+
isDashboardQuery: true,
|
|
22083
22371
|
autoChartAggregations: _this.props.autoChartAggregations,
|
|
22084
22372
|
onDataClick: function onDataClick(drilldownData, queryID) {
|
|
22085
22373
|
_this.startDrilldown(drilldownData, queryID, tile.i);
|
|
@@ -22260,4 +22548,215 @@ _defineProperty(Dashboard, "defaultProps", {
|
|
|
22260
22548
|
onChange: function onChange() {}
|
|
22261
22549
|
});
|
|
22262
22550
|
|
|
22551
|
+
var SpeechToTextBtn = /*#__PURE__*/function (_React$Component) {
|
|
22552
|
+
_inherits(SpeechToTextBtn, _React$Component);
|
|
22553
|
+
|
|
22554
|
+
var _super = _createSuper(SpeechToTextBtn);
|
|
22555
|
+
|
|
22556
|
+
function SpeechToTextBtn() {
|
|
22557
|
+
var _this;
|
|
22558
|
+
|
|
22559
|
+
_classCallCheck(this, SpeechToTextBtn);
|
|
22560
|
+
|
|
22561
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
22562
|
+
args[_key] = arguments[_key];
|
|
22563
|
+
}
|
|
22564
|
+
|
|
22565
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
22566
|
+
|
|
22567
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
22568
|
+
isRecording: false,
|
|
22569
|
+
currentQuery: 0,
|
|
22570
|
+
resultHistory: [],
|
|
22571
|
+
currentFile: '',
|
|
22572
|
+
currentBlob: '',
|
|
22573
|
+
showPopoverMessage: false,
|
|
22574
|
+
errorMessage: ''
|
|
22575
|
+
});
|
|
22576
|
+
|
|
22577
|
+
_defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
|
|
22578
|
+
setCSSVars(getThemeConfig(_this.props.themeConfig));
|
|
22579
|
+
});
|
|
22580
|
+
|
|
22581
|
+
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps) {
|
|
22582
|
+
if (_this.props.finalTranscript !== prevProps.finalTranscript) {
|
|
22583
|
+
_this.props.onFinalTranscript(_this.props.finalTranscript);
|
|
22584
|
+
} else if (_this.props.transcript !== prevProps.transcript) {
|
|
22585
|
+
_this.props.onTranscriptChange(_this.props.transcript);
|
|
22586
|
+
} else if (_this.props.interimTranscript !== prevProps.interimTranscript) {
|
|
22587
|
+
_this.props.onTranscriptChange(_this.props.interimTranscript);
|
|
22588
|
+
}
|
|
22589
|
+
});
|
|
22590
|
+
|
|
22591
|
+
_defineProperty(_assertThisInitialized(_this), "startRecording", function () {
|
|
22592
|
+
_this.setState({
|
|
22593
|
+
isRecording: true
|
|
22594
|
+
});
|
|
22595
|
+
|
|
22596
|
+
navigator.getUserMedia({
|
|
22597
|
+
audio: true
|
|
22598
|
+
}, function (stream) {
|
|
22599
|
+
_this.stream = stream;
|
|
22600
|
+
_this.recordAudio = RecordRTC(_this.stream, {
|
|
22601
|
+
type: 'audio',
|
|
22602
|
+
mimeType: 'audio/webm',
|
|
22603
|
+
desiredSampRate: 16000,
|
|
22604
|
+
recorderType: StereoAudioRecorder,
|
|
22605
|
+
numberOfAudioChannels: 1
|
|
22606
|
+
});
|
|
22607
|
+
|
|
22608
|
+
_this.recordAudio.startRecording();
|
|
22609
|
+
}, function (error) {
|
|
22610
|
+
console.error(JSON.stringify(error));
|
|
22611
|
+
});
|
|
22612
|
+
});
|
|
22613
|
+
|
|
22614
|
+
_defineProperty(_assertThisInitialized(_this), "onRecordStop", function (file, blob) {
|
|
22615
|
+
_this.setState({
|
|
22616
|
+
// isConfirmingRecording: true,
|
|
22617
|
+
currentFile: file,
|
|
22618
|
+
currentBlob: blob //hasPlayedBack: false,
|
|
22619
|
+
|
|
22620
|
+
}, function () {
|
|
22621
|
+
_this.sendWavFile(file);
|
|
22622
|
+
});
|
|
22623
|
+
});
|
|
22624
|
+
|
|
22625
|
+
_defineProperty(_assertThisInitialized(_this), "stopRecording", function () {
|
|
22626
|
+
_this.setState({
|
|
22627
|
+
isRecording: false
|
|
22628
|
+
});
|
|
22629
|
+
|
|
22630
|
+
_this.recordAudio.stopRecording(function () {
|
|
22631
|
+
var blob = _this.recordAudio.getBlob();
|
|
22632
|
+
|
|
22633
|
+
_this.onRecordStop(_this.blobToFile(blob), blob);
|
|
22634
|
+
|
|
22635
|
+
try {
|
|
22636
|
+
_this.stream.getTracks().forEach(function (track) {
|
|
22637
|
+
return track.stop();
|
|
22638
|
+
});
|
|
22639
|
+
} catch (error) {
|
|
22640
|
+
console.error(error);
|
|
22641
|
+
}
|
|
22642
|
+
});
|
|
22643
|
+
});
|
|
22644
|
+
|
|
22645
|
+
_defineProperty(_assertThisInitialized(_this), "blobToFile", function (theBlob) {
|
|
22646
|
+
//A Blob() is almost a File() - it's just missing the two properties below which we will add
|
|
22647
|
+
theBlob.lastModifiedDate = new Date();
|
|
22648
|
+
theBlob.name = 'speech.wav';
|
|
22649
|
+
return theBlob;
|
|
22650
|
+
});
|
|
22651
|
+
|
|
22652
|
+
_defineProperty(_assertThisInitialized(_this), "getMediaPermissionStatus", function () {
|
|
22653
|
+
return navigator.permissions.query({
|
|
22654
|
+
name: 'microphone'
|
|
22655
|
+
}).then(function (permissionStatus) {
|
|
22656
|
+
return permissionStatus.state;
|
|
22657
|
+
});
|
|
22658
|
+
});
|
|
22659
|
+
|
|
22660
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function () {
|
|
22661
|
+
ReactTooltip.hide();
|
|
22662
|
+
|
|
22663
|
+
_this.startRecording();
|
|
22664
|
+
});
|
|
22665
|
+
|
|
22666
|
+
_defineProperty(_assertThisInitialized(_this), "sendWavFile", function (file) {
|
|
22667
|
+
var url = "".concat(_this.props.authentication.domain, "/autoql/api/v1/query/speech-to-text?key=").concat(_this.props.authentication.apiKey);
|
|
22668
|
+
var data = new FormData();
|
|
22669
|
+
data.append('file', file, 'speech.wav');
|
|
22670
|
+
var config = {
|
|
22671
|
+
headers: {
|
|
22672
|
+
Authorization: "Bearer ".concat(_this.props.authentication.token)
|
|
22673
|
+
},
|
|
22674
|
+
timeout: 30000
|
|
22675
|
+
};
|
|
22676
|
+
axios.post(url, data, config).then(function (res) {
|
|
22677
|
+
_this.props.onTranscriptChange(res.data.data.transcription);
|
|
22678
|
+
}).catch(function (error) {
|
|
22679
|
+
if (error.response.status === 404) {
|
|
22680
|
+
_this.setState({
|
|
22681
|
+
errorMessage: 'Oops! Speech-to-text has not been enabled. Try typing a query instead.'
|
|
22682
|
+
}, function () {
|
|
22683
|
+
_this.setState({
|
|
22684
|
+
showPopoverMessage: true
|
|
22685
|
+
});
|
|
22686
|
+
});
|
|
22687
|
+
} else {
|
|
22688
|
+
_this.setState({
|
|
22689
|
+
errorMessage: 'Oops! Something wrong with your account'
|
|
22690
|
+
}, function () {
|
|
22691
|
+
_this.setState({
|
|
22692
|
+
showPopoverMessage: true
|
|
22693
|
+
});
|
|
22694
|
+
});
|
|
22695
|
+
}
|
|
22696
|
+
});
|
|
22697
|
+
});
|
|
22698
|
+
|
|
22699
|
+
_defineProperty(_assertThisInitialized(_this), "render", function () {
|
|
22700
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Popover, {
|
|
22701
|
+
isOpen: _this.state.showPopoverMessage,
|
|
22702
|
+
padding: 20,
|
|
22703
|
+
content: function content() {
|
|
22704
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22705
|
+
style: {
|
|
22706
|
+
backgroundColor: '#FFD2D2',
|
|
22707
|
+
opacity: 1,
|
|
22708
|
+
paddingLeft: '10px',
|
|
22709
|
+
paddingRight: '10px'
|
|
22710
|
+
}
|
|
22711
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
22712
|
+
type: "warning-triangle"
|
|
22713
|
+
}), " ", _this.state.errorMessage);
|
|
22714
|
+
},
|
|
22715
|
+
onClickOutside: function onClickOutside() {
|
|
22716
|
+
return _this.setState({
|
|
22717
|
+
showPopoverMessage: false
|
|
22718
|
+
});
|
|
22719
|
+
}
|
|
22720
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
22721
|
+
id: "react-autoql-voice-record-button",
|
|
22722
|
+
"data-test": "speech-to-text-btn",
|
|
22723
|
+
className: "chat-voice-record-button".concat(_this.state.isRecording ? ' listening' : ''),
|
|
22724
|
+
onMouseDown: _this.onMouseDown,
|
|
22725
|
+
onMouseUp: _this.stopRecording,
|
|
22726
|
+
onMouseLeave: _this.state.isRecording ? _this.stopRecording : undefined,
|
|
22727
|
+
"data-tip": "Hold for voice-to-text",
|
|
22728
|
+
"data-for": "react-autoql-speech-to-text-tooltip",
|
|
22729
|
+
"data-tip-disable": _this.state.isRecording
|
|
22730
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
22731
|
+
type: "microphone"
|
|
22732
|
+
}))), /*#__PURE__*/React.createElement(ReactTooltip, {
|
|
22733
|
+
className: "react-autoql-tooltip",
|
|
22734
|
+
id: "react-autoql-speech-to-text-tooltip",
|
|
22735
|
+
effect: "solid",
|
|
22736
|
+
delayShow: 800
|
|
22737
|
+
}));
|
|
22738
|
+
});
|
|
22739
|
+
|
|
22740
|
+
return _this;
|
|
22741
|
+
}
|
|
22742
|
+
|
|
22743
|
+
return SpeechToTextBtn;
|
|
22744
|
+
}(React.Component);
|
|
22745
|
+
|
|
22746
|
+
_defineProperty(SpeechToTextBtn, "propTypes", {
|
|
22747
|
+
authentication: authenticationType,
|
|
22748
|
+
themeConfig: themeConfigType,
|
|
22749
|
+
transcript: PropTypes.string,
|
|
22750
|
+
interimTranscript: PropTypes.string,
|
|
22751
|
+
finalTranscript: PropTypes.string,
|
|
22752
|
+
resetTranscript: PropTypes.func,
|
|
22753
|
+
onTranscriptChange: PropTypes.func,
|
|
22754
|
+
onFinalTranscript: PropTypes.func
|
|
22755
|
+
});
|
|
22756
|
+
|
|
22757
|
+
_defineProperty(SpeechToTextBtn, "defaultProps", {
|
|
22758
|
+
authentication: authenticationDefault,
|
|
22759
|
+
themeConfig: themeConfigDefault
|
|
22760
|
+
});
|
|
22761
|
+
|
|
22263
22762
|
export { Dashboard, DashboardTile, DataAlertModal, DataAlerts, DataMessenger, ExpressionBuilder, ExpressionBuilderSimple, Icon, LoadingDots, NotificationFeed, NotificationIcon, NotificationItem, QueryInput, QueryOutput, ScheduleBuilder, SpeechToTextBtn as SpeechToTextButton, SpeechToTextButtonBrowser, executeDashboard, fetchQueryTips, getDefaultDisplayType, getSupportedDisplayTypes, isDisplayTypeValid, unExecuteDashboard };
|