react-autoql 3.4.6 → 3.5.0

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.
@@ -6,16 +6,17 @@ 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';
12
13
  import { BsArrowBarDown, BsArrowBarUp } from 'react-icons/bs';
13
14
  import { BiLineChart } from 'react-icons/bi';
14
- import { MdError, MdPlayCircleOutline, MdLock, MdInfoOutline, MdContentCopy, MdClose } from 'react-icons/md';
15
+ import { MdError, MdLockOpen, MdPlayCircleOutline, MdLock, MdInfoOutline, MdContentCopy, MdClose } from 'react-icons/md';
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,10 +31,12 @@ 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';
37
- import RecordRTC, { StereoAudioRecorder } from 'recordrtc';
39
+ import SpeechRecognition from 'react-speech-recognition';
38
40
  import { ReactTabulator } from 'react-tabulator';
39
41
  import 'react-tabulator/lib/styles.css';
40
42
  import 'react-tabulator/css/bootstrap/tabulator_bootstrap.min.css';
@@ -46,18 +48,19 @@ 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 _includes from 'lodash.includes';
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';
57
60
  import SplitterLayout from 'react-splitter-layout';
58
61
  import 'react-grid-layout/css/styles.css';
59
62
  import 'react-splitter-layout/lib/index.css';
60
- import SpeechRecognition from 'react-speech-recognition';
63
+ import RecordRTC, { StereoAudioRecorder } from 'recordrtc';
61
64
 
