react-autoql 3.4.2 → 3.4.3

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.
@@ -12069,11 +12069,9 @@ var NotificationIcon = /*#__PURE__*/function (_React$Component) {
12069
12069
  while (1) {
12070
12070
  switch (_context.prev = _context.next) {
12071
12071
  case 0:
12072
- _this._isMounted = true;
12072
+ _this._isMounted = true; // this.subscribeToNotificationCount()
12073
12073
 
12074
- _this.subscribeToNotificationCount();
12075
-
12076
- case 2:
12074
+ case 1:
12077
12075
  case "end":
12078
12076
  return _context.stop();
12079
12077
  }
@@ -14955,12 +14953,8 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
14955
14953
  type: type
14956
14954
  })).then(function (response) {
14957
14955
  _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
- })
14956
+ customAlertsList: _get(response, 'data.custom_alerts'),
14957
+ projectAlertsList: _get(response, 'data.project_alerts')
14964
14958
  });
14965
14959
  }).catch(function (error) {
14966
14960
  console.error(error);
@@ -15022,20 +15016,13 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15022
15016
  _defineProperty(_assertThisInitialized(_this), "onEnableSwitchChange", function (e, dataAlert) {
15023
15017
  var newStatus = e.target.checked ? 'ACTIVE' : 'INACTIVE';
15024
15018
  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
15019
 
15033
15020
  var oldList = _cloneDeep(_this.state[listType]);
15034
15021
 
15035
15022
  var newList = _this.state[listType].map(function (n) {
15036
15023
  if (dataAlert.id === n.id) {
15037
15024
  return _objectSpread2(_objectSpread2({}, n), {}, {
15038
- projects: newProjects
15025
+ status: newStatus
15039
15026
  });
15040
15027
  }
15041
15028
 
@@ -15130,13 +15117,8 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15130
15117
  });
15131
15118
 
15132
15119
  _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';
15120
+ console.log(dataAlert);
15121
+ return dataAlert.status === 'GENERAL_ERROR' || dataAlert.status === 'EVALUATION_ERROR' || dataAlert.status === 'DATA_RETURN_ERROR';
15140
15122
  });
15141
15123
 
15142
15124
  _defineProperty(_assertThisInitialized(_this), "renderNotificationlist", function (type, list) {
@@ -15148,7 +15130,7 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15148
15130
  className: "data-alerts-list-container"
15149
15131
  }, 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
15132
  className: "react-autoql-notification-settings-container"
15151
- }, list.map(function (notification, i) {
15133
+ }, list && list.map(function (notification, i) {
15152
15134
  return /*#__PURE__*/React.createElement("div", {
15153
15135
  key: "react-autoql-notification-setting-item-".concat(i),
15154
15136
  className: "react-autoql-notification-setting-item ".concat(notification.type)
@@ -15205,16 +15187,12 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15205
15187
  })) : /*#__PURE__*/React.createElement(Checkbox, {
15206
15188
  themeConfig: getThemeConfig(_this.props.themeConfig),
15207
15189
  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,
15190
+ checked: notification.status === 'ACTIVE' || notification.status === 'WAITING',
15211
15191
  className: "react-autoql-notification-enable-checkbox",
15212
15192
  onClick: function onClick(e) {
15213
15193
  return e.stopPropagation();
15214
15194
  },
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',
15195
+ "data-tip": notification.status === 'ACTIVE' || notification.status === 'WAITING',
15218
15196
  "data-for": "react-autoql-notification-settings-tooltip",
15219
15197
  onChange: function onChange(e) {
15220
15198
  _this.onEnableSwitchChange(e, notification);
@@ -15246,16 +15224,16 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15246
15224
  });
15247
15225
 
15248
15226
  _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
- // }
15227
+ if (!_this.state.customAlertsList) {
15228
+ return /*#__PURE__*/React.createElement("div", {
15229
+ "data-test": "notification-settings",
15230
+ style: {
15231
+ textAlign: 'center',
15232
+ marginTop: '100px'
15233
+ }
15234
+ }, /*#__PURE__*/React.createElement(LoadingDots, null));
15235
+ }
15236
+
15259
15237
  var projectAlertsList = _get(_this.state, 'projectAlertsList', []);
15260
15238
 
15261
15239
  var customAlertsList = _get(_this.state, 'customAlertsList', []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-autoql",
3
- "version": "3.4.2",
3
+ "version": "3.4.3",
4
4
  "description": "React Widget Library",
5
5
  "main": "dist/autoql.cjs.js",
6
6
  "module": "dist/autoql.esm.js",