versacall-core-library-react 2.0.66 → 2.0.68

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.
Files changed (121) hide show
  1. package/dist/components/CoreAlert/CoreAlert.js +43 -107
  2. package/dist/components/CoreAlert/index.js +2 -4
  3. package/dist/components/CoreAppBar/CoreAppBar.js +275 -418
  4. package/dist/components/CoreAppBar/CoreAppBarDrawer.js +88 -171
  5. package/dist/components/CoreAppBar/index.js +2 -4
  6. package/dist/components/CoreAppSelector/AppLink.js +36 -60
  7. package/dist/components/CoreAppSelector/CoreAppSelector.js +109 -200
  8. package/dist/components/CoreAppSelector/index.js +2 -4
  9. package/dist/components/CoreDialogueToolBar/CoreDialogueToolBar.js +43 -69
  10. package/dist/components/CoreDialogueToolBar/index.js +2 -4
  11. package/dist/components/CoreDrawer/CoreDrawer.js +168 -286
  12. package/dist/components/CoreDrawer/index.js +2 -4
  13. package/dist/components/CoreDropDownTextfield/CoreDropDownTextfield.js +57 -121
  14. package/dist/components/CoreDropDownTextfield/index.js +2 -4
  15. package/dist/components/CoreElapsedTime/CoreElapsedTime.js +38 -97
  16. package/dist/components/CoreElapsedTime/index.js +2 -4
  17. package/dist/components/CoreFrame/CoreFrame.js +17 -28
  18. package/dist/components/CoreFrame/index.js +2 -4
  19. package/dist/components/CoreImportDialog/CoreImportDialog.js +87 -189
  20. package/dist/components/CoreImportDialog/index.js +2 -4
  21. package/dist/components/CoreImportResultsDialog/CoreImportResultsDialog.js +19 -45
  22. package/dist/components/CoreImportResultsDialog/index.js +2 -4
  23. package/dist/components/CoreImporting/CoreImporting.js +23 -39
  24. package/dist/components/CoreImporting/index.js +2 -4
  25. package/dist/components/CorePlugin/CorePlugin.js +83 -160
  26. package/dist/components/CorePlugin/OldCorePlugin.js +73 -149
  27. package/dist/components/CorePlugin/index.js +2 -4
  28. package/dist/components/CoreSaveChangesDialog/CoreSaveChangesDialog.js +10 -32
  29. package/dist/components/CoreSaveChangesDialog/index.js +2 -4
  30. package/dist/components/CoreShiftTagFilter/CoreShiftTagFilter.js +288 -408
  31. package/dist/components/CoreShiftTagFilter/OldCoreShiftTagFilter.js +161 -257
  32. package/dist/components/CoreShiftTagFilter/index.js +2 -4
  33. package/dist/components/CoreSideBar/CoreSideBar.js +578 -737
  34. package/dist/components/CoreSideBar/CoreSideBarDrawer.js +122 -212
  35. package/dist/components/CoreSideBar/index.js +2 -4
  36. package/dist/components/CoreSnackBar/CoreSnackBar.js +76 -143
  37. package/dist/components/CoreSnackBar/index.js +2 -4
  38. package/dist/components/CoreTable/CoreTable.js +219 -337
  39. package/dist/components/CoreTable/CoreTableChips.js +11 -19
  40. package/dist/components/CoreTable/CoreTableHead.js +125 -205
  41. package/dist/components/CoreTable/CoreTableToolbar.js +34 -56
  42. package/dist/components/CoreTable/index.js +2 -4
  43. package/dist/components/CoreTagFilter/CoreTagFilter.js +212 -319
  44. package/dist/components/CoreTagFilter/OldCoreTagFilter.js +270 -402
  45. package/dist/components/CoreTagFilter/OldTagChip.js +10 -20
  46. package/dist/components/CoreTagFilter/OldTagFilterSelector.js +77 -148
  47. package/dist/components/CoreTagFilter/OldTagOption.js +21 -47
  48. package/dist/components/CoreTagFilter/TagFilterBuilder.js +114 -274
  49. package/dist/components/CoreTagFilter/index.js +2 -4
  50. package/dist/components/CoreTextField/CoreTextField.js +69 -132
  51. package/dist/components/CoreTextField/index.js +2 -4
  52. package/dist/components/CoreTheme/CoreTheme.js +13 -27
  53. package/dist/components/CoreTheme/index.js +2 -4
  54. package/dist/components/CoreTile/CoreTile.js +21 -34
  55. package/dist/components/CoreTile/CoreTileToolbar.js +21 -36
  56. package/dist/components/CoreTile/index.js +2 -4
  57. package/dist/components/CoreTimerInput/CoreTimerInput.js +36 -60
  58. package/dist/components/CoreTimerInput/CoreTimerInputOld.js +29 -47
  59. package/dist/components/CoreTimerInput/index.js +2 -4
  60. package/dist/components/CoreToolbar/CoreToolbar.js +65 -95
  61. package/dist/components/CoreToolbar/index.js +2 -4
  62. package/dist/components/CoreTracker/CoreTracker.js +32 -91
  63. package/dist/components/CoreTracker/index.js +2 -4
  64. package/dist/components/CoreTranslate/CoreTranslate.js +17 -48
  65. package/dist/components/CoreTranslate/index.js +2 -4
  66. package/dist/components/CoreTranslateWrapper/CoreTranslateWrapper.js +7 -15
  67. package/dist/components/CoreTranslateWrapper/index.js +2 -4
  68. package/dist/components/CoreWidget/CoreWidget.js +81 -149
  69. package/dist/components/CoreWidget/index.js +2 -4
  70. package/dist/components/CoreWrapper/CoreWrapper.js +8 -16
  71. package/dist/components/CoreWrapper/index.js +2 -4
  72. package/dist/components/index.js +29 -58
  73. package/dist/constants/index.js +3 -6
  74. package/dist/constants/testOrganization.js +2 -3
  75. package/dist/constants/testToken.js +2 -3
  76. package/dist/context/Authentication/AuthenticationContext.js +3 -8
  77. package/dist/context/Authentication/AuthenticationProvider.js +153 -268
  78. package/dist/context/Authentication/index.js +4 -8
  79. package/dist/context/Authentication/withAuthentication.js +5 -14
  80. package/dist/context/Channels/ChannelsConsumer.js +14 -70
  81. package/dist/context/Channels/ChannelsContext.js +3 -8
  82. package/dist/context/Channels/ChannelsProvider.js +133 -279
  83. package/dist/context/Channels/DataChannel.js +39 -103
  84. package/dist/context/Channels/EntityChannel.js +40 -104
  85. package/dist/context/Channels/EveryoneChannel.js +32 -92
  86. package/dist/context/Channels/OrganizationChannel.js +40 -104
  87. package/dist/context/Channels/UserChannel.js +37 -99
  88. package/dist/context/Channels/index.js +10 -20
  89. package/dist/context/Channels/withChannels.js +5 -14
  90. package/dist/context/Core/CoreContext.js +3 -8
  91. package/dist/context/Core/CoreProvider.js +68 -132
  92. package/dist/context/Core/index.js +4 -8
  93. package/dist/context/Core/withCore.js +5 -14
  94. package/dist/context/Organization/OrganizationContext.js +3 -8
  95. package/dist/context/Organization/OrganizationProvider.js +48 -120
  96. package/dist/context/Organization/index.js +4 -8
  97. package/dist/context/Organization/withOrganization.js +5 -14
  98. package/dist/context/Plugin/PluginContext.js +3 -8
  99. package/dist/context/Plugin/PluginProvider.js +55 -112
  100. package/dist/context/Plugin/index.js +4 -8
  101. package/dist/context/Plugin/withPlugin.js +5 -14
  102. package/dist/context/index.js +5 -15
  103. package/dist/css/index.js +3 -6
  104. package/dist/functions/TagEvaluator.js +107 -156
  105. package/dist/functions/compareObjects.js +0 -7
  106. package/dist/functions/formatElapsedTime.js +5 -6
  107. package/dist/functions/formatNameFileSafe.js +3 -4
  108. package/dist/functions/getIconUrl.js +0 -3
  109. package/dist/functions/getParameterByName.js +9 -12
  110. package/dist/functions/getProperty.js +4 -8
  111. package/dist/functions/getUrl.js +0 -3
  112. package/dist/functions/index.js +9 -18
  113. package/dist/icons/CopyIcon.js +11 -22
  114. package/dist/icons/DeleteIcon.js +11 -22
  115. package/dist/icons/DuplicateIcon.js +11 -22
  116. package/dist/icons/EditIcon.js +11 -22
  117. package/dist/icons/FabAddIcon.js +19 -35
  118. package/dist/icons/PasteIcon.js +11 -22
  119. package/dist/icons/index.js +7 -14
  120. package/dist/index.js +6 -18
  121. package/package.json +89 -79