62
65
  function ownKeys(object, enumerableOnly) {
63
66
  var keys = Object.keys(object);
@@ -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
- formattedLabel = Numbro(d).format({
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
- formattedElement = Numbro(element).format('0.00%');
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,9 @@ var lang = new LocalizedStrings({
1656
1721
  queryPrompt: 'Type your queries here ',
1657
1722
  seeMore: 'See more',
1658
1723
  dataMessengerOptions: 'Options menu',
1659
- openConditionLocking: 'Open condition locking menu',
1660
- closeConditionLocking: 'Close condition locking menu',
1724
+ openFilterLocking: 'Open filter locking menu',
1725
+ closeFilterLocking: 'Close filter menu',
1726
+ noFiltersLocked: 'No Filters are locked yet',
1661
1727
  clearDataResponses: 'Clear all queries & responses',
1662
1728
  closeDataMessenger: 'Close Data Messenger',
1663
1729
  searchQueries: 'Search relevant queries by topic',
@@ -1694,8 +1760,9 @@ var lang = new LocalizedStrings({
1694
1760
  queryPrompt: 'Escribe tus consultas aquí',
1695
1761
  seeMore: 'Ver más',
1696
1762
  dataMessengerOptions: 'Menú de opciones',
1697
- openConditionLocking: 'Abrir menú de bloqueo de condición',
1698
- closeConditionLocking: 'Cerrar menú de bloqueo de condición',
1763
+ openFilterLocking: 'Abrir menú de filtrar',
1764
+ closeFilterLocking: 'Cerrar menú de filtrar',
1765
+ noFiltersLocked: 'Ningún filtro está bloqueado todavía',
1699
1766
  clearDataResponses: 'Borrar todas las consultas y respuestas',
1700
1767
  closeDataMessenger: 'Cerrar Data mesenger',
1701
1768
  searchQueries: 'Buscar consultas relevantes por tema',
@@ -2175,6 +2242,18 @@ var Icon = /*#__PURE__*/function (_React$Component) {
2175
2242
  break;
2176
2243
  }
2177
2244
 
2245
+ case 'caret-down':
2246
+ {
2247
+ icon = /*#__PURE__*/React.createElement(AiFillCaretDown, null);
2248
+ break;
2249
+ }
2250
+
2251
+ case 'caret-up':
2252
+ {
2253
+ icon = /*#__PURE__*/React.createElement(AiFillCaretUp, null);
2254
+ break;
2255
+ }
2256
+
2178
2257
  case 'react-autoql-bubbles':
2179
2258
  {
2180
2259
  icon = /*#__PURE__*/React.createElement("img", {
@@ -2514,6 +2593,12 @@ var Icon = /*#__PURE__*/function (_React$Component) {
2514
2593
  break;
2515
2594
  }
2516
2595
 
2596
+ case 'unlock':
2597
+ {
2598
+ icon = /*#__PURE__*/React.createElement(MdLockOpen, null);
2599
+ break;
2600
+ }
2601
+
2517
2602
  case 'warning':
2518
2603
  {
2519
2604
  icon = /*#__PURE__*/React.createElement(MdError, null);
@@ -2715,19 +2800,39 @@ var runQueryOnly = function runQueryOnly() {
2715
2800
  source = _ref4.source,
2716
2801
  AutoAEId = _ref4.AutoAEId;
2717
2802
 
2718
- var url; // if(window.location.href.includes('localhost') || window.location.href.includes('chata-ai-test-page')) {
2719
- // url = `${domain}/autoql/api/v2/query?key=${apiKey}`
2720
- // } else {
2803
+ var url = "".concat(domain, "/autoql/api/v1/query?key=").concat(apiKey);
2804
+ var finalUserSelection = transformUserSelection(userSelection);
2805
+ var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
2806
+ var conditions = {};
2807
+
2808
+ if (sessionConditions !== null) {
2809
+ var _loop = function _loop(i) {
2810
+ if (Object.keys(conditions).some(function (item) {
2811
+ return item === sessionConditions[i].key;
2812
+ })) {
2813
+ item = Object.keys(conditions).find(function (key) {
2814
+ return key === sessionConditions[i].key;
2815
+ });
2816
+ conditions[item].push(sessionConditions[i].value);
2817
+ } else {
2818
+ conditions[sessionConditions[i].key] = [sessionConditions[i].value];
2819
+ }
2820
+ };
2821
+
2822
+ for (var i = 0; i < sessionConditions.length; i++) {
2823
+ var item;
2721
2824
 
2722
- url = "".concat(domain, "/autoql/api/v1/query?key=").concat(apiKey); // }
2825
+ _loop(i);
2826
+ }
2827
+ }
2723
2828
 
2724
- var finalUserSelection = transformUserSelection(userSelection);
2725
2829
  var data = {
2726
2830
  text: query,
2727
2831
  source: formatSourceString(source),
2728
2832
  translation: debug ? 'include' : 'exclude',
2729
2833
  user_selection: finalUserSelection,
2730
- test: test
2834
+ test: test,
2835
+ session_locked_conditions: conditions
2731
2836
  };
2732
2837
 
2733
2838
  if (!query || !query.trim()) {
@@ -2992,10 +3097,9 @@ var fetchConditions = function fetchConditions() {
2992
3097
  token = _ref10.token,
2993
3098
  domain = _ref10.domain;
2994
3099
 
2995
- if (!domain || !apiKey || !token) {
2996
- return Promise.reject(new Error('Unauthenticated'));
2997
- }
2998
-
3100
+ // if (!domain || !apiKey || !token) {
3101
+ // return Promise.reject(new Error('Unauthenticated'))
3102
+ // }
2999
3103
  var url = "".concat(domain, "/autoql/api/v1/query/condition-locking?key=").concat(apiKey);
3000
3104
  var config = {
3001
3105
  headers: {
@@ -3031,8 +3135,7 @@ var setConditions = function setConditions() {
3031
3135
  array.push({
3032
3136
  key: obj.key,
3033
3137
  keyword: obj.keyword,
3034
- // lock_flag: obj.lock_flag,
3035
- lock_flag: 1,
3138
+ lock_flag: obj.lock_flag,
3036
3139
  show_message: obj.show_message,
3037
3140
  value: obj.value
3038
3141
  });
@@ -3305,15 +3408,24 @@ _defineProperty(Dictaphone, "defaultProps", {});
3305
3408
 
3306
3409
  var SpeechToTextButtonBrowser = SpeechRecognition(options$1)(Dictaphone);
3307
3410
 
3308
- var SpeechToTextBtn = /*#__PURE__*/function (_React$Component) {
3309
- _inherits(SpeechToTextBtn, _React$Component);
3411
+ function LoadingDots() {
3412
+ return /*#__PURE__*/React.createElement("div", {
3413
+ className: "response-loading",
3414
+ "data-test": "loading-dots"
3415
+ }, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null));
3416
+ }
3310
3417
 
3311
- var _super = _createSuper(SpeechToTextBtn);
3418
+ var autoCompleteArray$2 = [];
3312
3419
 
3313
- function SpeechToTextBtn() {
3420
+ var QueryInput = /*#__PURE__*/function (_React$Component) {
3421
+ _inherits(QueryInput, _React$Component);
3422
+
3423
+ var _super = _createSuper(QueryInput);
3424
+
3425
+ function QueryInput() {
3314
3426
  var _this;
3315
3427
 
3316
- _classCallCheck(this, SpeechToTextBtn);
3428
+ _classCallCheck(this, QueryInput);
3317
3429
 
3318
3430
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3319
3431
  args[_key] = arguments[_key];
@@ -3321,14 +3433,15 @@ var SpeechToTextBtn = /*#__PURE__*/function (_React$Component) {
3321
3433
 
3322
3434
  _this = _super.call.apply(_super, [this].concat(args));
3323
3435
 
3436
+ _defineProperty(_assertThisInitialized(_this), "UNIQUE_ID", uuid.v4());
3437
+
3438
+ _defineProperty(_assertThisInitialized(_this), "autoCompleteTimer", undefined);
3439
+
3324
3440
  _defineProperty(_assertThisInitialized(_this), "state", {
3325
- isRecording: false,
3326
- currentQuery: 0,
3327
- resultHistory: [],
3328
- currentFile: '',
3329
- currentBlob: '',
3330
- showPopoverMessage: false,
3331
- errorMessage: ''
3441
+ inputValue: '',
3442
+ lastQuery: '',
3443
+ suggestions: [],
3444
+ isQueryRunning: false
3332
3445
  });
3333
3446
 
3334
3447
  _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
@@ -3336,313 +3449,99 @@ var SpeechToTextBtn = /*#__PURE__*/function (_React$Component) {
3336
3449
  });
3337
3450
 
3338
3451
  _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps) {
3339
- if (_this.props.finalTranscript !== prevProps.finalTranscript) {
3340
- _this.props.onFinalTranscript(_this.props.finalTranscript);
3341
- } else if (_this.props.transcript !== prevProps.transcript) {
3342
- _this.props.onTranscriptChange(_this.props.transcript);
3343
- } else if (_this.props.interimTranscript !== prevProps.interimTranscript) {
3344
- _this.props.onTranscriptChange(_this.props.interimTranscript);
3452
+ if (!_isEqual(getThemeConfig(_this.props.themeConfig), getThemeConfig(prevProps.themeConfig))) {
3453
+ setCSSVars(getThemeConfig(_this.props.themeConfig));
3345
3454
  }
3346
3455
  });
3347
3456
 
3348
- _defineProperty(_assertThisInitialized(_this), "startRecording", function () {
3349
- _this.setState({
3350
- isRecording: true
3351
- });
3352
-
3353
- navigator.getUserMedia({
3354
- audio: true
3355
- }, function (stream) {
3356
- _this.stream = stream;
3357
- _this.recordAudio = RecordRTC(_this.stream, {
3358
- type: 'audio',
3359
- mimeType: 'audio/webm',
3360
- desiredSampRate: 16000,
3361
- recorderType: StereoAudioRecorder,
3362
- numberOfAudioChannels: 1
3363
- });
3364
-
3365
- _this.recordAudio.startRecording();
3366
- }, function (error) {
3367
- console.error(JSON.stringify(error));
3368
- });
3369
- });
3370
-
3371
- _defineProperty(_assertThisInitialized(_this), "onRecordStop", function (file, blob) {
3372
- _this.setState({
3373
- // isConfirmingRecording: true,
3374
- currentFile: file,
3375
- currentBlob: blob //hasPlayedBack: false,
3457
+ _defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
3458
+ if (_this.autoCompleteTimer) {
3459
+ clearTimeout(_this.autoCompleteTimer);
3460
+ }
3376
3461
 
3377
- }, function () {
3378
- _this.sendWavFile(file);
3379
- });
3462
+ if (_this.queryValidationTimer) {
3463
+ clearTimeout(_this.queryValidationTimer);
3464
+ }
3380
3465
  });
3381
3466
 
3382
- _defineProperty(_assertThisInitialized(_this), "stopRecording", function () {
3383
- _this.setState({
3384
- isRecording: false
3385
- });
3467
+ _defineProperty(_assertThisInitialized(_this), "animateInputTextAndSubmit", function (_ref) {
3468
+ var query = _ref.query,
3469
+ userSelection = _ref.userSelection;
3470
+ _ref.skipQueryValidation;
3471
+ var source = _ref.source;
3386
3472
 
3387
- _this.recordAudio.stopRecording(function () {
3388
- var blob = _this.recordAudio.getBlob();
3473
+ if (typeof query === 'string' && _get(query, 'length')) {
3474
+ var _loop = function _loop(i) {
3475
+ setTimeout(function () {
3476
+ _this.setState({
3477
+ inputValue: query.slice(0, i)
3478
+ });
3389
3479
 
3390
- _this.onRecordStop(_this.blobToFile(blob), blob);
3480
+ if (i === query.length) {
3481
+ setTimeout(function () {
3482
+ _this.submitQuery({
3483
+ queryText: query,
3484
+ userSelection: userSelection,
3485
+ skipQueryValidation: true,
3486
+ source: source
3487
+ });
3488
+ }, 300);
3489
+ }
3490
+ }, i * 50);
3491
+ };
3391
3492
 
3392
- try {
3393
- _this.stream.getTracks().forEach(function (track) {
3394
- return track.stop();
3395
- });
3396
- } catch (error) {
3397
- console.error(error);
3493
+ for (var i = 1; i <= query.length; i++) {
3494
+ _loop(i);
3398
3495
  }
3399
- });
3496
+ }
3400
3497
  });
3401
3498
 
3402
- _defineProperty(_assertThisInitialized(_this), "blobToFile", function (theBlob) {
3403
- //A Blob() is almost a File() - it's just missing the two properties below which we will add
3404
- theBlob.lastModifiedDate = new Date();
3405
- theBlob.name = 'speech.wav';
3406
- return theBlob;
3407
- });
3499
+ _defineProperty(_assertThisInitialized(_this), "submitQuery", function () {
3500
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3501
+ queryText = _ref2.queryText,
3502
+ userSelection = _ref2.userSelection,
3503
+ skipQueryValidation = _ref2.skipQueryValidation,
3504
+ source = _ref2.source;
3408
3505
 
3409
- _defineProperty(_assertThisInitialized(_this), "getMediaPermissionStatus", function () {
3410
- return navigator.permissions.query({
3411
- name: 'microphone'
3412
- }).then(function (permissionStatus) {
3413
- return permissionStatus.state;
3506
+ // Cancel subscription to autocomplete since query was already submitted
3507
+ if (_this.autoCompleteTimer) {
3508
+ clearTimeout(_this.autoCompleteTimer);
3509
+ }
3510
+
3511
+ _this.setState({
3512
+ isQueryRunning: true,
3513
+ inputValue: '',
3514
+ suggestions: [],
3515
+ queryValidationResponse: undefined,
3516
+ queryValidationComponentId: uuid.v4()
3414
3517
  });
3415
- });
3416
3518
 
3417
- _defineProperty(_assertThisInitialized(_this), "onMouseDown", function () {
3418
- ReactTooltip.hide();
3519
+ var query = queryText || _this.state.inputValue;
3520
+ var newSource = [].concat(_toConsumableArray(_this.props.source), [source || 'user']);
3419
3521
 
3420
- _this.startRecording();
3421
- });
3522
+ if (query.trim()) {
3523
+ _this.props.onSubmit(query);
3524
+
3525
+ if (skipQueryValidation) {
3526
+ runQueryOnly(_objectSpread2(_objectSpread2(_objectSpread2({
3527
+ query: query,
3528
+ userSelection: userSelection
3529
+ }, getAuthentication(_this.props.authentication)), getAutoQLConfig$1(_this.props.autoQLConfig)), {}, {
3530
+ source: newSource,
3531
+ AutoAEId: _this.props.AutoAEId
3532
+ })).then(function (response) {
3533
+ _this.props.onResponseCallback(response, query);
3422
3534
 
3423
- _defineProperty(_assertThisInitialized(_this), "sendWavFile", function (file) {
3424
- var url = "".concat(_this.props.authentication.domain, "/autoql/api/v1/query/speech-to-text?key=").concat(_this.props.authentication.apiKey);
3425
- var data = new FormData();
3426
- data.append('file', file, 'speech.wav');
3427
- var config = {
3428
- headers: {
3429
- Authorization: "Bearer ".concat(_this.props.authentication.token)
3430
- },
3431
- timeout: 30000
3432
- };
3433
- axios.post(url, data, config).then(function (res) {
3434
- _this.props.onTranscriptChange(res.data.data.transcription);
3435
- }).catch(function (error) {
3436
- if (error.response.status === 404) {
3437
- _this.setState({
3438
- errorMessage: 'Oops! Speech-to-text has not been enabled. Try typing a query instead.'
3439
- }, function () {
3440
3535
  _this.setState({
3441
- showPopoverMessage: true
3536
+ isQueryRunning: false
3442
3537
  });
3443
- });
3444
- } else {
3445
- _this.setState({
3446
- errorMessage: 'Oops! Something wrong with your account'
3447
- }, function () {
3538
+ }).catch(function (error) {
3539
+ console.error(error);
3540
+
3541
+ _this.props.onResponseCallback(error);
3542
+
3448
3543
  _this.setState({
3449
- showPopoverMessage: true
3450
- });
3451
- });
3452
- }
3453
- });
3454
- });
3455
-
3456
- _defineProperty(_assertThisInitialized(_this), "render", function () {
3457
- return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Popover, {
3458
- isOpen: _this.state.showPopoverMessage,
3459
- padding: 20,
3460
- content: function content() {
3461
- return /*#__PURE__*/React.createElement("div", {
3462
- style: {
3463
- backgroundColor: '#FFD2D2',
3464
- opacity: 1,
3465
- paddingLeft: '10px',
3466
- paddingRight: '10px'
3467
- }
3468
- }, /*#__PURE__*/React.createElement(Icon, {
3469
- type: "warning-triangle"
3470
- }), " ", _this.state.errorMessage);
3471
- },
3472
- onClickOutside: function onClickOutside() {
3473
- return _this.setState({
3474
- showPopoverMessage: false
3475
- });
3476
- }
3477
- }, /*#__PURE__*/React.createElement("button", {
3478
- id: "react-autoql-voice-record-button",
3479
- "data-test": "speech-to-text-btn",
3480
- className: "chat-voice-record-button".concat(_this.state.isRecording ? ' listening' : ''),
3481
- onMouseDown: _this.onMouseDown,
3482
- onMouseUp: _this.stopRecording,
3483
- onMouseLeave: _this.state.isRecording ? _this.stopRecording : undefined,
3484
- "data-tip": "Hold for voice-to-text",
3485
- "data-for": "react-autoql-speech-to-text-tooltip",
3486
- "data-tip-disable": _this.state.isRecording
3487
- }, /*#__PURE__*/React.createElement(Icon, {
3488
- type: "microphone"
3489
- }))), /*#__PURE__*/React.createElement(ReactTooltip, {
3490
- className: "react-autoql-tooltip",
3491
- id: "react-autoql-speech-to-text-tooltip",
3492
- effect: "solid",
3493
- delayShow: 800
3494
- }));
3495
- });
3496
-
3497
- return _this;
3498
- }
3499
-
3500
- return SpeechToTextBtn;
3501
- }(React.Component);
3502
-
3503
- _defineProperty(SpeechToTextBtn, "propTypes", {
3504
- authentication: authenticationType,
3505
- themeConfig: themeConfigType,
3506
- transcript: PropTypes.string,
3507
- interimTranscript: PropTypes.string,
3508
- finalTranscript: PropTypes.string,
3509
- resetTranscript: PropTypes.func,
3510
- onTranscriptChange: PropTypes.func,
3511
- onFinalTranscript: PropTypes.func
3512
- });
3513
-
3514
- _defineProperty(SpeechToTextBtn, "defaultProps", {
3515
- authentication: authenticationDefault,
3516
- themeConfig: themeConfigDefault
3517
- });
3518
-
3519
- function LoadingDots() {
3520
- return /*#__PURE__*/React.createElement("div", {
3521
- className: "response-loading",
3522
- "data-test": "loading-dots"
3523
- }, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null));
3524
- }
3525
-
3526
- var autoCompleteArray$2 = [];
3527
-
3528
- var QueryInput = /*#__PURE__*/function (_React$Component) {
3529
- _inherits(QueryInput, _React$Component);
3530
-
3531
- var _super = _createSuper(QueryInput);
3532
-
3533
- function QueryInput() {
3534
- var _this;
3535
-
3536
- _classCallCheck(this, QueryInput);
3537
-
3538
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3539
- args[_key] = arguments[_key];
3540
- }
3541
-
3542
- _this = _super.call.apply(_super, [this].concat(args));
3543
-
3544
- _defineProperty(_assertThisInitialized(_this), "UNIQUE_ID", uuid.v4());
3545
-
3546
- _defineProperty(_assertThisInitialized(_this), "autoCompleteTimer", undefined);
3547
-
3548
- _defineProperty(_assertThisInitialized(_this), "state", {
3549
- inputValue: '',
3550
- lastQuery: '',
3551
- suggestions: [],
3552
- isQueryRunning: false
3553
- });
3554
-
3555
- _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
3556
- setCSSVars(getThemeConfig(_this.props.themeConfig));
3557
- });
3558
-
3559
- _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps) {
3560
- if (!_isEqual(getThemeConfig(_this.props.themeConfig), getThemeConfig(prevProps.themeConfig))) {
3561
- setCSSVars(getThemeConfig(_this.props.themeConfig));
3562
- }
3563
- });
3564
-
3565
- _defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
3566
- if (_this.autoCompleteTimer) {
3567
- clearTimeout(_this.autoCompleteTimer);
3568
- }
3569
- });
3570
-
3571
- _defineProperty(_assertThisInitialized(_this), "animateInputTextAndSubmit", function (_ref) {
3572
- var query = _ref.query,
3573
- userSelection = _ref.userSelection;
3574
- _ref.skipQueryValidation;
3575
- var source = _ref.source;
3576
-
3577
- if (typeof query === 'string' && _get(query, 'length')) {
3578
- var _loop = function _loop(i) {
3579
- setTimeout(function () {
3580
- _this.setState({
3581
- inputValue: query.slice(0, i)
3582
- });
3583
-
3584
- if (i === query.length) {
3585
- setTimeout(function () {
3586
- _this.submitQuery({
3587
- queryText: query,
3588
- userSelection: userSelection,
3589
- skipQueryValidation: true,
3590
- source: source
3591
- });
3592
- }, 300);
3593
- }
3594
- }, i * 50);
3595
- };
3596
-
3597
- for (var i = 1; i <= query.length; i++) {
3598
- _loop(i);
3599
- }
3600
- }
3601
- });
3602
-
3603
- _defineProperty(_assertThisInitialized(_this), "submitQuery", function () {
3604
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3605
- queryText = _ref2.queryText,
3606
- userSelection = _ref2.userSelection,
3607
- skipQueryValidation = _ref2.skipQueryValidation,
3608
- source = _ref2.source;
3609
-
3610
- // Cancel subscription to autocomplete since query was already submitted
3611
- if (_this.autoCompleteTimer) {
3612
- clearTimeout(_this.autoCompleteTimer);
3613
- }
3614
-
3615
- var query = queryText || _this.state.inputValue;
3616
- var newSource = [].concat(_toConsumableArray(_this.props.source), [source || 'user']);
3617
-
3618
- _this.setState({
3619
- isQueryRunning: true,
3620
- inputValue: ''
3621
- });
3622
-
3623
- if (query.trim()) {
3624
- _this.props.onSubmit(query);
3625
-
3626
- if (skipQueryValidation) {
3627
- runQueryOnly(_objectSpread2(_objectSpread2(_objectSpread2({
3628
- query: query,
3629
- userSelection: userSelection
3630
- }, getAuthentication(_this.props.authentication)), getAutoQLConfig$1(_this.props.autoQLConfig)), {}, {
3631
- source: newSource,
3632
- AutoAEId: _this.props.AutoAEId
3633
- })).then(function (response) {
3634
- _this.props.onResponseCallback(response, query);
3635
-
3636
- _this.setState({
3637
- isQueryRunning: false
3638
- });
3639
- }).catch(function (error) {
3640
- console.error(error);
3641
-
3642
- _this.props.onResponseCallback(error);
3643
-
3644
- _this.setState({
3645
- isQueryRunning: false
3544
+ isQueryRunning: false
3646
3545
  });
3647
3546
  });
3648
3547
  } else {
@@ -3712,6 +3611,9 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3712
3611
  });
3713
3612
 
3714
3613
  _defineProperty(_assertThisInitialized(_this), "focus", function () {
3614
+ // if (this.queryValidationInputRef) {
3615
+ // this.queryValidationInputRef.focus()
3616
+ // }
3715
3617
  if (_this.inputRef) {
3716
3618
  _this.inputRef.focus();
3717
3619
  } else {
@@ -3734,8 +3636,37 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3734
3636
  }
3735
3637
  });
3736
3638
 
3737
- _defineProperty(_assertThisInitialized(_this), "onSuggestionsFetchRequested", function (_ref3) {
3738
- var value = _ref3.value;
3639
+ _defineProperty(_assertThisInitialized(_this), "runQueryValidation", function (_ref3) {
3640
+ var text = _ref3.text;
3641
+
3642
+ // Reset validation configuration since text has changed
3643
+ _this.setState({
3644
+ queryValidationResponse: undefined,
3645
+ queryValidationComponentId: uuid.v4()
3646
+ });
3647
+
3648
+ if (_this.queryValidationTimer) {
3649
+ clearTimeout(_this.queryValidationTimer);
3650
+ }
3651
+
3652
+ _this.queryValidationTimer = setTimeout(function () {
3653
+ runQueryValidation(_objectSpread2({
3654
+ text: text
3655
+ }, getAuthentication(_this.props.authentication))).then(function (response) {
3656
+ if (_this.state.inputValue === _get(response, 'data.data.query')) {
3657
+ _this.setState({
3658
+ queryValidationResponse: response,
3659
+ queryValidationComponentId: uuid.v4()
3660
+ });
3661
+ }
3662
+ }).catch(function (error) {
3663
+ console.error(error);
3664
+ });
3665
+ }, 300);
3666
+ });
3667
+
3668
+ _defineProperty(_assertThisInitialized(_this), "onSuggestionsFetchRequested", function (_ref4) {
3669
+ var value = _ref4.value;
3739
3670
 
3740
3671
  if (_this.autoCompleteTimer) {
3741
3672
  clearTimeout(_this.autoCompleteTimer);
@@ -3787,6 +3718,8 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3787
3718
  });
3788
3719
 
3789
3720
  _defineProperty(_assertThisInitialized(_this), "onInputChange", function (e) {
3721
+ //WIP
3722
+ // this.runQueryValidation({ text: e.target.value })
3790
3723
  if (_this.userSelectedSuggestion && (e.keyCode === 38 || e.keyCode === 40)) {
3791
3724
  // keyup or keydown
3792
3725
  return; // return to let the component handle it...
@@ -3814,14 +3747,16 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3814
3747
  return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("div", {
3815
3748
  className: "react-autoql-bar-container ".concat(_this.props.className, " ").concat(_this.props.autoCompletePlacement === 'below' ? 'autosuggest-bottom' : 'autosuggest-top'),
3816
3749
  "data-test": "chat-bar"
3750
+ }, /*#__PURE__*/React.createElement("div", {
3751
+ className: "react-autoql-chatbar-input-container"
3817
3752
  }, getAutoQLConfig$1(_this.props.autoQLConfig).enableAutocomplete ? /*#__PURE__*/React.createElement(Autosuggest, {
3818
- className: "auto-complete-chata",
3753
+ lassName: "auto-complete-chata",
3819
3754
  onSuggestionsFetchRequested: _this.onSuggestionsFetchRequested,
3820
3755
  onSuggestionsClearRequested: _this.onSuggestionsClearRequested,
3821
3756
  getSuggestionValue: _this.userSelectedSuggestionHandler,
3822
3757
  suggestions: _this.state.suggestions,
3823
- ref: function ref(_ref4) {
3824
- _this.autoSuggest = _ref4;
3758
+ ref: function ref(_ref5) {
3759
+ _this.autoSuggest = _ref5;
3825
3760
  },
3826
3761
  renderSuggestion: function renderSuggestion(suggestion) {
3827
3762
  return /*#__PURE__*/React.createElement(Fragment, null, suggestion.name);
@@ -3837,9 +3772,24 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3837
3772
  onFocus: _this.moveCaretAtEnd,
3838
3773
  autoFocus: true
3839
3774
  }
3840
- }) : /*#__PURE__*/React.createElement("div", {
3841
- className: "react-autoql-chatbar-input-container"
3842
- }, /*#__PURE__*/React.createElement("input", {
3775
+ }) // <QueryInputWithValidation
3776
+ // authentication={getAuthentication(this.props.authentication)}
3777
+ // themeConfig={getThemeConfig(this.props.themeConfig)}
3778
+ // ref={(ref) => (this.queryValidationInputRef = ref)}
3779
+ // key={this.state.queryValidationComponentId}
3780
+ // response={this.state.queryValidationResponse}
3781
+ // placeholder={this.props.placeholder}
3782
+ // disabled={this.props.isDisabled}
3783
+ // showChataIcon={this.props.showChataIcon}
3784
+ // showLoadingDots={this.props.showLoadingDots}
3785
+ // submitQuery={this.submitQuery}
3786
+ // onKeyDown={this.onKeyDown}
3787
+ // onQueryValidationSelectOption={(query) => {
3788
+ // this.setState({ inputValue: query })
3789
+ // this.focus()
3790
+ // }}
3791
+ // />
3792
+ : /*#__PURE__*/React.createElement("input", {
3843
3793
  className: "react-autoql-chatbar-input".concat(_this.props.showChataIcon ? ' left-padding' : ''),
3844
3794
  placeholder: _this.props.placeholder || 'Type your queries here',
3845
3795
  value: _this.state.inputValue,
@@ -3861,19 +3811,21 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3861
3811
  type: "react-autoql-bubbles-outlined"
3862
3812
  })), _this.props.showLoadingDots && _this.state.isQueryRunning && /*#__PURE__*/React.createElement("div", {
3863
3813
  className: "input-response-loading-container"
3864
- }, /*#__PURE__*/React.createElement(LoadingDots, null)), _this.props.enableVoiceRecord && /*#__PURE__*/React.createElement(SpeechToTextBtn, {
3865
- onTranscriptChange: _this.onTranscriptChange,
3866
- onFinalTranscript: _this.onFinalTranscript,
3867
- themeConfig: _this.props.themeConfig,
3868
- authentication: getAuthentication(_this.props.authentication)
3869
- }) // KEEP THIS FOR NOW
3870
- // <SpeechToTextButtonBrowser
3814
+ }, /*#__PURE__*/React.createElement(LoadingDots, null)), _this.props.enableVoiceRecord &&
3815
+ /*#__PURE__*/
3816
+ // KEEP THIS FOR NOW
3817
+ // <SpeechToTextBtn
3871
3818
  // onTranscriptChange={this.onTranscriptChange}
3872
3819
  // onFinalTranscript={this.onFinalTranscript}
3873
3820
  // themeConfig={this.props.themeConfig}
3874
3821
  // authentication={getAuthentication(this.props.authentication)}
3875
3822
  // />
3876
- ));
3823
+ React.createElement(SpeechToTextButtonBrowser, {
3824
+ onTranscriptChange: _this.onTranscriptChange,
3825
+ onFinalTranscript: _this.onFinalTranscript,
3826
+ themeConfig: _this.props.themeConfig,
3827
+ authentication: getAuthentication(_this.props.authentication)
3828
+ })));
3877
3829
  });
3878
3830
 
3879
3831
  return _this;
@@ -3999,7 +3951,7 @@ var ChataTable = /*#__PURE__*/function (_React$Component) {
3999
3951
  _defineProperty(_assertThisInitialized(_this), "saveAsCSV", function () {
4000
3952
  if (_this.ref && _this.ref.table) {
4001
3953
  _this.ref.table.download('csv', 'table.csv', {
4002
- delimiter: '\t'
3954
+ delimiter: ','
4003
3955
  });
4004
3956
  }
4005
3957
  });
@@ -4067,7 +4019,7 @@ var ChataTable = /*#__PURE__*/function (_React$Component) {
4067
4019
  options: options,
4068
4020
  "data-custom-attr": "test-custom-attribute",
4069
4021
  className: "react-autoql-table",
4070
- height: "100%",
4022
+ height: "98%",
4071
4023
  clipboard: true,
4072
4024
  download: true
4073
4025
  })));
@@ -7522,6 +7474,7 @@ var Button = /*#__PURE__*/function (_React$Component) {
7522
7474
  return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("button", {
7523
7475
  className: "react-autoql-btn\n ".concat(_this.props.className || '', "\n ").concat(type, "\n ").concat(size, "\n ").concat(isDisabled ? ' disabled' : ''),
7524
7476
  "data-test": "react-autoql-btn",
7477
+ "data-multiline": _this.props.multiline,
7525
7478
  style: _objectSpread2({}, _this.props.style),
7526
7479
  onClick: _this.props.onClick,
7527
7480
  "data-tip": _this.props.tooltip,
@@ -7549,6 +7502,7 @@ _defineProperty(Button, "propTypes", {
7549
7502
  onClick: PropTypes.func,
7550
7503
  loading: PropTypes.bool,
7551
7504
  disabled: PropTypes.bool,
7505
+ multiline: PropTypes.bool,
7552
7506
  tooltip: PropTypes.string
7553
7507
  });
7554
7508
 
@@ -7557,6 +7511,7 @@ _defineProperty(Button, "defaultProps", {
7557
7511
  loading: false,
7558
7512
  size: 'large',
7559
7513
  disabled: false,
7514
+ multiline: false,
7560
7515
  tooltip: undefined,
7561
7516
  onClick: function onClick() {}
7562
7517
  });
@@ -7938,6 +7893,10 @@ var ChataChart = /*#__PURE__*/function (_Component) {
7938
7893
  _this.updateMargins();
7939
7894
  }
7940
7895
 
7896
+ if (!_isEqual(_this.props.isShowingInterpretation, prevProps.isShowingInterpretation)) {
7897
+ _this.updateMargins();
7898
+ }
7899
+
7941
7900
  if (_this.props.type && _this.props.type !== prevProps.type && _this.props.type !== 'pie') {
7942
7901
  _this.updateMargins();
7943
7902
 
@@ -9241,14 +9200,15 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
9241
9200
 
9242
9201
  _defineProperty(_assertThisInitialized(_this), "supportedDisplayTypes", []);
9243
9202
 
9244
- _defineProperty(_assertThisInitialized(_this), "SAFETYNET_KEY", uuid.v4());
9203
+ _defineProperty(_assertThisInitialized(_this), "QUERY_VALIDATION_KEY", uuid.v4());
9245
9204
 
9246
9205
  _defineProperty(_assertThisInitialized(_this), "state", {
9247
9206
  displayType: null,
9248
9207
  tableFilters: [],
9249
9208
  suggestionSelection: _this.props.selectedSuggestion,
9250
9209
  QandAResponseCorrect: false,
9251
- QandASuggestions: []
9210
+ QandASuggestions: [],
9211
+ isShowingInterpretation: false
9252
9212
  });
9253
9213
 
9254
9214
  _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
@@ -9270,6 +9230,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
9270
9230
 
9271
9231
 
9272
9232
  _this.setState({
9233
+ isShowingInterpretation: getAutoQLConfig$1(_this.props.autoQLConfig).defaultShowInterpretation,
9273
9234
  displayType: isDisplayTypeValid(_this.props.queryResponse, _this.props.displayType) ? _this.props.displayType : getDefaultDisplayType(_this.props.queryResponse, _this.props.autoChartAggregations)
9274
9235
  });
9275
9236
 
@@ -9345,6 +9306,10 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
9345
9306
  disableScroll.off();
9346
9307
  }
9347
9308
 
9309
+ if (prevState.isShowingInterpretation !== _this.state.isShowingInterpretation) {
9310
+ _this.forceUpdate();
9311
+ }
9312
+
9348
9313
  if (_this.props.optionsToolbarRef) {
9349
9314
  _this.props.optionsToolbarRef._isMounted && _this.props.optionsToolbarRef.forceUpdate();
9350
9315
  }
@@ -10266,11 +10231,22 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10266
10231
  }
10267
10232
 
10268
10233
  var formattedColumns = columns.map(function (col, i) {
10234
+ /**
10235
+ * EDIT:
10236
+ * We no longer want to default to one over the other. Howeever,
10237
+ * I would like to hang onto this code for now incase we do want to
10238
+ * include either/or in some cases in the future
10239
+ */
10269
10240
  // Regardless of the BE response, we want to default to percent
10270
- if ((col.type === 'RATIO' || col.type === 'NUMBER') && _get(getDataFormatting(_this.props.dataFormatting), 'comparisonDisplay') === 'PERCENT') {
10271
- col.type = 'PERCENT';
10272
- }
10273
-
10241
+ // if (
10242
+ // (col.type === 'RATIO' || col.type === 'NUMBER') &&
10243
+ // _get(
10244
+ // getDataFormatting(this.props.dataFormatting),
10245
+ // 'comparisonDisplay'
10246
+ // ) === 'PERCENT'
10247
+ // ) {
10248
+ // col.type = 'PERCENT'
10249
+ // }
10274
10250
  col.field = "".concat(i);
10275
10251
  col.title = col.display_name;
10276
10252
  col.id = uuid.v4();
@@ -10659,7 +10635,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10659
10635
  }
10660
10636
 
10661
10637
  if (_this.state.displayType === 'pivot_table') {
10662
- return /*#__PURE__*/React.createElement(ChataTable, {
10638
+ return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(ChataTable, {
10663
10639
  themeConfig: getThemeConfig(_this.props.themeConfig),
10664
10640
  key: _this.pivotTableID,
10665
10641
  ref: function ref(_ref6) {
@@ -10672,7 +10648,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10672
10648
  onFilterCallback: _this.onTableFilter,
10673
10649
  setFilterTagsCallback: _this.props.setFilterTagsCallback,
10674
10650
  enableColumnHeaderContextMenu: _this.props.enableColumnHeaderContextMenu
10675
- });
10651
+ }));
10676
10652
  }
10677
10653
 
10678
10654
  return /*#__PURE__*/React.createElement(Fragment, null, _this.renderAllColumnsHiddenMessage(), /*#__PURE__*/React.createElement(ChataTable, {
@@ -10714,6 +10690,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10714
10690
  columns: _this.chartTableColumns,
10715
10691
  height: height,
10716
10692
  width: width,
10693
+ isShowingInterpretation: _this.state.isShowingInterpretation,
10717
10694
  dataFormatting: getDataFormatting(_this.props.dataFormatting),
10718
10695
  backgroundColor: _this.props.backgroundColor,
10719
10696
  activeChartElementKey: _this.props.activeChartElementKey,
@@ -10848,7 +10825,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10848
10825
  if (_get(queryResponse, 'data.data.replacements')) {
10849
10826
  return /*#__PURE__*/React.createElement(QueryValidationMessage, {
10850
10827
  themeConfig: getThemeConfig(_this.props.themeConfig),
10851
- key: _this.SAFETYNET_KEY,
10828
+ key: _this.QUERY_VALIDATION_KEY,
10852
10829
  response: _this.props.queryResponse,
10853
10830
  onSuggestionClick: function onSuggestionClick(_ref9) {
10854
10831
  var query = _ref9.query,
@@ -10973,30 +10950,103 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10973
10950
  }, /*#__PURE__*/React.createElement("div", null));
10974
10951
  });
10975
10952
 
10976
- _defineProperty(_assertThisInitialized(_this), "render", function () {
10977
- var responseContainer = document.getElementById("react-autoql-response-content-container-".concat(_this.COMPONENT_KEY));
10978
- var height = 0;
10979
- var width = 0;
10953
+ _defineProperty(_assertThisInitialized(_this), "handleShowHide", function (e) {
10954
+ var responseContainer = document.getElementById("react-autoql-response-content-container-".concat(_this.COMPONENT_KEY)); // make room in response container for reverse translation text
10980
10955
 
10981
- if (responseContainer) {
10982
- height = responseContainer.clientHeight - getPadding(responseContainer).top - getPadding(responseContainer).bottom;
10983
- width = responseContainer.clientWidth - getPadding(responseContainer).left - getPadding(responseContainer).right;
10956
+ if (document.getElementById("reverse-translation-".concat(_this.COMPONENT_KEY)) && getAutoQLConfig$1(_this.props.autoQLConfig).enableQueryInterpretation) {
10957
+ if (e.isFullyOpened) {
10958
+ responseContainer.style.height = "calc(100% - ".concat(e.contentHeight, "px)");
10959
+ } else {
10960
+ responseContainer.style.height = "calc(100% - 26px)";
10961
+ }
10984
10962
  }
10963
+ });
10985
10964
 
10986
- if (_this.props.height) {
10987
- height = _this.props.height;
10988
- }
10965
+ _defineProperty(_assertThisInitialized(_this), "renderReverseTranslation", function () {
10966
+ var queryResponse = _this.props.queryResponse;
10967
+ var id = "reverse-translation-".concat(_this.COMPONENT_KEY);
10968
+ var responseContainer = document.getElementById("react-autoql-response-content-container-".concat(_this.COMPONENT_KEY));
10989
10969
 
10990
- if (_this.props.width) {
10991
- width = _this.props.width;
10992
- }
10970
+ if (responseContainer && _get(queryResponse, 'data.data.interpretation')) {
10971
+ // manipulate interpretation string to properly format various substrings
10972
+ var reverseTranslation = _get(queryResponse, 'data.data.interpretation').replace(/(["'])(?:(?=(\\?))\2.)*?\1/gi, function (output) {
10973
+ var text = output.replace(/'/g, '');
10993
10974
 
10994
- return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("div", {
10995
- key: _this.COMPONENT_KEY,
10996
- id: "react-autoql-response-content-container-".concat(_this.COMPONENT_KEY),
10997
- "data-test": "query-response-wrapper",
10975
+ if (_get(queryResponse, 'data.data.persistent_locked_conditions').includes(text) || _get(queryResponse, 'data.data.session_locked_conditions').includes(text)) {
10976
+ 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 ");
10977
+ } else {
10978
+ return "<a class=\"react-autoql-condition-link\">".concat(text, "</a>");
10979
+ }
10980
+ }).replace(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/gi, function (output) {
10981
+ return moment.utc(output).format('ll').toString();
10982
+ });
10983
+
10984
+ return /*#__PURE__*/React.createElement("div", {
10985
+ id: id,
10986
+ className: "condition-lock-reverse-translation"
10987
+ }, /*#__PURE__*/React.createElement("span", {
10988
+ style: {
10989
+ float: 'left',
10990
+ minHeight: 20
10991
+ } // onClick={() => {
10992
+ // this.setState({
10993
+ // isShowingInterpretation: !this.state.isShowingInterpretation
10994
+ // })
10995
+ // }}
10996
+
10997
+ }, /*#__PURE__*/React.createElement(Icon // type={this.state.isShowingInterpretation ? 'caret-down' : 'caret-right' }
10998
+ // data-tip={this.state.isShowingInterpretation ? "Hide query interpretation" : "Show query interpretation" }
10999
+ , {
11000
+ type: "info" // data-for="react-autoql-interpretation"
11001
+
11002
+ }), ' '), /*#__PURE__*/React.createElement(UnmountClosed, {
11003
+ onRest: _this.handleShowHide,
11004
+ isOpened: true // isOpened={this.state.isShowingInterpretation}
11005
+
11006
+ }, /*#__PURE__*/React.createElement("strong", null, "Interpreted as:", ' '), /*#__PURE__*/React.createElement("span", {
11007
+ onClick: function onClick() {
11008
+ return _this.props.onConditionClickCallback();
11009
+ },
11010
+ dangerouslySetInnerHTML: {
11011
+ __html: "".concat(reverseTranslation)
11012
+ }
11013
+ })));
11014
+ }
11015
+ });
11016
+
11017
+ _defineProperty(_assertThisInitialized(_this), "render", function () {
11018
+ var responseContainer = document.getElementById("react-autoql-response-content-container-".concat(_this.COMPONENT_KEY));
11019
+ var translationContainer = document.getElementById("reverse-translation-".concat(_this.COMPONENT_KEY));
11020
+ var height = 0;
11021
+ var width = 0;
11022
+
11023
+ if (responseContainer) {
11024
+ height = responseContainer.clientHeight - getPadding(responseContainer).top - getPadding(responseContainer).bottom;
11025
+ width = responseContainer.clientWidth - getPadding(responseContainer).left - getPadding(responseContainer).right;
11026
+ }
11027
+
11028
+ if (_this.props.height) {
11029
+ if (translationContainer && getAutoQLConfig$1(_this.props.autoQLConfig).enableQueryInterpretation && _this.state.isShowingInterpretation) {
11030
+ if (_this.state.isShowingInterpretation) {
11031
+ height = _this.props.height - translationContainer.offsetHeight - 20;
11032
+ } else {
11033
+ height = _this.props.height - translationContainer.offsetHeight - 40;
11034
+ }
11035
+ } else {
11036
+ height = _this.props.height;
11037
+ }
11038
+ }
11039
+
11040
+ if (_this.props.width) {
11041
+ width = _this.props.width;
11042
+ }
11043
+
11044
+ return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("div", {
11045
+ key: _this.COMPONENT_KEY,
11046
+ id: "react-autoql-response-content-container-".concat(_this.COMPONENT_KEY),
11047
+ "data-test": "query-response-wrapper",
10998
11048
  className: "react-autoql-response-content-container\n ".concat(isTableType(_this.state.displayType) ? 'table' : '', "\n ").concat(_this.state.displayType === 'html' ? 'html-content' : '')
10999
- }, _this.renderResponse(width, height), _get(getAuthentication(_this.props.authentication), 'isQandA') && _this.renderQandAResponseConfirmation()), _this.renderContextMenu());
11049
+ }, _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());
11000
11050
  });
11001
11051
 
11002
11052
  return _this;
@@ -11011,13 +11061,13 @@ _defineProperty(QueryOutput, "propTypes", (_defineProperty2$1 = {
11011
11061
  authentication: authenticationType,
11012
11062
  themeConfig: themeConfigType,
11013
11063
  autoQLConfig: autoQLConfigType
11014
- }, _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));
11064
+ }, _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));
11015
11065
 
11016
11066
  _defineProperty(QueryOutput, "defaultProps", (_defineProperty3 = {
11017
11067
  authentication: authenticationDefault,
11018
11068
  themeConfig: themeConfigDefault,
11019
11069
  autoQLConfig: autoQLConfigDefault
11020
- }, _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));
11070
+ }, _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));
11021
11071
 
11022
11072
  var VizToolbar = /*#__PURE__*/function (_React$Component) {
11023
11073
  _inherits(VizToolbar, _React$Component);
@@ -12075,8 +12125,18 @@ var NotificationIcon = /*#__PURE__*/function (_React$Component) {
12075
12125
  switch (_context.prev = _context.next) {
12076
12126
  case 0:
12077
12127
  _this._isMounted = true;
12078
-
12079
- _this.subscribeToNotificationCount();
12128
+ /**
12129
+ * If Data Messenger has enableNotificationsTab = true and
12130
+ * the NotificationIcon is also present, subscribeToNotificationCount()
12131
+ * will occasionally trigger an infinite loop.
12132
+ *
12133
+ * Data Messenger will first check to see that the NotificationIcon
12134
+ * isn't already present before triggering this function inside.
12135
+ */
12136
+
12137
+ if (!_this.props.isAlreadyMountedInDOM) {
12138
+ _this.subscribeToNotificationCount();
12139
+ }
12080
12140
 
12081
12141
  case 2:
12082
12142
  case "end":
@@ -12210,7 +12270,8 @@ _defineProperty(NotificationIcon, "propTypes", {
12210
12270
  useDot: PropTypes.bool,
12211
12271
  clearCountOnClick: PropTypes.bool,
12212
12272
  onNewNotification: PropTypes.func,
12213
- onErrorCallback: PropTypes.func
12273
+ onErrorCallback: PropTypes.func,
12274
+ isAlreadyMountedInDOM: PropTypes.bool
12214
12275
  });
12215
12276
 
12216
12277
  _defineProperty(NotificationIcon, "defaultProps", {
@@ -12220,7 +12281,8 @@ _defineProperty(NotificationIcon, "defaultProps", {
12220
12281
  style: {},
12221
12282
  clearCountOnClick: true,
12222
12283
  onNewNotification: function onNewNotification() {},
12223
- onErrorCallback: function onErrorCallback() {}
12284
+ onErrorCallback: function onErrorCallback() {},
12285
+ isAlreadyMountedInDOM: false
12224
12286
  });
12225
12287
 
12226
12288
  var _excluded$1 = ["icon", "type"];
@@ -12527,7 +12589,7 @@ var RuleSimple = /*#__PURE__*/function (_React$Component) {
12527
12589
  return '<';
12528
12590
  }
12529
12591
 
12530
- case 'EQUALS':
12592
+ case 'EQUAL_TO':
12531
12593
  {
12532
12594
  return '=';
12533
12595
  }
@@ -12585,9 +12647,9 @@ var RuleSimple = /*#__PURE__*/function (_React$Component) {
12585
12647
  label: '<',
12586
12648
  tooltip: 'Less Than'
12587
12649
  }, {
12588
- value: 'EQUALS',
12650
+ value: 'EQUAL_TO',
12589
12651
  label: '=',
12590
- tooltip: 'Equals'
12652
+ tooltip: 'EQUAL_TO'
12591
12653
  }, {
12592
12654
  value: 'EXISTS',
12593
12655
  label: 'Exists',
@@ -12930,8 +12992,8 @@ var NotificationItem = /*#__PURE__*/function (_React$Component) {
12930
12992
  var queryResponse = {
12931
12993
  data: _this.props.activeNotificationData
12932
12994
  };
12933
- _this.supportedDisplayTypes = getSupportedDisplayTypes(queryResponse);
12934
- var displayType = _this.supportedDisplayTypes.includes('column') ? 'column' : getDefaultDisplayType(queryResponse, _this.props.autoChartAggregations);
12995
+ _this.supportedDisplayTypes = getSupportedDisplayTypes(queryResponse, undefined, true);
12996
+ var displayType = _this.props.autoChartAggregations && _this.supportedDisplayTypes.includes('column') ? 'column' : getDefaultDisplayType(queryResponse, _this.props.autoChartAggregations);
12935
12997
 
12936
12998
  _this.setState({
12937
12999
  displayType: displayType
@@ -13260,7 +13322,7 @@ _defineProperty(NotificationItem, "defaultProps", {
13260
13322
  themeConfig: themeConfigDefault,
13261
13323
  activeNotificationData: undefined,
13262
13324
  showNotificationDetails: true,
13263
- autoChartAggregations: true,
13325
+ autoChartAggregations: false,
13264
13326
  onRuleFetchCallback: function onRuleFetchCallback() {},
13265
13327
  onExpandCallback: function onExpandCallback() {},
13266
13328
  onDismissCallback: function onDismissCallback() {},
@@ -14892,7 +14954,7 @@ _defineProperty(NotificationFeed, "defaultProps", {
14892
14954
  themeConfig: themeConfigDefault,
14893
14955
  activeNotificationData: undefined,
14894
14956
  showNotificationDetails: true,
14895
- autoChartAggregations: true,
14957
+ autoChartAggregations: false,
14896
14958
  showCreateAlertBtn: false,
14897
14959
  onCollapseCallback: function onCollapseCallback() {},
14898
14960
  onExpandCallback: function onExpandCallback() {},
@@ -15179,14 +15241,19 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15179
15241
  type: "hour-glass"
15180
15242
  }), _this.hasError(notification) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
15181
15243
  type: "primary",
15244
+ tooltip: "This Alert is no longer active. <br /> Click to re-initialze it.",
15245
+ multiline: true,
15182
15246
  className: "react-autoql-re-initialize-btn",
15183
- tooltip: "Please re-initialize data alert",
15184
15247
  onClick: function onClick() {
15185
- return _this.props.handleInitialize(notification, _this.props.selectedDemoProjectId, _this.props.authentication);
15248
+ _this.props.onAlertInitializationCallback(notification, _this.props.selectedDemoProjectId, _this.props.authentication);
15249
+
15250
+ _this.getDataAlerts();
15186
15251
  }
15187
15252
  }, /*#__PURE__*/React.createElement("span", {
15188
15253
  className: "react-autoql-re-initialize-btn-text"
15189
- }, "Re-Initialize")), /*#__PURE__*/React.createElement(Checkbox, {
15254
+ }, /*#__PURE__*/React.createElement(Icon, {
15255
+ type: "warning-triangle"
15256
+ }), ' ', " Resend")), /*#__PURE__*/React.createElement(Checkbox, {
15190
15257
  themeConfig: getThemeConfig(_this.props.themeConfig),
15191
15258
  type: "switch",
15192
15259
  className: "react-autoql-notification-disable-checkbox"
@@ -15273,7 +15340,8 @@ _defineProperty(DataAlerts, "defaultProps", {
15273
15340
  authentication: authenticationDefault,
15274
15341
  themeConfig: themeConfigDefault,
15275
15342
  showCreateAlertBtn: false,
15276
- onErrorCallback: function onErrorCallback() {}
15343
+ onErrorCallback: function onErrorCallback() {},
15344
+ onAlertInitializationCallback: function onAlertInitializationCallback() {}
15277
15345
  });
15278
15346
 
15279
15347
  var getInitialStateData$2 = function getInitialStateData(initialData) {
@@ -15542,7 +15610,7 @@ var Rule = /*#__PURE__*/function (_React$Component) {
15542
15610
  return '<';
15543
15611
  }
15544
15612
 
15545
- case 'EQUALS':
15613
+ case 'EQUAL_TO':
15546
15614
  {
15547
15615
  return '=';
15548
15616
  }
@@ -15605,9 +15673,9 @@ var Rule = /*#__PURE__*/function (_React$Component) {
15605
15673
  label: '<',
15606
15674
  tooltip: 'Less Than'
15607
15675
  }, {
15608
- value: 'EQUALS',
15676
+ value: 'EQUAL_TO',
15609
15677
  label: '=',
15610
- tooltip: 'Equals'
15678
+ tooltip: 'EQUAL_TO'
15611
15679
  }, {
15612
15680
  value: 'EXISTS',
15613
15681
  label: /*#__PURE__*/React.createElement("span", null, "\u2203"),
@@ -17890,30 +17958,21 @@ var Input = /*#__PURE__*/function (_React$Component) {
17890
17958
  });
17891
17959
 
17892
17960
  _defineProperty(_assertThisInitialized(_this), "renderToolbar", function () {
17961
+ var _shouldShowButton;
17962
+
17893
17963
  var displayType = _get(_this.props.responseRef, 'state.displayType');
17894
17964
 
17895
17965
  var response = _get(_this.props.responseRef, 'props.queryResponse');
17896
17966
 
17897
17967
  var isDataResponse = _get(response, 'data.data.display_type') === 'data';
17898
- var shouldShowButton = {
17968
+ var shouldShowButton = (_shouldShowButton = {
17899
17969
  showFilterButton: isTableResponse(response, displayType) && !_this.areAllColumnsHidden() && _get(response, 'data.data.rows.length') > 1,
17900
17970
  showCopyButton: isTableResponse(response, displayType) && !_this.areAllColumnsHidden() && !!_get(response, 'data.data.rows.length'),
17901
17971
  showSaveAsCSVButton: isTableResponse(response, displayType) && !_this.areAllColumnsHidden() && !!_get(response, 'data.data.rows.length'),
17902
17972
  showSaveAsPNGButton: CHART_TYPES.includes(displayType),
17903
17973
  showHideColumnsButton: getAutoQLConfig$1(_this.props.autoQLConfig).enableColumnVisibilityManager && isTableResponse(response, displayType) && displayType !== 'pivot_table' && _get(response, 'data.data.columns.length') > 0,
17904
- showSQLButton: isDataResponse && getAutoQLConfig$1(_this.props.autoQLConfig).debug,
17905
- showDeleteButton: _this.props.enableDeleteBtn,
17906
- showReportProblemButton: !!_get(response, 'data.data.query_id'),
17907
- showCreateNotificationIcon: isDataResponse && getAutoQLConfig$1(_this.props.autoQLConfig).enableNotifications && !_this.isDrilldownResponse(),
17908
- showShareToSlackButton: false,
17909
- // This feature is disabled indefinitely
17910
- // isDataResponse &&
17911
- // getAutoQLConfig(this.props.autoQLConfig).enableSlackSharing,
17912
- showShareToTeamsButton: false // This feature is disabled indefinitely
17913
- // isDataResponse &&
17914
- // getAutoQLConfig(this.props.autoQLConfig).enableTeamsSharing,
17915
-
17916
- };
17974
+ showSQLButton: isDataResponse && getAutoQLConfig$1(_this.props.autoQLConfig).debug
17975
+ }, _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);
17917
17976
  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
17918
17977
 
17919
17978
  if (!Object.values(shouldShowButton).find(function (showButton) {
@@ -18220,12 +18279,17 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
18220
18279
  optionsToolbarRef: _this.optionsToolbarRef,
18221
18280
  onNoneOfTheseClick: _this.props.onNoneOfTheseClick,
18222
18281
  autoChartAggregations: _this.props.autoChartAggregations,
18282
+ enableQueryInterpretation: _this.props.enableQueryInterpretation,
18283
+ enableFilterLocking: _this.props.enableFilterLocking,
18223
18284
  reportProblemCallback: function reportProblemCallback() {
18224
18285
  if (_this.optionsToolbarRef) {
18225
18286
  _this.optionsToolbarRef.setState({
18226
18287
  activeMenu: 'other-problem'
18227
18288
  });
18228
18289
  }
18290
+ },
18291
+ onConditionClickCallback: function onConditionClickCallback() {
18292
+ _this.props.onConditionClickCallback();
18229
18293
  }
18230
18294
  }));
18231
18295
  }
@@ -18379,7 +18443,7 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
18379
18443
  if (_this.props.type === 'text' || _this.state.displayType === 'html') {
18380
18444
  return undefined;
18381
18445
  } else if (chartHeight) {
18382
- return chartHeight + 40;
18446
+ return chartHeight + 120;
18383
18447
  }
18384
18448
 
18385
18449
  return '85%';
@@ -18400,23 +18464,6 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
18400
18464
  }
18401
18465
  });
18402
18466
 
18403
- _defineProperty(_assertThisInitialized(_this), "renderLockedConditions", function () {
18404
- var response = _this.props.response;
18405
-
18406
- var numRows = _get(response, 'data.data.rows.length');
18407
-
18408
- var maxRowLimit = _get(response, 'data.data.row_limit');
18409
-
18410
- if (_get(response, 'data.data.persistent_locked_conditions.length') > 0) {
18411
- return /*#__PURE__*/React.createElement(Icon, {
18412
- type: "lock",
18413
- className: maxRowLimit && numRows === maxRowLimit && !_this.allColumnsAreHidden() ? 'condition-info-icon-left-align' : 'condition-info-icon',
18414
- "data-tip": response.data.data.persistent_locked_conditions,
18415
- "data-for": "chart-element-tooltip"
18416
- });
18417
- }
18418
- });
18419
-
18420
18467
  _defineProperty(_assertThisInitialized(_this), "render", function () {
18421
18468
  var _this$getChartDimensi2 = _this.getChartDimensions(),
18422
18469
  chartWidth = _this$getChartDimensi2.chartWidth,
@@ -18441,7 +18488,7 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
18441
18488
  return !col.visible;
18442
18489
  }) || _this.allColumnsAreHidden() ? '400px' : undefined
18443
18490
  }
18444
- }, _this.renderContent(chartWidth, chartHeight), _this.props.isDataMessengerOpen && _this.renderRightToolbar(), _this.props.isDataMessengerOpen && _this.renderLeftToolbar(), _this.renderDataLimitWarning(), _this.renderLockedConditions())));
18491
+ }, _this.renderContent(chartWidth, chartHeight), _this.props.isDataMessengerOpen && _this.renderRightToolbar(), _this.props.isDataMessengerOpen && _this.renderLeftToolbar(), _this.renderDataLimitWarning())));
18445
18492
  });
18446
18493
 
18447
18494
  return _this;
@@ -18469,7 +18516,7 @@ _defineProperty(ChatMessage, "propTypes", (_defineProperty2 = {
18469
18516
  content: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({})]),
18470
18517
  tableOptions: PropTypes.shape({}),
18471
18518
  enableColumnVisibilityManager: PropTypes.bool
18472
- }, _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));
18519
+ }, _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));
18473
18520
 
18474
18521
  _defineProperty(ChatMessage, "defaultProps", {
18475
18522
  authentication: authenticationDefault,
@@ -18494,7 +18541,8 @@ _defineProperty(ChatMessage, "defaultProps", {
18494
18541
  enableDynamicCharting: true,
18495
18542
  autoChartAggregations: true,
18496
18543
  scrollToBottom: function scrollToBottom() {},
18497
- onNoneOfTheseClick: function onNoneOfTheseClick() {}
18544
+ onNoneOfTheseClick: function onNoneOfTheseClick() {},
18545
+ onConditionClickCallback: function onConditionClickCallback() {}
18498
18546
  });
18499
18547
 
18500
18548
  var QueryTipsTab = /*#__PURE__*/function (_React$Component) {
@@ -18800,11 +18848,22 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18800
18848
  inputValue: '',
18801
18849
  lastQuery: '',
18802
18850
  suggestions: [],
18803
- selectedConditions: []
18851
+ selectedConditions: [],
18852
+ isFetchingConditions: false,
18853
+ isShowingInfo: false,
18854
+ isShowingSettingInfo: false,
18855
+ showMessage: {
18856
+ type: 'unlock',
18857
+ message: 'filter removed'
18858
+ }
18804
18859
  });
18805
18860
 
18806
18861
  _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
18807
18862
  try {
18863
+ _this.setState({
18864
+ isFetchingConditions: true
18865
+ });
18866
+
18808
18867
  fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
18809
18868
  var conditions = _get(response, 'data.data.data');
18810
18869
 
@@ -18821,9 +18880,25 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18821
18880
  });
18822
18881
  }
18823
18882
 
18883
+ if (JSON.parse(sessionStorage.getItem("conditions")) !== null) {
18884
+ var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
18885
+
18886
+ for (var _i = 0; _i < sessionConditions.length; _i++) {
18887
+ array.push({
18888
+ id: sessionConditions[_i].id,
18889
+ keyword: sessionConditions[_i].value,
18890
+ value: sessionConditions[_i].value,
18891
+ show_message: sessionConditions[_i].show_message,
18892
+ key: sessionConditions[_i].key,
18893
+ lock_flag: sessionConditions[_i].lock_flag
18894
+ });
18895
+ }
18896
+ }
18897
+
18824
18898
  _this.setState({
18825
- selectedConditions: array,
18826
- inputValue: ''
18899
+ selectedConditions: array.sort(),
18900
+ inputValue: '',
18901
+ isFetchingConditions: false
18827
18902
  });
18828
18903
  });
18829
18904
  } catch (error) {
@@ -18831,32 +18906,34 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18831
18906
  }
18832
18907
  });
18833
18908
 
18834
- _defineProperty(_assertThisInitialized(_this), "getSuggestions", function (value) {
18835
- var inputValue = value.trim().toLowerCase();
18836
- var inputLength = inputValue.length;
18837
- return inputLength === 0 ? [] : languages.filter(function (lang) {
18838
- return lang.name.toLowerCase().slice(0, inputLength) === inputValue;
18839
- });
18840
- });
18841
-
18842
18909
  _defineProperty(_assertThisInitialized(_this), "getSuggestionValue", function (suggestion) {
18843
18910
  var array = _this.state.selectedConditions;
18844
- array.push({
18845
- keyword: suggestion.name.keyword,
18846
- value: suggestion.name.keyword,
18847
- show_message: suggestion.name.show_message,
18848
- key: suggestion.name.canonical,
18849
- lock_flag: suggestion.name.lock_flag
18850
- });
18911
+ var tempId = uuid.v4();
18851
18912
 
18852
- _this.setState({
18853
- selectedConditions: array,
18854
- inputValue: ''
18855
- });
18856
- });
18913
+ if (array.some(function (item) {
18914
+ return item.key === suggestion.name.canonical && item.value === suggestion.name.keyword;
18915
+ })) {
18916
+ _this.handleShowMessage('warning', 'This condition has already been applied.');
18917
+ } else {
18918
+ array.push({
18919
+ id: tempId,
18920
+ keyword: suggestion.name.keyword,
18921
+ value: suggestion.name.keyword,
18922
+ show_message: suggestion.name.show_message,
18923
+ key: suggestion.name.canonical,
18924
+ lock_flag: 1 // persist by default
18925
+
18926
+ });
18927
+
18928
+ _this.setState({
18929
+ selectedConditions: array,
18930
+ inputValue: ''
18931
+ });
18857
18932
 
18858
- _defineProperty(_assertThisInitialized(_this), "renderSuggestion", function (suggestion) {
18859
- return /*#__PURE__*/React.createElement("div", null, _get(suggestion, 'name.keyword'));
18933
+ setConditions(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
18934
+ conditions: array
18935
+ }));
18936
+ }
18860
18937
  });
18861
18938
 
18862
18939
  _defineProperty(_assertThisInitialized(_this), "onInputChange", function (e) {
@@ -18873,27 +18950,62 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18873
18950
  });
18874
18951
 
18875
18952
  _defineProperty(_assertThisInitialized(_this), "removeCondition", function (item, index) {
18876
- var isSaved;
18877
- fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
18878
- _get(response, 'data.data.data').map(function (r) {
18879
- if (_includes(r, item.id)) {
18880
- isSaved = true;
18881
- }
18953
+ var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
18954
+ var sessionIndex;
18955
+
18956
+ if (sessionConditions) {
18957
+ sessionIndex = sessionConditions.findIndex(function (condition) {
18958
+ return _get(condition, 'key') === _get(item, 'key');
18882
18959
  });
18960
+ }
18883
18961
 
18884
- if (isSaved) {
18885
- unsetCondition(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
18886
- condition: item
18887
- }));
18888
- }
18962
+ if (sessionIndex !== -1 && sessionIndex !== undefined && sessionIndex !== null) {
18963
+ sessionConditions.splice(sessionIndex, 1);
18964
+ sessionStorage.setItem('conditions', JSON.stringify(sessionConditions));
18965
+ } else {
18966
+ unsetCondition(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
18967
+ condition: item
18968
+ }));
18969
+ }
18889
18970
 
18890
- var array = _this.state.selectedConditions;
18891
- array.splice(index, 1);
18971
+ var array = _this.state.selectedConditions;
18972
+ array.splice(index, 1);
18892
18973
 
18974
+ _this.setState({
18975
+ selectedConditions: array
18976
+ });
18977
+
18978
+ _this.handleShowMessage('unlock', 'Filter removed.');
18979
+ });
18980
+
18981
+ _defineProperty(_assertThisInitialized(_this), "handlePersistConditionToggle", function (item) {
18982
+ var index = _this.state.selectedConditions.findIndex(function (condition) {
18983
+ return condition.id === item.id;
18984
+ });
18985
+
18986
+ var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
18987
+
18988
+ if (index === -1) ; else {
18893
18989
  _this.setState({
18894
- selectedConditions: array
18990
+ 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)))
18991
+ }, function () {
18992
+ setConditions(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
18993
+ conditions: _this.state.selectedConditions
18994
+ }));
18995
+
18996
+ if (item.lock_flag === 0) {
18997
+ if (sessionConditions == null) sessionConditions = [];
18998
+ sessionConditions.push(item);
18999
+ sessionStorage.setItem("conditions", JSON.stringify(sessionConditions));
19000
+ } else {
19001
+ var sessionIndex = sessionConditions.findIndex(function (condition) {
19002
+ return condition.id === item.id;
19003
+ });
19004
+ sessionConditions.splice(sessionIndex, 1);
19005
+ sessionStorage.setItem('conditions', JSON.stringify(sessionConditions));
19006
+ }
18895
19007
  });
18896
- });
19008
+ }
18897
19009
  });
18898
19010
 
18899
19011
  _defineProperty(_assertThisInitialized(_this), "onSuggestionsFetchRequested", function (_ref) {
@@ -18917,13 +19029,13 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18917
19029
  for (var i = 0; i < suggestionsMatchArray.length; i++) {
18918
19030
  sortingArray.push(suggestionsMatchArray[i]);
18919
19031
 
18920
- if (i === 4) {
19032
+ if (i === 5) {
18921
19033
  break;
18922
19034
  }
18923
19035
  }
18924
19036
 
18925
19037
  sortingArray.sort(function (a, b) {
18926
- return b.length - a.length;
19038
+ return a.keyword.toUpperCase() < b.keyword.toUpperCase() ? -1 : a.keyword > b.keyword ? 1 : 0;
18927
19039
  });
18928
19040
 
18929
19041
  for (var idx = 0; idx < sortingArray.length; idx++) {
@@ -18948,6 +19060,14 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18948
19060
  });
18949
19061
  });
18950
19062
 
19063
+ _defineProperty(_assertThisInitialized(_this), "renderShowMessage", function () {
19064
+ return /*#__PURE__*/React.createElement("div", {
19065
+ id: "react-autoql-condition-show-message"
19066
+ }, /*#__PURE__*/React.createElement(Icon, {
19067
+ type: _this.state.showMessage.type
19068
+ }), " ", _this.state.showMessage.message);
19069
+ });
19070
+
18951
19071
  _defineProperty(_assertThisInitialized(_this), "renderAcceptConditionsButton", function () {
18952
19072
  return /*#__PURE__*/React.createElement("div", {
18953
19073
  key: "accept-conditions-btn",
@@ -18978,72 +19098,136 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18978
19098
  style: {
18979
19099
  width: containerWidth
18980
19100
  }
18981
- }, /*#__PURE__*/React.createElement("div", {
19101
+ }, _this.renderShowMessage(), /*#__PURE__*/React.createElement("div", {
18982
19102
  className: "react-autoql-condition-lock-header"
18983
19103
  }, /*#__PURE__*/React.createElement("div", {
18984
- className: "autoql-condition-locking-menu-container"
18985
- }, /*#__PURE__*/React.createElement("button", {
19104
+ className: "react-autoql-filter-locking-title-container"
19105
+ }, /*#__PURE__*/React.createElement("h3", null, "Filter Locking ", ' ', /*#__PURE__*/React.createElement(Icon, {
19106
+ type: "info",
19107
+ onMouseEnter: function onMouseEnter() {
19108
+ return setTimeout(function () {
19109
+ _this.setState({
19110
+ isShowingInfo: true
19111
+ });
19112
+ }, 300);
19113
+ },
19114
+ onMouseLeave: function onMouseLeave() {
19115
+ return _this.setState({
19116
+ isShowingInfo: false
19117
+ });
19118
+ }
19119
+ })), /*#__PURE__*/React.createElement("button", {
18986
19120
  onClick: function onClick() {
18987
19121
  _this.props.onClose();
18988
19122
  },
18989
19123
  className: "autoql-close-button",
18990
- "data-tip": lang.closeConditionLocking,
19124
+ "data-tip": lang.closeFilterLocking,
18991
19125
  "data-for": "react-autoql-header-tooltip"
18992
19126
  }, /*#__PURE__*/React.createElement(Icon, {
18993
19127
  type: "close"
18994
- })), /*#__PURE__*/React.createElement(Autosuggest, {
19128
+ }))), /*#__PURE__*/React.createElement("div", {
19129
+ className: "autoql-condition-locking-menu-container"
19130
+ }, _this.state.isShowingInfo ? /*#__PURE__*/React.createElement("div", {
19131
+ className: "react-autoql-filter-locking-empty-list"
19132
+ }, /*#__PURE__*/React.createElement(Icon, {
19133
+ type: "info"
19134
+ }), /*#__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, {
18995
19135
  ref: function ref(_ref2) {
18996
19136
  _this.autoSuggest = _ref2;
18997
19137
  },
19138
+ highlightFirstSuggestion: true,
18998
19139
  suggestions: _this.state.suggestions,
18999
19140
  onSuggestionsFetchRequested: _this.onSuggestionsFetchRequested,
19000
19141
  onSuggestionsClearRequested: _this.onSuggestionsClearRequested,
19001
19142
  getSuggestionValue: _this.getSuggestionValue,
19002
19143
  renderSuggestion: function renderSuggestion(suggestion) {
19003
- return /*#__PURE__*/React.createElement(Fragment, null, suggestion.name.keyword);
19144
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("table", {
19145
+ className: "autoql-condition-locking-menu-list"
19146
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
19147
+ style: {
19148
+ width: 300
19149
+ }
19150
+ }, suggestion.name.keyword), /*#__PURE__*/React.createElement("td", null, suggestion.name.show_message)))));
19004
19151
  },
19005
19152
  inputProps: {
19006
19153
  onChange: _this.onInputChange,
19007
19154
  value: _this.state.inputValue,
19008
- placeholder: 'Search for a condition.',
19155
+ disabled: _this.state.isFetchingConditions,
19156
+ placeholder: 'Search & select a filter',
19009
19157
  className: 'react-autoql-condition-locking-input'
19010
19158
  }
19011
- }))), /*#__PURE__*/React.createElement("div", {
19159
+ }), _this.state.isShowingSettingInfo ? /*#__PURE__*/React.createElement("div", {
19160
+ className: "react-autoql-filter-setting-info-card"
19161
+ }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Icon, {
19162
+ type: "info"
19163
+ }), ' ', /*#__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, {
19164
+ type: "info"
19165
+ }), ' ', /*#__PURE__*/React.createElement("strong", null, "Session"), " filters remain locked until you end your browser session.")) : null)), _this.state.isFetchingConditions ? /*#__PURE__*/React.createElement("div", {
19166
+ className: "condition-list-loading-container"
19167
+ }, /*#__PURE__*/React.createElement(LoadingDots, null)) : /*#__PURE__*/React.createElement("div", {
19012
19168
  className: "condition-list"
19013
19169
  }, _get(_this.state.selectedConditions, 'length') === 0 ? /*#__PURE__*/React.createElement("div", {
19014
19170
  className: "empty-condition-list"
19015
- }, /*#__PURE__*/React.createElement("p", null, "Condition locking is a tool to help you track a condition across many queries. This is useful if you want to focus on a specific location or timeframe but don't want to have to type it out for every query."), /*#__PURE__*/React.createElement("p", null, "You currently have no conditions locked. Use the search bar to find a condition you would like to track.")) : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
19171
+ }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("i", null, lang.noFiltersLocked))) : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
19016
19172
  style: {
19017
- minHeight: 100
19173
+ minHeight: 150
19018
19174
  }
