react-autoql 3.4.2 → 3.4.6

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.
@@ -2715,7 +2715,12 @@ var runQueryOnly = function runQueryOnly() {
2715
2715
  source = _ref4.source,
2716
2716
  AutoAEId = _ref4.AutoAEId;
2717
2717
 
2718
- var url = "".concat(domain, "/autoql/api/v2/query?key=").concat(apiKey);
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 {
2721
+
2722
+ url = "".concat(domain, "/autoql/api/v1/query?key=").concat(apiKey); // }
2723
+
2719
2724
  var finalUserSelection = transformUserSelection(userSelection);
2720
2725
  var data = {
2721
2726
  text: query,
@@ -11994,7 +11999,7 @@ var validateExpression = function validateExpression(_ref20) {
11994
11999
  });
11995
12000
  }; // DELETE
11996
12001
 
11997
- var deleteDataAlert = function deleteDataAlert(dataAlertId, projectId, authObject) {
12002
+ var deleteDataAlert = function deleteDataAlert(dataAlertId, authObject) {
11998
12003
  // If there is missing data, dont bother making the call
11999
12004
  var domain = authObject.domain,
12000
12005
  apiKey = authObject.apiKey,
@@ -14358,13 +14363,13 @@ var DataAlertModal = /*#__PURE__*/function (_React$Component) {
14358
14363
  isDeletingDataAlert: true
14359
14364
  });
14360
14365
 
14361
- deleteDataAlert(dataAlertId, _this.props.activeAlertType, _this.props.authObject).then(function () {
14366
+ deleteDataAlert(dataAlertId, getAuthentication(_this.props.authentication)).then(function () {
14362
14367
  _this.setState({
14363
14368
  isDeletingDataAlert: false,
14364
14369
  isConfirmDeleteModalVisible: false
14365
14370
  });
14366
14371
 
14367
- _this.props.handleAlertDeletedByWidget();
14372
+ _this.props.onDelete(dataAlertId);
14368
14373
 
14369
14374
  _this.props.onClose(false);
14370
14375
  }).catch(function (error) {
@@ -14941,7 +14946,7 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
14941
14946
  _this.getDataAlerts();
14942
14947
  }
14943
14948
 
14944
- if (!_isEqual(_this.state.projectAlertsList, prevState.projectAlertsList)) {
14949
+ if (!_isEqual(_this.state.projectAlertsList, prevState.projectAlertsList) || !_isEqual(_this.state.customAlertsList, prevState.customAlertsList)) {
14945
14950
  _this.getDataAlerts();
14946
14951
  }
14947
14952
  });
@@ -14955,12 +14960,8 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
14955
14960
  type: type
14956
14961
  })).then(function (response) {
14957
14962
  _this._isMounted && _this.setState({
14958
- customAlertsList: [],
14959
- projectAlertsList: response.data.items.filter(function (al) {
14960
- return _$1.find(al.projects, function (p) {
14961
- return p.id === _this.props.selectedDemoProjectId;
14962
- });
14963
- })
14963
+ customAlertsList: _get(response, 'data.custom_alerts'),
14964
+ projectAlertsList: _get(response, 'data.project_alerts')
14964
14965
  });
14965
14966
  }).catch(function (error) {
14966
14967
  console.error(error);
@@ -15022,20 +15023,13 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15022
15023
  _defineProperty(_assertThisInitialized(_this), "onEnableSwitchChange", function (e, dataAlert) {
15023
15024
  var newStatus = e.target.checked ? 'ACTIVE' : 'INACTIVE';
15024
15025
  var listType = dataAlert.type === 'CUSTOM' ? 'customAlertsList' : 'projectAlertsList';
15025
- var newProjects = dataAlert.projects.map(function (p) {
15026
- if (p.id === _this.props.selectedDemoProjectId) {
15027
- p.status = newStatus;
15028
- }
15029
-
15030
- return p;
15031
- });
15032
15026
 
15033
15027
  var oldList = _cloneDeep(_this.state[listType]);
15034
15028
 
15035
15029
  var newList = _this.state[listType].map(function (n) {
15036
15030
  if (dataAlert.id === n.id) {
15037
15031
  return _objectSpread2(_objectSpread2({}, n), {}, {
15038
- projects: newProjects
15032
+ status: newStatus
15039
15033
  });
15040
15034
  }
15041
15035
 
@@ -15130,13 +15124,7 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15130
15124
  });
15131
15125
 
15132
15126
  _defineProperty(_assertThisInitialized(_this), "hasError", function (dataAlert) {
15133
- return dataAlert.projects.map(function (p) {
15134
- return p.id === _this.props.selectedDemoProjectId;
15135
- })[0].status === 'GENERAL_ERROR' || dataAlert.projects.map(function (p) {
15136
- return p.id === _this.props.selectedDemoProjectId;
15137
- })[0].status === 'EVALUATION_ERROR' || dataAlert.projects.map(function (p) {
15138
- return p.id === _this.props.selectedDemoProjectId;
15139
- })[0].status === 'DATA_RETURN_ERROR';
15127
+ return dataAlert.status === 'GENERAL_ERROR' || dataAlert.status === 'EVALUATION_ERROR' || dataAlert.status === 'DATA_RETURN_ERROR';
15140
15128
  });
15141
15129
 
15142
15130
  _defineProperty(_assertThisInitialized(_this), "renderNotificationlist", function (type, list) {
@@ -15148,7 +15136,7 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15148
15136
  className: "data-alerts-list-container"
15149
15137
  }, type === 'custom' && _this.renderNotificationGroupTitle('Custom Data Alerts', 'View and manage your custom Data Alerts', true), type === 'custom' && !_get(list, 'length') && _this.renderEmptyListMessage(), type === 'project' && _this.renderNotificationGroupTitle('Subscribe to a Data Alert', 'Choose from a range of ready-to-use Alerts that have been set up for you'), /*#__PURE__*/React.createElement("div", {
15150
15138
  className: "react-autoql-notification-settings-container"
15151
- }, list.map(function (notification, i) {
15139
+ }, list && list.map(function (notification, i) {
15152
15140
  return /*#__PURE__*/React.createElement("div", {
15153
15141
  key: "react-autoql-notification-setting-item-".concat(i),
15154
15142
  className: "react-autoql-notification-setting-item ".concat(notification.type)
@@ -15205,16 +15193,12 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15205
15193
  })) : /*#__PURE__*/React.createElement(Checkbox, {
15206
15194
  themeConfig: getThemeConfig(_this.props.themeConfig),
15207
15195
  type: "switch",
15208
- checked: notification.projects && notification.projects.filter(function (p) {
15209
- return p.status === 'ACTIVE' && p.id === _this.props.selectedDemoProjectId || p.status === 'WAITING' && p.id === _this.props.selectedDemoProjectId;
15210
- }).length > 0,
15196
+ checked: notification.status === 'ACTIVE' || notification.status === 'WAITING',
15211
15197
  className: "react-autoql-notification-enable-checkbox",
15212
15198
  onClick: function onClick(e) {
15213
15199
  return e.stopPropagation();
15214
15200
  },
15215
- "data-tip": notification.projects && notification.projects.filter(function (p) {
15216
- return p.status === 'ACTIVE' && p.id === _this.props.selectedDemoProjectId || p.status === 'WAITING' && p.id === _this.props.selectedDemoProjectId;
15217
- }).length > 0 ? 'Turn Data Alert off' : 'Turn Data Alert on',
15201
+ "data-tip": notification.status === 'ACTIVE' || notification.status === 'WAITING',
15218
15202
  "data-for": "react-autoql-notification-settings-tooltip",
15219
15203
  onChange: function onChange(e) {
15220
15204
  _this.onEnableSwitchChange(e, notification);
@@ -15246,16 +15230,16 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15246
15230
  });
15247
15231
 
15248
15232
  _defineProperty(_assertThisInitialized(_this), "render", function () {
15249
- // if (!this.state.customAlertsList) {
15250
- // return (
15251
- // <div
15252
- // data-test="notification-settings"
15253
- // style={{ textAlign: 'center', marginTop: '100px' }}
15254
- // >
15255
- // <LoadingDots />
15256
- // </div>
15257
- // )
15258
- // }
15233
+ if (!_this.state.customAlertsList) {
15234
+ return /*#__PURE__*/React.createElement("div", {
15235
+ "data-test": "notification-settings",
15236
+ style: {
15237
+ textAlign: 'center',
15238
+ marginTop: '100px'
15239
+ }
15240
+ }, /*#__PURE__*/React.createElement(LoadingDots, null));
15241
+ }
15242
+
15259
15243
  var projectAlertsList = _get(_this.state, 'projectAlertsList', []);
15260
15244
 
15261
15245
  var customAlertsList = _get(_this.state, 'customAlertsList', []);
@@ -19153,7 +19137,6 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19153
19137
  } // WIP
19154
19138
  // fetchConditions({ ...getAuthentication(this.props.authentication) }).then(
19155
19139
  // (response) => {
19156
- // console.log(_get(response, 'data.data.data'))
19157
19140
  // this.setState({ conditions: _get(response, 'data.data.data') })
19158
19141
  // }
19159
19142
  // )
@@ -19763,7 +19746,23 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19763
19746
  },
19764
19747
  position: "bottom" // preferred position
19765
19748
  ,
19766
- content: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
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", {
19767
19766
  className: "clear-messages-confirm-popover"
19768
19767
  }, /*#__PURE__*/React.createElement("div", {
19769
19768
  className: "react-autoql-menu-text",
@@ -19804,7 +19803,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19804
19803
  "data-tip": lang.dataMessengerOptions,
19805
19804
  "data-for": "react-autoql-header-tooltip"
19806
19805
  }, /*#__PURE__*/React.createElement(Icon, {
19807
- type: "menu"
19806
+ type: "trash"
19808
19807
  })));
19809
19808
  }
19810
19809
  });
@@ -19977,26 +19976,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19977
19976
  className: "response-loading"
19978
19977
  }, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("div", null))), /*#__PURE__*/React.createElement("div", {
19979
19978
  className: "chat-bar-container"
19980
- }, _this.state.conditions && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
19981
- id: "conditionListContent",
19982
- className: "condition-list-display"
19983
- }, /*#__PURE__*/React.createElement("h5", null, "Content:"), /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, "thing 1"), /*#__PURE__*/React.createElement("li", null, "thing 2"))), /*#__PURE__*/React.createElement("span", {
19984
- className: "condition-list-container",
19985
- onMouseEnter: function onMouseEnter() {
19986
- return document.getElementById('conditionListContent').style.display = 'block';
19987
- },
19988
- onMouseLeave: function onMouseLeave() {
19989
- return document.getElementById('conditionListContent').style.display = 'none';
19990
- },
19991
- onClick: function onClick() {
19992
- _this.setState({
19993
- isConditionLockingMenuOpen: true,
19994
- isOptionsDropdownOpen: false
19995
- });
19996
- }
19997
- }, /*#__PURE__*/React.createElement(Icon, {
19998
- type: "lock"
19999
- }), " Conditions")), /*#__PURE__*/React.createElement("div", {
19979
+ }, /*#__PURE__*/React.createElement("div", {
20000
19980
  className: "watermark"
20001
19981
  }, /*#__PURE__*/React.createElement(Icon, {
20002
19982
  type: "react-autoql-bubbles-outlined"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-autoql",
3
- "version": "3.4.2",
3
+ "version": "3.4.6",
4
4
  "description": "React Widget Library",
5
5
  "main": "dist/autoql.cjs.js",
6
6
  "module": "dist/autoql.esm.js",