@@ -4,97 +4,43 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireWildcard(require("react"));
9
-
10
8
  var _LocationCity = _interopRequireDefault(require("@material-ui/icons/LocationCity"));
11
-
12
9
  var _AccountCircle = _interopRequireDefault(require("@material-ui/icons/AccountCircle"));
13
-
14
10
  var _StarBorder = _interopRequireDefault(require("@material-ui/icons/StarBorder"));
15
-
16
11
  var _ListItemIcon = _interopRequireDefault(require("@material-ui/core/ListItemIcon"));
17
-
18
12
  var _ListItemText = _interopRequireDefault(require("@material-ui/core/ListItemText"));
19
-
20
13
  var _Settings = _interopRequireDefault(require("@material-ui/icons/Settings"));
21
-
22
14
  var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
23
-
24
15
  var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
25
-
26
16
  var _styles = require("@material-ui/core/styles");
27
-
28
17
  var _ListItem = _interopRequireDefault(require("@material-ui/core/ListItem"));
29
-
30
18
  var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
31
-
32
19
  var _Toolbar = _interopRequireDefault(require("@material-ui/core/Toolbar"));
33
-
34
20
  var _Divider = _interopRequireDefault(require("@material-ui/core/Divider"));
35
-
36
21
  var _Menu = _interopRequireDefault(require("@material-ui/icons/Menu"));