19019
19175
  }, /*#__PURE__*/React.createElement("table", {
19020
19176
  className: "condition-table"
19021
19177
  }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("th", {
19022
19178
  scope: "col"
19023
- }, "Condition"), /*#__PURE__*/React.createElement("th", {
19024
- scope: "col"
19025
- }, "Category"), /*#__PURE__*/React.createElement("th", {
19179
+ }, "Filter"), /*#__PURE__*/React.createElement("th", {
19180
+ scope: "col",
19181
+ style: {
19182
+ minWidth: 154
19183
+ }
19184
+ }, "Settings", /*#__PURE__*/React.createElement(Icon, {
19185
+ type: "info",
19186
+ onMouseEnter: function onMouseEnter() {
19187
+ return setTimeout(function () {
19188
+ _this.setState({
19189
+ isShowingSettingInfo: true
19190
+ });
19191
+ }, 300);
19192
+ },
19193
+ onMouseLeave: function onMouseLeave() {
19194
+ return _this.setState({
19195
+ isShowingSettingInfo: false
19196
+ });
19197
+ }
19198
+ })), /*#__PURE__*/React.createElement("th", {
19026
19199
  scope: "col",
19027
19200
  style: {
19028
19201
  display: 'table-cell',
19029
19202
  verticalAlign: 'middle',
19030
19203
  textAlign: 'right'
19031
19204
  }
19032
- }, "Actions")), /*#__PURE__*/React.createElement("tbody", null, _this.state.selectedConditions.map(function (item, index) {
19205
+ })), /*#__PURE__*/React.createElement("tbody", null, _this.state.selectedConditions.map(function (item, index) {
19033
19206
  return /*#__PURE__*/React.createElement("tr", {
19034
19207
  key: index
19035
- }, /*#__PURE__*/React.createElement("td", null, item.keyword), /*#__PURE__*/React.createElement("td", null, item.show_message), /*#__PURE__*/React.createElement("td", {
19208
+ }, /*#__PURE__*/React.createElement("td", {
19209
+ className: "condition-table-list-item"
19210
+ }, item.keyword, ' ', "(".concat(item.show_message, ")")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Switch, {
19211
+ onChange: function onChange() {
19212
+ return _this.handlePersistConditionToggle(item, index);
19213
+ },
19214
+ checked: item.lock_flag,
19215
+ onColor: "#86d3ff",
19216
+ onHandleColor: "#2693e6",
19217
+ uncheckedIcon: false,
19218
+ checkedIcon: false,
19219
+ boxShadow: "0px 1px 5px rgba(0, 0, 0, 0.6)",
19220
+ activeBoxShadow: "0px 0px 1px 1px rgba(0, 0, 0, 0.2)",
19221
+ handleDiameter: 16,
19222
+ height: 18,
19223
+ width: 34
19224
+ }), ' ', item.lock_flag ? 'Persistent' : 'Session')), /*#__PURE__*/React.createElement("td", {
19036
19225
  style: {
19037
19226
  display: 'table-cell',
19038
19227
  verticalAlign: 'middle',
19039
19228
  textAlign: 'right'
19040
19229
  }
19041
19230
  }, /*#__PURE__*/React.createElement(ReactTooltip, {
19042
- className: "react-autoql-chart-tooltip",
19043
- id: "condition-lock-persist",
19044
- effect: "solid",
19045
- html: true
19046
- }), /*#__PURE__*/React.createElement(ReactTooltip, {
19047
19231
  className: "react-autoql-chart-tooltip",
19048
19232
  id: "react-autoql-remove-condition",
19049
19233
  effect: "solid",
@@ -19053,24 +19237,54 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19053
19237
  paddingLeft: 5,
19054
19238
  color: 'red'
19055
19239
  },
19056
- "data-tip": "Remove this condition",
19240
+ "data-tip": "Remove filter",
19057
19241
  "data-for": "react-autoql-remove-condition",
19058
19242
  type: "trash",
19059
19243
  onClick: function onClick() {
19060
19244
  return _this.removeCondition(item, index);
19061
19245
  }
19062
19246
  })));
19063
- })), /*#__PURE__*/React.createElement("tfoot", null)))), _this.renderAcceptConditionsButton())));
19247
+ })), /*#__PURE__*/React.createElement("tfoot", null))))), /*#__PURE__*/React.createElement("div", {
19248
+ className: "react-autoql-condition-lock-menu-footer"
19249
+ }, /*#__PURE__*/React.createElement(Button, {
19250
+ size: "small",
19251
+ disabled: _this.state.isFetchingConditions,
19252
+ onClick: function onClick() {
19253
+ _this.props.onClose();
19254
+ }
19255
+ }, "Continue"))));
19064
19256
  });
19065
19257
 
19066
19258
  return _this;
19067
19259
  }
19068
19260
 
19261
+ _createClass(ConditionLockMenu, [{
19262
+ key: "handleShowMessage",
19263
+ value: function handleShowMessage(type, message) {
19264
+ var el = document.getElementById('react-autoql-condition-show-message');
19265
+ el.className = 'show';
19266
+ el.style.animation = 'none';
19267
+ setTimeout(function () {
19268
+ el.style.animation = '';
19269
+ }, 10);
19270
+ setTimeout(function () {
19271
+ el.className = el.className.replace('show', '');
19272
+ }, 3000);
19273
+ this.setState({
19274
+ inputValue: '',
19275
+ showMessage: {
19276
+ type: type,
19277
+ message: message
19278
+ }
19279
+ });
19280
+ }
19281
+ }]);
19282
+
19069
19283
  return ConditionLockMenu;
19070
19284
  }(React.Component);
19071
19285
 
19072
19286
  _defineProperty(ConditionLockMenu, "propTypes", {
19073
- containerWidth: PropTypes.string,
19287
+ containerWidth: PropTypes.number,
19074
19288
  isOpen: PropTypes.bool,
19075
19289
  onClose: PropTypes.func,
19076
19290
  authentication: authenticationType
@@ -19135,12 +19349,22 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19135
19349
  hasError: true
19136
19350
  });