37
-
38
22
  var _Star = _interopRequireDefault(require("@material-ui/icons/Star"));
39
-
40
23
  var _AppBar = _interopRequireDefault(require("@material-ui/core/AppBar"));
41
-
42
24
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
43
-
44
25
  var _Avatar = _interopRequireDefault(require("@material-ui/core/Avatar"));
45
-
46
26
  var _reactIntl = require("react-intl");
47
-
48
27
  var _Menu2 = _interopRequireDefault(require("@material-ui/core/Menu"));
49
-
50
28
  var _propTypes = _interopRequireDefault(require("prop-types"));
51
-
52
29
  var _context = require("../../context");
53
-
54
30
  var _CoreAppBarDrawer = _interopRequireDefault(require("./CoreAppBarDrawer"));
55
-
56
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
57
-
58
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
59
-
60
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
61
-
62
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
63
-
64
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
65
-
66
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
67
-
68
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
69
-
70
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
71
-
72
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
73
-
74
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
75
-
76
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
77
-
78
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
79
-
80
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
81
-
82
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
83
-
84
- var namespace = 'CoreAppBar';
85
-
86
- var styles = function styles() {
87
- return {
88
- topPadding: {
89
- minHeight: 56,
90
- '@media (min-width:600px)': {
91
- minHeight: 64
92
- }
31
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
32
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
33
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
34
+ const namespace = 'CoreAppBar';
35
+ const styles = () => ({
36
+ topPadding: {
37
+ minHeight: 56,
38
+ '@media (min-width:600px)': {
39
+ minHeight: 64
93
40
  }
94
- };
95
- };
96
-
97
- var style = {
41
+ }
42
+ });
43
+ const style = {
98
44
  title: {
99
45
  flexGrow: 1,
100
46
  textAlign: 'left'
@@ -112,19 +58,10 @@ var style = {
112
58
  marginRight: 20
113
59
  }
114
60
  };
115
-
116
- var CoreAppBar = /*#__PURE__*/function (_Component) {
117
- _inherits(CoreAppBar, _Component);
118
-
119
- var _super = _createSuper(CoreAppBar);
120
-
121
- function CoreAppBar() {
122
- var _this;
123
-
124
- _classCallCheck(this, CoreAppBar);
125
-
126
- _this = _super.call(this);
127
- _this.state = {
61
+ class CoreAppBar extends _react.Component {
62
+ constructor() {
63
+ super();
64
+ this.state = {
128
65
  drawer: false,
129
66
  organizationAnchorEl: null,
130
67
  entityAnchorEl: null,
@@ -134,360 +71,283 @@ var CoreAppBar = /*#__PURE__*/function (_Component) {
134
71
  entities: [],
135
72
  favorites: []
136
73
  };
137
- return _this;
138
74
  }
139
-
140
- _createClass(CoreAppBar, [{
141
- key: "componentDidMount",
142
- value: function componentDidMount() {
75
+ componentDidMount() {
76
+ this.getOrganizations();
77
+ }
78
+ componentDidUpdate(prevProps) {
79
+ if (this.props.authentication.didChange(prevProps.authentication)) {
143
80
  this.getOrganizations();
144
81
  }
145
- }, {
146
- key: "componentDidUpdate",
147
- value: function componentDidUpdate(prevProps) {
148
- if (this.props.authentication.didChange(prevProps.authentication)) {
149
- this.getOrganizations();
150
- }
151
-
152
- if (this.props.organization.didOrganizationChange(prevProps.organization.organization)) {
153
- this.getEntities();
154
- }
155
-
156
- if (this.props.authentication.didChange(prevProps.authentication) || this.props.organization.didChange(prevProps.organization)) {
157
- this.getApps();
158
- this.getFavorites();
159
- }
82
+ if (this.props.organization.didOrganizationChange(prevProps.organization.organization)) {
83
+ this.getEntities();
160
84
  }
161
- }, {
162
- key: "getOrganizations",
163
- value: function getOrganizations() {
164
- var _this2 = this;
165
-
166
- var methodName = 'getOrganizations()';
85
+ if (this.props.authentication.didChange(prevProps.authentication) || this.props.organization.didChange(prevProps.organization)) {
86
+ this.getApps();
87
+ this.getFavorites();
88
+ }
89
+ }
90
+ getOrganizations() {
91
+ const methodName = 'getOrganizations()';
92
+ this.props.authentication.http({
93
+ method: 'get',
94
+ url: "".concat(this.props.core.baseUrl, "/api/administration/organizations")
95
+ }).then(res => {
96
+ if (res.data.length > 0 && typeof res.data[0] === 'object') {
97
+ this.setState({
98
+ organizations: res.data
99
+ });
100
+ if (this.props.organization.organization === null || res.data.find(x => x.id === this.props.organization.organization.id) === undefined) {
101
+ this.props.organization.setOrganization(res.data[0]);
102
+ }
103
+ }
104
+ }).catch(error => {
105
+ this.props.core.log('error', namespace, methodName, error);
106
+ });
107
+ }
108
+ getEntities() {
109
+ const methodName = 'getEntities()';
110
+ if (this.props.organization.organization !== null) {
167
111
  this.props.authentication.http({
168
112
  method: 'get',
169
- url: "".concat(this.props.core.baseUrl, "/api/administration/organizations")
170
- }).then(function (res) {
171
- if (res.data.length > 0 && _typeof(res.data[0]) === 'object') {
172
- _this2.setState({
173
- organizations: res.data
113
+ url: "".concat(this.props.core.baseUrl, "/api/administration/entities/organization/").concat(this.props.organization.organization.key)
114
+ }).then(res => {
115
+ if (res.data.length > 0 && typeof res.data[0] === 'object') {
116
+ this.setState({
117
+ entities: res.data
174
118
  });
175
-
176
- if (_this2.props.organization.organization === null || res.data.find(function (x) {
177
- return x.id === _this2.props.organization.organization.id;
178
- }) === undefined) {
179
- _this2.props.organization.setOrganization(res.data[0]);
119
+ if (this.props.organization.entity === null || res.data.find(x => x.id === this.props.organization.entity.id) === undefined) {
120
+ this.props.organization.setEntity(res.data[0]);
180
121
  }
181
122
  }
182
- }).catch(function (error) {
183
- _this2.props.core.log('error', namespace, methodName, error);
123
+ }).catch(error => {
124
+ this.props.core.log('error', namespace, methodName, error);
184
125
  });
185
126
  }
186
- }, {
187
- key: "getEntities",
188
- value: function getEntities() {
189
- var _this3 = this;
190
-
191
- var methodName = 'getEntities()';
192
-
193
- if (this.props.organization.organization !== null) {
194
- this.props.authentication.http({
195
- method: 'get',
196
- url: "".concat(this.props.core.baseUrl, "/api/administration/entities/organization/").concat(this.props.organization.organization.key)
197
- }).then(function (res) {
198
- if (res.data.length > 0 && _typeof(res.data[0]) === 'object') {
199
- _this3.setState({
200
- entities: res.data
201
- });
202
-
203
- if (_this3.props.organization.entity === null || res.data.find(function (x) {
204
- return x.id === _this3.props.organization.entity.id;
205
- }) === undefined) {
206
- _this3.props.organization.setEntity(res.data[0]);
207
- }
208
- }
209
- }).catch(function (error) {
210
- _this3.props.core.log('error', namespace, methodName, error);
211
- });
212
- }
127
+ }
128
+ getApps() {
129
+ const methodName = 'getApps()';
130
+ if (this.props.organization.organization !== null && this.props.organization.entity !== null) {
131
+ this.props.authentication.http({
132
+ method: 'get',
133
+ url: "".concat(this.props.core.baseUrl, "/api/components/tiered"),
134
+ params: {
135
+ type: 'UI',
136
+ organizationId: this.props.organization.organization.id,
137
+ entityId: this.props.organization.entity.id
138
+ }
139
+ }).then(res => {
140
+ if (res.data.length > 0 && typeof res.data[0] === 'object') {
141
+ this.setState({
142
+ apps: res.data
143
+ });
144
+ }
145
+ }).catch(error => {
146
+ this.props.core.log('error', namespace, methodName, error);
147
+ });
213
148
  }
214
- }, {
215
- key: "getApps",
216
- value: function getApps() {
217
- var _this4 = this;
218
-
219
- var methodName = 'getApps()';
220
-
221
- if (this.props.organization.organization !== null && this.props.organization.entity !== null) {
222
- this.props.authentication.http({
223
- method: 'get',
224
- url: "".concat(this.props.core.baseUrl, "/api/components/tiered"),
225
- params: {
226
- type: 'UI',
227
- organizationId: this.props.organization.organization.id,
228
- entityId: this.props.organization.entity.id
229
- }
230
- }).then(function (res) {
231
- if (res.data.length > 0 && _typeof(res.data[0]) === 'object') {
232
- _this4.setState({
233
- apps: res.data
234
- });
235
- }
236
- }).catch(function (error) {
237
- _this4.props.core.log('error', namespace, methodName, error);
149
+ }
150
+ getFavorites() {
151
+ const methodName = 'getFavorites()';
152
+ if (this.props.organization.organization !== null && this.props.organization.entity !== null) {
153
+ this.props.authentication.http({
154
+ method: 'get',
155
+ url: "".concat(this.props.core.baseUrl, "/api/user/activity/favorites"),
156
+ params: {
157
+ type: 'App'
158
+ }
159
+ }).then(res => {
160
+ this.setState({
161
+ favorites: res.data
238
162
  });
239
- }
163
+ }).catch(error => {
164
+ this.props.core.log('error', namespace, methodName, error);
165
+ });
240
166
  }
241
- }, {
242
- key: "getFavorites",
243
- value: function getFavorites() {
244
- var _this5 = this;
245
-
246
- var methodName = 'getFavorites()';
247
-
248
- if (this.props.organization.organization !== null && this.props.organization.entity !== null) {
249
- this.props.authentication.http({
250
- method: 'get',
251
- url: "".concat(this.props.core.baseUrl, "/api/user/activity/favorites"),
252
- params: {
253
- type: 'App'
254
- }
255
- }).then(function (res) {
256
- _this5.setState({
257
- favorites: res.data
258
- });
259
- }).catch(function (error) {
260
- _this5.props.core.log('error', namespace, methodName, error);
167
+ }
168
+ favoriteApp() {
169
+ const methodName = 'favoriteApp()';
170
+ if (this.props.organization.organization !== null && this.props.organization.entity !== null) {
171
+ this.props.authentication.http({
172
+ method: 'post',
173
+ url: "".concat(this.props.core.baseUrl, "/api/user/activity/favorite"),
174
+ params: {
175
+ type: 'App',
176
+ itemId: this.props.componentID,
177
+ favorite: !this.state.favorites.includes(this.props.componentID)
178
+ }
179
+ }).then(() => {
180
+ this.getFavorites();
181
+ }).catch(error => {
182
+ this.props.core.log('error', namespace, methodName, error);
183
+ });
184
+ }
185
+ }
186
+ handleMessage(channel, obj) {
187
+ switch (obj.what) {
188
+ case 'package_enabled':
189
+ case 'package_disabled':
190
+ case 'package_added':
191
+ case 'package_updated':
192
+ case 'package_deleted':
193
+ this.getApps();
194
+ break;
195
+ case 'entities_added':
196
+ case 'entities_updated':
197
+ case 'entities_deleted':
198
+ this.getEntities();
199
+ break;
200
+ default:
201
+ break;
202
+ }
203
+ }
204
+ render() {
205
+ const {
206
+ title,
207
+ componentID,
208
+ authentication,
209
+ organization,
210
+ classes
211
+ } = this.props;
212
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_context.ChannelsConsumer, {
213
+ id: "coreappbar",
214
+ handler: (channel, obj) => this.handleMessage(channel, obj)
215
+ }), /*#__PURE__*/_react.default.createElement(_AppBar.default, null, /*#__PURE__*/_react.default.createElement(_Toolbar.default, null, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
216
+ style: style.menuButton,
217
+ color: "inherit",
218
+ onClick: () => this.setState({
219
+ drawer: true
220
+ })
221
+ }, /*#__PURE__*/_react.default.createElement(_Menu.default, null)), /*#__PURE__*/_react.default.createElement(_Typography.default, {
222
+ style: style.title,
223
+ variant: "h6",
224
+ color: "inherit"
225
+ }, title), /*#__PURE__*/_react.default.createElement("div", {
226
+ style: style.flex
227
+ }, /*#__PURE__*/_react.default.createElement(_Button.default, {
228
+ color: "inherit",
229
+ style: style.titleButton,
230
+ variant: this.state.organizations.length > 1 ? 'outlined' : 'text',
231
+ onClick: e => this.setState({
232
+ organizationAnchorEl: e.currentTarget
233
+ })
234
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
235
+ variant: "h6",
236
+ color: "inherit"
237
+ }, organization.organization ? organization.organization.name : ''))), /*#__PURE__*/_react.default.createElement("div", {
238
+ style: style.flex
239
+ }, this.props.showEntity && /*#__PURE__*/_react.default.createElement(_Button.default, {
240
+ color: "inherit",
241
+ style: style.titleButton,
242
+ variant: this.state.entities.length > 1 ? 'outlined' : 'text',
243
+ onClick: e => this.setState({
244
+ entityAnchorEl: e.currentTarget
245
+ })
246
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
247
+ variant: "h6",
248
+ color: "inherit"
249
+ }, organization.entity ? organization.entity.name : ''))), componentID.length > 0 && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
250
+ color: "inherit",
251
+ onClick: () => this.favoriteApp()
252
+ }, this.state.favorites.includes(componentID) ? /*#__PURE__*/_react.default.createElement(_Star.default, null) : /*#__PURE__*/_react.default.createElement(_StarBorder.default, null)), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
253
+ color: "inherit",
254
+ onClick: e => this.setState({
255
+ authenticationAnchorEl: e.currentTarget
256
+ })
257
+ }, /*#__PURE__*/_react.default.createElement(_AccountCircle.default, null)))), /*#__PURE__*/_react.default.createElement("div", {
258
+ className: classes.topPadding
259
+ }), /*#__PURE__*/_react.default.createElement(_CoreAppBarDrawer.default, {
260
+ open: this.state.drawer,
261
+ onClose: () => this.setState({
262
+ drawer: false
263
+ }),
264
+ apps: this.state.apps
265
+ }), /*#__PURE__*/_react.default.createElement(_Menu2.default, {
266
+ open: !!this.state.organizationAnchorEl,
267
+ anchorEl: this.state.organizationAnchorEl,
268
+ anchorOrigin: {
269
+ vertical: 'top',
270
+ horizontal: 'center'
271
+ },
272
+ transformOrigin: {
273
+ vertical: 'top',
274
+ horizontal: 'center'
275
+ },
276
+ onClose: () => this.setState({
277
+ organizationAnchorEl: null
278
+ })
279
+ }, this.state.organizations.map(org => /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
280
+ key: org.id,
281
+ onClick: () => {
282
+ organization.setOrganization(org);
283
+ this.setState({
284
+ organizationAnchorEl: null
261
285
  });
262
286
  }
263
- }
264
- }, {
265
- key: "favoriteApp",
266
- value: function favoriteApp() {
267
- var _this6 = this;
268
-
269
- var methodName = 'favoriteApp()';
270
-
271
- if (this.props.organization.organization !== null && this.props.organization.entity !== null) {
272
- this.props.authentication.http({
273
- method: 'post',
274
- url: "".concat(this.props.core.baseUrl, "/api/user/activity/favorite"),
275
- params: {
276
- type: 'App',
277
- itemId: this.props.componentID,
278
- favorite: !this.state.favorites.includes(this.props.componentID)
279
- }
280
- }).then(function () {
281
- _this6.getFavorites();
282
- }).catch(function (error) {
283
- _this6.props.core.log('error', namespace, methodName, error);
287
+ }, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_LocationCity.default, null)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
288
+ primary: org.name,
289
+ inset: true
290
+ })))), /*#__PURE__*/_react.default.createElement(_Menu2.default, {
291
+ anchorEl: this.state.entityAnchorEl,
292
+ anchorOrigin: {
293
+ vertical: 'top',
294
+ horizontal: 'center'
295
+ },
296
+ transformOrigin: {
297
+ vertical: 'top',
298
+ horizontal: 'center'
299
+ },
300
+ open: !!this.state.entityAnchorEl,
301
+ onClose: () => this.setState({
302
+ entityAnchorEl: null
303
+ })
304
+ }, this.state.entities.map(entity => /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
305
+ key: entity.key,
306
+ onClick: () => {
307
+ organization.setEntity(entity);
308
+ this.setState({
309
+ entityAnchorEl: null
284
310
  });
285
311
  }
286
- }
287
- }, {
288
- key: "handleMessage",
289
- value: function handleMessage(channel, obj) {
290
- switch (obj.what) {
291
- case 'package_enabled':
292
- case 'package_disabled':
293
- case 'package_added':
294
- case 'package_updated':
295
- case 'package_deleted':
296
- this.getApps();
297
- break;
298
-
299
- case 'entities_added':
300
- case 'entities_updated':
301
- case 'entities_deleted':
302
- this.getEntities();
303
- break;
304
-
305
- default:
306
- break;
312
+ }, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_LocationCity.default, null)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
313
+ primary: entity.name,
314
+ inset: true
315
+ }))), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement("a", {
316
+ href: this.props.core.formatUrl('/administration#/entities'),
317
+ style: {
318
+ all: 'unset'
307
319
  }
308
- }
309
- }, {
310
- key: "render",
311
- value: function render() {
312
- var _this7 = this;
313
-
314
- var _this$props = this.props,
315
- title = _this$props.title,
316
- componentID = _this$props.componentID,
317
- authentication = _this$props.authentication,
318
- organization = _this$props.organization,
319
- classes = _this$props.classes;
320
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_context.ChannelsConsumer, {
321
- id: "coreappbar",
322
- handler: function handler(channel, obj) {
323
- return _this7.handleMessage(channel, obj);
324
- }
325
- }), /*#__PURE__*/_react.default.createElement(_AppBar.default, null, /*#__PURE__*/_react.default.createElement(_Toolbar.default, null, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
326
- style: style.menuButton,
327
- color: "inherit",
328
- onClick: function onClick() {
329
- return _this7.setState({
330
- drawer: true
331
- });
332
- }
333
- }, /*#__PURE__*/_react.default.createElement(_Menu.default, null)), /*#__PURE__*/_react.default.createElement(_Typography.default, {
334
- style: style.title,
335
- variant: "h6",
336
- color: "inherit"
337
- }, title), /*#__PURE__*/_react.default.createElement("div", {
338
- style: style.flex
339
- }, /*#__PURE__*/_react.default.createElement(_Button.default, {
340
- color: "inherit",
341
- style: style.titleButton,
342
- variant: this.state.organizations.length > 1 ? 'outlined' : 'text',
343
- onClick: function onClick(e) {
344
- return _this7.setState({
345
- organizationAnchorEl: e.currentTarget
346
- });
347
- }
348
- }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
349
- variant: "h6",
350
- color: "inherit"
351
- }, organization.organization ? organization.organization.name : ''))), /*#__PURE__*/_react.default.createElement("div", {
352
- style: style.flex
353
- }, this.props.showEntity && /*#__PURE__*/_react.default.createElement(_Button.default, {
354
- color: "inherit",
355
- style: style.titleButton,
356
- variant: this.state.entities.length > 1 ? 'outlined' : 'text',
357
- onClick: function onClick(e) {
358
- return _this7.setState({
359
- entityAnchorEl: e.currentTarget
360
- });
361
- }
362
- }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
363
- variant: "h6",
364
- color: "inherit"
365
- }, organization.entity ? organization.entity.name : ''))), componentID.length > 0 && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
366
- color: "inherit",
367
- onClick: function onClick() {
368
- return _this7.favoriteApp();
369
- }
370
- }, this.state.favorites.includes(componentID) ? /*#__PURE__*/_react.default.createElement(_Star.default, null) : /*#__PURE__*/_react.default.createElement(_StarBorder.default, null)), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
371
- color: "inherit",
372
- onClick: function onClick(e) {
373
- return _this7.setState({
374
- authenticationAnchorEl: e.currentTarget
375
- });
376
- }
377
- }, /*#__PURE__*/_react.default.createElement(_AccountCircle.default, null)))), /*#__PURE__*/_react.default.createElement("div", {
378
- className: classes.topPadding
379
- }), /*#__PURE__*/_react.default.createElement(_CoreAppBarDrawer.default, {
380
- open: this.state.drawer,
381
- onClose: function onClose() {
382
- return _this7.setState({
383
- drawer: false
384
- });
385
- },
386
- apps: this.state.apps
387
- }), /*#__PURE__*/_react.default.createElement(_Menu2.default, {
388
- open: !!this.state.organizationAnchorEl,
389
- anchorEl: this.state.organizationAnchorEl,
390
- anchorOrigin: {
391
- vertical: 'top',
392
- horizontal: 'center'
393
- },
394
- transformOrigin: {
395
- vertical: 'top',
396
- horizontal: 'center'
397
- },
398
- onClose: function onClose() {
399
- return _this7.setState({
400
- organizationAnchorEl: null
401
- });
402
- }
403
- }, this.state.organizations.map(function (org) {
404
- return /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
405
- key: org.id,
406
- onClick: function onClick() {
407
- organization.setOrganization(org);
408
-
409
- _this7.setState({
410
- organizationAnchorEl: null
411
- });
412
- }
413
- }, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_LocationCity.default, null)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
414
- primary: org.name,
415
- inset: true
416
- }));
417
- })), /*#__PURE__*/_react.default.createElement(_Menu2.default, {
418
- anchorEl: this.state.entityAnchorEl,
419
- anchorOrigin: {
420
- vertical: 'top',
421
- horizontal: 'center'
422
- },
423
- transformOrigin: {
424
- vertical: 'top',
425
- horizontal: 'center'
426
- },
427
- open: !!this.state.entityAnchorEl,
428
- onClose: function onClose() {
429
- return _this7.setState({
430
- entityAnchorEl: null
431
- });
432
- }
433
- }, this.state.entities.map(function (entity) {
434
- return /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
435
- key: entity.key,
436
- onClick: function onClick() {
437
- organization.setEntity(entity);
438
-
439
- _this7.setState({
440
- entityAnchorEl: null
441
- });
442
- }
443
- }, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_LocationCity.default, null)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
444
- primary: entity.name,
445
- inset: true
446
- }));
447
- }), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement("a", {
448
- href: this.props.core.formatUrl('/administration#/entities'),
449
- style: {
450
- all: 'unset'
451
- }
452
- }, /*#__PURE__*/_react.default.createElement(_MenuItem.default, null, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_Settings.default, null)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
453
- id: "__manage"
454
- }), ' ', /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
455
- id: "__entities"
456
- }))))), /*#__PURE__*/_react.default.createElement(_Menu2.default, {
457
- open: !!this.state.authenticationAnchorEl,
458
- anchorEl: this.state.authenticationAnchorEl,
459
- onClose: function onClose() {
460
- return _this7.setState({
461
- authenticationAnchorEl: null
462
- });
463
- }
464
- }, /*#__PURE__*/_react.default.createElement(_ListItem.default, {
465
- style: {
466
- outline: 0
467
- }
468
- }, /*#__PURE__*/_react.default.createElement(_Avatar.default, null, "".concat(this.props.authentication.token.userInfo.firstName[0].toUpperCase()).concat(this.props.authentication.token.userInfo.lastName[0].toUpperCase())), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
469
- primary: "".concat(this.props.authentication.token.userInfo.firstName, " ").concat(this.props.authentication.token.userInfo.lastName),
470
- secondary: this.props.authentication.token.userInfo.emailAddress
471
- })), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement("a", {
472
- href: this.props.core.formatUrl('/profile'),
473
- style: {
474
- all: 'unset'
475
- }
476
- }, /*#__PURE__*/_react.default.createElement(_MenuItem.default, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
477
- id: "__myProfile"
478
- }))), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
479
- onClick: function onClick() {
480
- return authentication.logout();
481
- }
482
- }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
483
- id: "__log_out"
484
- }))));
485
- }
486
- }]);
487
-
488
- return CoreAppBar;
489
- }(_react.Component);
490
-
320
+ }, /*#__PURE__*/_react.default.createElement(_MenuItem.default, null, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_Settings.default, null)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
321
+ id: "__manage"
322
+ }), ' ', /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
323
+ id: "__entities"
324
+ }))))), /*#__PURE__*/_react.default.createElement(_Menu2.default, {
325
+ open: !!this.state.authenticationAnchorEl,
326
+ anchorEl: this.state.authenticationAnchorEl,
327
+ onClose: () => this.setState({
328
+ authenticationAnchorEl: null
329
+ })
330
+ }, /*#__PURE__*/_react.default.createElement(_ListItem.default, {
331
+ style: {
332
+ outline: 0
333
+ }
334
+ }, /*#__PURE__*/_react.default.createElement(_Avatar.default, null, "".concat(this.props.authentication.token.userInfo.firstName[0].toUpperCase()).concat(this.props.authentication.token.userInfo.lastName[0].toUpperCase())), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
335
+ primary: "".concat(this.props.authentication.token.userInfo.firstName, " ").concat(this.props.authentication.token.userInfo.lastName),
336
+ secondary: this.props.authentication.token.userInfo.emailAddress
337
+ })), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement("a", {
338
+ href: this.props.core.formatUrl('/profile'),
339
+ style: {
340
+ all: 'unset'
341
+ }
342
+ }, /*#__PURE__*/_react.default.createElement(_MenuItem.default, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
343
+ id: "__myProfile"
344
+ }))), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
345
+ onClick: () => authentication.logout()
346
+ }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
347
+ id: "__log_out"
348
+ }))));
349
+ }
350
+ }
491
351
  CoreAppBar.propTypes = {
492
352
  title: _propTypes.default.string,
493
353
  showEntity: _propTypes.default.bool,
@@ -502,7 +362,4 @@ CoreAppBar.defaultProps = {
502
362
  title: '',
503
363
  componentID: ''
504
364
  };
505
-
506
- var _default = (0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)((0, _styles.withStyles)(styles)(CoreAppBar))));
507
-
508
- exports.default = _default;
365
+ var _default = exports.default = (0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)((0, _styles.withStyles)(styles)(CoreAppBar))));