19137
19351
  } // WIP
19138
- // fetchConditions({ ...getAuthentication(this.props.authentication) }).then(
19139
- // (response) => {
19140
- // this.setState({ conditions: _get(response, 'data.data.data') })
19141
- // }
19142
- // )
19143
19352
 
19353
+
19354
+ try {
19355
+ fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
19356
+ var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
19357
+
19358
+ _this.setState({
19359
+ conditions: {
19360
+ persistent: _get(response, 'data.data.data'),
19361
+ session: sessionConditions
19362
+ }
19363
+ });
19364
+ });
19365
+ } catch (e) {
19366
+ console.error(e);
19367
+ }
19144
19368
  });
19145
19369
 
19146
19370
  _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps, prevState) {
@@ -19170,6 +19394,25 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19170
19394
  if (thisTheme && thisTheme !== prevTheme) {
19171
19395
  setCSSVars(getThemeConfig(getThemeConfig(_this.props.themeConfig)));
19172
19396
  }
19397
+
19398
+ if (_this.state.isConditionLockingMenuOpen !== prevState.isConditionLockingMenuOpen) {
19399
+ fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
19400
+ var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
19401
+
19402
+ _this.setState({
19403
+ conditions: {
19404
+ persistent: _get(response, 'data.data.data'),
19405
+ session: sessionConditions
19406
+ }
19407
+ });
19408
+ });
19409
+ }
19410
+
19411
+ if (_this.state.activePage !== prevState.activePage) {
19412
+ _this.setState({
19413
+ isConditionLockingMenuOpen: false
19414
+ });
19415
+ }
19173
19416
  } catch (error) {
19174
19417
  console.error(error);
19175
19418
 
@@ -19351,6 +19594,10 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19351
19594
 
19352
19595
  if (_this.props.onMaskClick) {
19353
19596
  _this.props.onMaskClick();
19597
+
19598
+ _this.setState({
19599
+ isConditionLockingMenuOpen: false
19600
+ });
19354
19601
  }
19355
19602
 
19356
19603
  if (_this.props.onHandleClick) {
@@ -19724,6 +19971,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19724
19971
  },
19725
19972
  overflowCount: 9,
19726
19973
  useDot: true,
19974
+ isAlreadyMountedInDOM: /*#__PURE__*/React.isValidElement( /*#__PURE__*/React.createElement(NotificationIcon, null)),
19727
19975
  onNewNotification: function onNewNotification() {
19728
19976
  // If a new notification is detected, refresh the list
19729
19977
  if (_this.notificationListRef && _this.state.activePage === 'notifications') {
@@ -19737,32 +19985,35 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19737
19985
 
19738
19986
  _defineProperty(_assertThisInitialized(_this), "renderOptionsDropdown", function () {
19739
19987
  if (_this.state.activePage === 'data-messenger') {
19740
- return /*#__PURE__*/React.createElement(Popover, {
19988
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
19989
+ id: "condition-dropdown",
19990
+ style: {
19991
+ justifyContent: 'left',
19992
+ position: 'absolute',
19993
+ right: 30
19994
+ }
19995
+ }, getAutoQLConfig$1(getAutoQLConfig$1(_this.props.autoQLConfig)).enableFilterLocking ? /*#__PURE__*/React.createElement("button", {
19996
+ id: "condition-dropdown",
19997
+ onClick: function onClick() {
19998
+ _this.setState({
19999
+ isConditionLockingMenuOpen: !_this.state.isConditionLockingMenuOpen
20000
+ });
20001
+ },
20002
+ className: "react-autoql-drawer-header-btn clear-all",
20003
+ "data-tip": lang.openFilterLocking,
20004
+ "data-for": "react-autoql-header-tooltip"
20005
+ }, /*#__PURE__*/React.createElement(Icon, {
20006
+ type: _get(_this.state.conditions, 'persistent.length') > 0 || _get(_this.state.conditions, 'session.length') > 0 ? "lock" : "unlock"
20007
+ })) : /*#__PURE__*/React.createElement("span", null)), /*#__PURE__*/React.createElement(Popover, {
19741
20008
  isOpen: _this.state.isOptionsDropdownOpen,
19742
20009
  onClickOutside: function onClickOutside() {
19743
- return _this.setState({
20010
+ _this.setState({
19744
20011
  isOptionsDropdownOpen: false
19745
20012
  });
19746
20013
  },
19747
20014
  position: "bottom" // preferred position
19748
20015
  ,
19749
- content: /*#__PURE__*/React.createElement("div", null, window.location.href.includes('chata-ai-test-page') && /*#__PURE__*/React.createElement("div", {
19750
- className: "clear-messages-confirm-popover"
19751
- }, /*#__PURE__*/React.createElement("div", {
19752
- className: "react-autoql-menu-text",
19753
- onClick: function onClick() {
19754
- _this.setState({
19755
- isConditionLockingMenuOpen: true,
19756
- isOptionsDropdownOpen: false
19757
- });
19758
- }
19759
- }, /*#__PURE__*/React.createElement(Icon, {
19760
- type: "lock"
19761
- }), /*#__PURE__*/React.createElement("span", {
19762
- style: {
19763
- marginLeft: 5
19764
- }
19765
- }, lang.openConditionLocking))), /*#__PURE__*/React.createElement("div", {
20016
+ content: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
19766
20017
  className: "clear-messages-confirm-popover"
19767
20018
  }, /*#__PURE__*/React.createElement("div", {
19768
20019
  className: "react-autoql-menu-text",
@@ -19800,11 +20051,11 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19800
20051
  });
19801
20052
  },
19802
20053
  className: "react-autoql-drawer-header-btn clear-all",
19803
- "data-tip": lang.dataMessengerOptions,
20054
+ "data-tip": lang.clearDataResponses,
19804
20055
  "data-for": "react-autoql-header-tooltip"
19805
20056
  }, /*#__PURE__*/React.createElement(Icon, {
19806
20057
  type: "trash"
19807
- })));
20058
+ }))));
19808
20059
  }
19809
20060
  });
19810
20061
 
@@ -19828,64 +20079,48 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19828
20079
  }, title);
19829
20080
  });
19830
20081
 
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
20082
  _defineProperty(_assertThisInitialized(_this), "renderHeaderContent", function () {
19840
20083
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
19841
20084
  className: "react-autoql-header-left-container"
19842
20085
  }, /*#__PURE__*/React.createElement("button", {
19843
20086
  onClick: function onClick() {
19844
- _this.props.onHandleClick();
19845
-
19846
20087
  _this.setState({
19847
20088
  isConditionLockingMenuOpen: false
19848
20089
  });
20090
+
20091
+ _this.props.onHandleClick();
19849
20092
  },
19850
20093
  className: "react-autoql-drawer-header-btn close",
19851
20094
  "data-tip": lang.closeDataMessenger,
19852
20095
  "data-for": "react-autoql-header-tooltip"
19853
20096
  }, /*#__PURE__*/React.createElement(Icon, {
19854
20097
  type: "close"
19855
- }))), /*#__PURE__*/React.createElement(Popover, {
20098
+ }))), !getAutoQLConfig$1(getAutoQLConfig$1(_this.props.autoQLConfig)).enableFilterLocking ? /*#__PURE__*/React.createElement("div", {
20099
+ className: "react-autoql-header-center-container"
20100
+ }, _this.renderHeaderTitle()) : /*#__PURE__*/React.createElement(Popover, {
19856
20101
  containerStyle: _this.getConditionMenuPosition(),
19857
20102
  isOpen: _this.state.isConditionLockingMenuOpen,
19858
- onClickOutside: function onClickOutside(e) {
19859
- if (_get(e, 'target.innerText') !== lang.openConditionLocking && !_includes(_get(e, 'target.className'), 'react-autosuggest__suggestion') && !_includes(_get(e, 'target.className'), 'condition-list-container')) {
19860
- _this.setState({
19861
- isConditionLockingMenuOpen: false
19862
- });
19863
- }
19864
- },
19865
20103
  position: "bottom",
19866
20104
  padding: 2,
19867
20105
  align: "center",
19868
- content: /*#__PURE__*/React.createElement(ConditionLockMenu, {
20106
+ content: /*#__PURE__*/React.createElement("div", {
20107
+ id: "condition-menu-dropdown",
20108
+ style: {
20109
+ display: 'block'
20110
+ }
20111
+ }, /*#__PURE__*/React.createElement(ConditionLockMenu, {
19869
20112
  authentication: getAuthentication(getAuthentication(_this.props.authentication)),
19870
20113
  containerWidth: _this.getDrawerWidth(),
19871
20114
  isOpen: _this.state.isConditionLockingMenuOpen,
19872
- onClose: function onClose(isSaved) {
19873
- if (isSaved) {
19874
- var el = document.getElementById('condition-lock-snackbar-success');
19875
- el.className = 'show';
19876
- setTimeout(function () {
19877
- el.className = el.className.replace('show', '');
19878
- }, 3000);
19879
- }
19880
-
20115
+ onClose: function onClose() {
19881
20116
  _this.setState({
19882
20117
  isConditionLockingMenuOpen: false
19883
20118
  });
19884
20119
  }
19885
- })
20120
+ }))
19886
20121
  }, /*#__PURE__*/React.createElement("div", {
19887
20122
  className: "react-autoql-header-center-container"
19888
- }, _this.renderHeaderTitle(), _this.renderShowSuccessMessage())), /*#__PURE__*/React.createElement("div", {
20123
+ }, _this.renderHeaderTitle())), /*#__PURE__*/React.createElement("div", {
19889
20124
  className: "react-autoql-header-right-container"
19890
20125
  }, _this.renderOptionsDropdown()));
19891
20126
  });
@@ -19968,7 +20203,12 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19968
20203
  isResizing: _this.state.isResizing,
19969
20204
  enableDynamicCharting: _this.props.enableDynamicCharting,
19970
20205
  onNoneOfTheseClick: _this.onNoneOfTheseClick,
19971
- autoChartAggregations: _this.props.autoChartAggregations
20206
+ autoChartAggregations: _this.props.autoChartAggregations,
20207
+ onConditionClickCallback: function onConditionClickCallback() {
20208
+ _this.setState({
20209
+ isConditionLockingMenuOpen: !_this.state.isConditionLockingMenuOpen
20210
+ });
20211
+ }
19972
20212
  });
19973
20213
  })), _this.state.isChataThinking && /*#__PURE__*/React.createElement("div", {
19974
20214
  className: "response-loading-container"
@@ -20370,6 +20610,36 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
20370
20610
  });
20371
20611
  }
20372
20612
  }
20613
+ }, {
20614
+ key: "removeDuplicateMessengerInstance",
20615
+ value:
20616
+ /**
20617
+ * For some indiscernible reason, the Data Messenger drawer duplicates itself in the DOM.
20618
+ * three times when first opened, then a number more times with each and every query
20619
+ * being made.
20620
+ *
20621
+ * This function removes unnecessary duplicate instances of the Data Messenger Drawer
20622
+ * and should help improve performance a bit by reducing the amount of renders.
20623
+ *
20624
+ * https://stackoverflow.com/questions/57946748/remove-duplicate-dom-element-javascript-not-jquery
20625
+ */
20626
+ function removeDuplicateMessengerInstance() {
20627
+ var instance = {};
20628
+
20629
+ var _iterator = _createForOfIteratorHelper(document.querySelectorAll('.ReactModalPortal')),
20630
+ _step;
20631
+
20632
+ try {
20633
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
20634
+ var item = _step.value;
20635
+ if (instance[item]) item.parentNode.removeChild(item);else instance[item] = true;
20636
+ }
20637
+ } catch (err) {
20638
+ _iterator.e(err);
20639
+ } finally {
20640
+ _iterator.f();
20641
+ }
20642
+ }
20373
20643
  }]);
20374
20644
 
20375
20645
  return DataMessenger;
@@ -20405,6 +20675,9 @@ _defineProperty(DataMessenger, "propTypes", {
20405
20675
  enableDynamicCharting: bool,
20406
20676
  defaultTab: string,
20407
20677
  autoChartAggregations: bool,
20678
+ enableQueryInterpretation: bool,
20679
+ defaultShowInterpretation: bool,
20680
+ enableFilterLocking: bool,
20408
20681
  // Callbacks
20409
20682
  onVisibleChange: func,
20410
20683
  onHandleClick: func,
@@ -20442,6 +20715,9 @@ _defineProperty(DataMessenger, "defaultProps", {
20442
20715
  enableDynamicCharting: true,
20443
20716
  defaultTab: 'data-messenger',
20444
20717
  autoChartAggregations: true,
20718
+ enableQueryInterpretation: false,
20719
+ defaultShowInterpretation: false,
20720
+ enableFilterLocking: false,
20445
20721
  // Callbacks
20446
20722
  onHandleClick: function onHandleClick() {},
20447
20723
  onVisibleChange: function onVisibleChange() {},
@@ -21321,6 +21597,7 @@ var DashboardTile = /*#__PURE__*/function (_React$Component) {
21321
21597
  renderSuggestionsAsDropdown: _this.props.tile.h < 4,
21322
21598
  enableDynamicCharting: _this.props.enableDynamicCharting,
21323
21599
  backgroundColor: document.documentElement.style.getPropertyValue('--react-autoql-background-color-primary'),
21600
+ isDashboardQuery: true,
21324
21601
  onDisplayTypeUpdate: function onDisplayTypeUpdate() {
21325
21602
  // This is necessary to update the toolbar with the newly rendered QueryOutput
21326
21603
  setTimeout(function () {
@@ -21964,6 +22241,7 @@ var Dashboard = /*#__PURE__*/function (_React$Component) {
21964
22241
  dataFormatting: getDataFormatting(_this.props.dataFormatting),
21965
22242
  queryResponse: _this.state.activeDrilldownResponse,
21966
22243
  renderTooltips: false,
22244
+ isDashboardQuery: true,
21967
22245
  autoChartAggregations: _this.props.autoChartAggregations,
21968
22246
  backgroundColor: document.documentElement.style.getPropertyValue('--react-autoql-background-color-primary'),
21969
22247
  reportProblemCallback: _this.reportProblemCallback,
@@ -21985,6 +22263,7 @@ var Dashboard = /*#__PURE__*/function (_React$Component) {
21985
22263
  dataFormatting: getDataFormatting(_this.props.dataFormatting),
21986
22264
  queryResponse: _this.state.activeDrilldownResponse,
21987
22265
  renderTooltips: false,
22266
+ isDashboardQuery: true,
21988
22267
  autoChartAggregations: _this.props.autoChartAggregations,
21989
22268
  backgroundColor: document.documentElement.style.getPropertyValue('--react-autoql-background-color-primary'),
21990
22269
  reportProblemCallback: _this.reportProblemCallback,
@@ -22043,7 +22322,7 @@ var Dashboard = /*#__PURE__*/function (_React$Component) {
22043
22322
  displayType = tile.secondDisplayType;
22044
22323
  dataConfig = tile.secondDataConfig;
22045
22324
  } else if (tile && !_this.state.isDrilldownSecondHalf) {
22046
- title = tile.query;
22325
+ title = tile.title;
22047
22326
  queryResponse = tile.queryResponse;
22048
22327
  displayType = tile.displayType;
22049
22328
  dataConfig = tile.dataConfig;
@@ -22082,6 +22361,7 @@ var Dashboard = /*#__PURE__*/function (_React$Component) {
22082
22361
  queryResponse: queryResponse,
22083
22362
  displayType: displayType,
22084
22363
  dataConfig: dataConfig,
22364
+ isDashboardQuery: true,
22085
22365
  autoChartAggregations: _this.props.autoChartAggregations,
22086
22366
  onDataClick: function onDataClick(drilldownData, queryID) {
22087
22367
  _this.startDrilldown(drilldownData, queryID, tile.i);
@@ -22262,4 +22542,215 @@ _defineProperty(Dashboard, "defaultProps", {
22262
22542
  onChange: function onChange() {}
22263
22543
  });
22264
22544
 
22545
+ var SpeechToTextBtn = /*#__PURE__*/function (_React$Component) {
22546
+ _inherits(SpeechToTextBtn, _React$Component);
22547
+
22548
+ var _super = _createSuper(SpeechToTextBtn);
22549
+
22550
+ function SpeechToTextBtn() {
22551
+ var _this;
22552
+
22553
+ _classCallCheck(this, SpeechToTextBtn);
22554
+
22555
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22556
+ args[_key] = arguments[_key];
22557
+ }
22558
+
22559
+ _this = _super.call.apply(_super, [this].concat(args));
22560
+
22561
+ _defineProperty(_assertThisInitialized(_this), "state", {
22562
+ isRecording: false,
22563
+ currentQuery: 0,
22564
+ resultHistory: [],
22565
+ currentFile: '',
22566
+ currentBlob: '',
22567
+ showPopoverMessage: false,
22568
+ errorMessage: ''
22569
+ });
22570
+
22571
+ _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
22572
+ setCSSVars(getThemeConfig(_this.props.themeConfig));
22573
+ });
22574
+
22575
+ _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps) {
22576
+ if (_this.props.finalTranscript !== prevProps.finalTranscript) {
22577
+ _this.props.onFinalTranscript(_this.props.finalTranscript);
22578
+ } else if (_this.props.transcript !== prevProps.transcript) {
22579
+ _this.props.onTranscriptChange(_this.props.transcript);
22580
+ } else if (_this.props.interimTranscript !== prevProps.interimTranscript) {
22581
+ _this.props.onTranscriptChange(_this.props.interimTranscript);
22582
+ }
22583
+ });
22584
+
22585
+ _defineProperty(_assertThisInitialized(_this), "startRecording", function () {
22586
+ _this.setState({
22587
+ isRecording: true
22588
+ });
22589
+
22590
+ navigator.getUserMedia({
22591
+ audio: true
22592
+ }, function (stream) {
22593
+ _this.stream = stream;
22594
+ _this.recordAudio = RecordRTC(_this.stream, {
22595
+ type: 'audio',
22596
+ mimeType: 'audio/webm',
22597
+ desiredSampRate: 16000,
22598
+ recorderType: StereoAudioRecorder,
22599
+ numberOfAudioChannels: 1
22600
+ });
22601
+
22602
+ _this.recordAudio.startRecording();
22603
+ }, function (error) {
22604
+ console.error(JSON.stringify(error));
22605
+ });
22606
+ });
22607
+
22608
+ _defineProperty(_assertThisInitialized(_this), "onRecordStop", function (file, blob) {
22609
+ _this.setState({
22610
+ // isConfirmingRecording: true,
22611
+ currentFile: file,
22612
+ currentBlob: blob //hasPlayedBack: false,
22613
+
22614
+ }, function () {
22615
+ _this.sendWavFile(file);
22616
+ });
22617
+ });
22618
+
22619
+ _defineProperty(_assertThisInitialized(_this), "stopRecording", function () {
22620
+ _this.setState({
22621
+ isRecording: false
22622
+ });
22623
+
22624
+ _this.recordAudio.stopRecording(function () {
22625
+ var blob = _this.recordAudio.getBlob();
22626
+
22627
+ _this.onRecordStop(_this.blobToFile(blob), blob);
22628
+
22629
+ try {
22630
+ _this.stream.getTracks().forEach(function (track) {
22631
+ return track.stop();
22632
+ });
22633
+ } catch (error) {
22634
+ console.error(error);
22635
+ }
22636
+ });
22637
+ });
22638
+
22639
+ _defineProperty(_assertThisInitialized(_this), "blobToFile", function (theBlob) {
22640
+ //A Blob() is almost a File() - it's just missing the two properties below which we will add
22641
+ theBlob.lastModifiedDate = new Date();
22642
+ theBlob.name = 'speech.wav';
22643
+ return theBlob;
22644
+ });
22645
+
22646
+ _defineProperty(_assertThisInitialized(_this), "getMediaPermissionStatus", function () {
22647
+ return navigator.permissions.query({
22648
+ name: 'microphone'
22649
+ }).then(function (permissionStatus) {
22650
+ return permissionStatus.state;
22651
+ });
22652
+ });
22653
+
22654
+ _defineProperty(_assertThisInitialized(_this), "onMouseDown", function () {
22655
+ ReactTooltip.hide();
22656
+
22657
+ _this.startRecording();
22658
+ });
22659
+
22660
+ _defineProperty(_assertThisInitialized(_this), "sendWavFile", function (file) {
22661
+ var url = "".concat(_this.props.authentication.domain, "/autoql/api/v1/query/speech-to-text?key=").concat(_this.props.authentication.apiKey);
22662
+ var data = new FormData();
22663
+ data.append('file', file, 'speech.wav');
22664
+ var config = {
22665
+ headers: {
22666
+ Authorization: "Bearer ".concat(_this.props.authentication.token)
22667
+ },
22668
+ timeout: 30000
22669
+ };
22670
+ axios.post(url, data, config).then(function (res) {
22671
+ _this.props.onTranscriptChange(res.data.data.transcription);
22672
+ }).catch(function (error) {
22673
+ if (error.response.status === 404) {
22674
+ _this.setState({
22675
+ errorMessage: 'Oops! Speech-to-text has not been enabled. Try typing a query instead.'
22676
+ }, function () {
22677
+ _this.setState({
22678
+ showPopoverMessage: true
22679
+ });
22680
+ });
22681
+ } else {
22682
+ _this.setState({
22683
+ errorMessage: 'Oops! Something wrong with your account'
22684
+ }, function () {
22685
+ _this.setState({
22686
+ showPopoverMessage: true
22687
+ });
22688
+ });
22689
+ }
22690
+ });
22691
+ });
22692
+
22693
+ _defineProperty(_assertThisInitialized(_this), "render", function () {
22694
+ return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Popover, {
22695
+ isOpen: _this.state.showPopoverMessage,
22696
+ padding: 20,
22697
+ content: function content() {
22698
+ return /*#__PURE__*/React.createElement("div", {
22699
+ style: {
22700
+ backgroundColor: '#FFD2D2',
22701
+ opacity: 1,
22702
+ paddingLeft: '10px',
22703
+ paddingRight: '10px'
22704
+ }
22705
+ }, /*#__PURE__*/React.createElement(Icon, {
22706
+ type: "warning-triangle"
22707
+ }), " ", _this.state.errorMessage);
22708
+ },
22709
+ onClickOutside: function onClickOutside() {
22710
+ return _this.setState({
22711
+ showPopoverMessage: false
22712
+ });
22713
+ }
22714
+ }, /*#__PURE__*/React.createElement("button", {
22715
+ id: "react-autoql-voice-record-button",
22716
+ "data-test": "speech-to-text-btn",
22717
+ className: "chat-voice-record-button".concat(_this.state.isRecording ? ' listening' : ''),
22718
+ onMouseDown: _this.onMouseDown,
22719
+ onMouseUp: _this.stopRecording,
22720
+ onMouseLeave: _this.state.isRecording ? _this.stopRecording : undefined,
22721
+ "data-tip": "Hold for voice-to-text",
22722
+ "data-for": "react-autoql-speech-to-text-tooltip",
22723
+ "data-tip-disable": _this.state.isRecording
22724
+ }, /*#__PURE__*/React.createElement(Icon, {
22725
+ type: "microphone"
22726
+ }))), /*#__PURE__*/React.createElement(ReactTooltip, {
22727
+ className: "react-autoql-tooltip",
22728
+ id: "react-autoql-speech-to-text-tooltip",
22729
+ effect: "solid",
22730
+ delayShow: 800
22731
+ }));
22732
+ });
22733
+
22734
+ return _this;
22735
+ }
22736
+
22737
+ return SpeechToTextBtn;
22738
+ }(React.Component);
22739
+
22740
+ _defineProperty(SpeechToTextBtn, "propTypes", {
22741
+ authentication: authenticationType,
22742
+ themeConfig: themeConfigType,
22743
+ transcript: PropTypes.string,
22744
+ interimTranscript: PropTypes.string,
22745
+ finalTranscript: PropTypes.string,
22746
+ resetTranscript: PropTypes.func,
22747
+ onTranscriptChange: PropTypes.func,
22748
+ onFinalTranscript: PropTypes.func
22749
+ });
22750
+
22751
+ _defineProperty(SpeechToTextBtn, "defaultProps", {
22752
+ authentication: authenticationDefault,
22753
+ themeConfig: themeConfigDefault
22754
+ });
22755
+
22265
22756
  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 };