versacall-core-library-react 2.0.69 → 2.0.70

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 (142) hide show
  1. package/package.json +2 -2
  2. package/dist/components/CoreAlert/CoreAlert.js +0 -86
  3. package/dist/components/CoreAlert/index.js +0 -13
  4. package/dist/components/CoreAlert/readme.md +0 -21
  5. package/dist/components/CoreAppBar/CoreAppBar.js +0 -365
  6. package/dist/components/CoreAppBar/CoreAppBarDrawer.js +0 -135
  7. package/dist/components/CoreAppBar/README.md +0 -27
  8. package/dist/components/CoreAppBar/index.js +0 -13
  9. package/dist/components/CoreAppBar/screenshot.png +0 -0
  10. package/dist/components/CoreAppSelector/AppLink.js +0 -101
  11. package/dist/components/CoreAppSelector/CoreAppSelector.js +0 -156
  12. package/dist/components/CoreAppSelector/index.js +0 -13
  13. package/dist/components/CoreDialogueToolBar/CoreDialogueToolBar.js +0 -123
  14. package/dist/components/CoreDialogueToolBar/index.js +0 -13
  15. package/dist/components/CoreDrawer/CoreDrawer.js +0 -237
  16. package/dist/components/CoreDrawer/README.md +0 -36
  17. package/dist/components/CoreDrawer/index.js +0 -13
  18. package/dist/components/CoreDrawer/screenshot_collapsed.png +0 -0
  19. package/dist/components/CoreDrawer/screenshot_expanded.png +0 -0
  20. package/dist/components/CoreDropDownTextfield/CoreDropDownTextfield.js +0 -86
  21. package/dist/components/CoreDropDownTextfield/index.js +0 -13
  22. package/dist/components/CoreElapsedTime/CoreElapsedTime.js +0 -58
  23. package/dist/components/CoreElapsedTime/index.js +0 -13
  24. package/dist/components/CoreFrame/CoreFrame.js +0 -64
  25. package/dist/components/CoreFrame/index.js +0 -13
  26. package/dist/components/CoreImportDialog/CoreImportDialog.js +0 -351
  27. package/dist/components/CoreImportDialog/index.js +0 -13
  28. package/dist/components/CoreImportResultsDialog/CoreImportResultsDialog.js +0 -103
  29. package/dist/components/CoreImportResultsDialog/index.js +0 -13
  30. package/dist/components/CoreImporting/CoreImporting.js +0 -60
  31. package/dist/components/CoreImporting/index.js +0 -13
  32. package/dist/components/CorePlugin/CorePlugin.js +0 -135
  33. package/dist/components/CorePlugin/OldCorePlugin.js +0 -125
  34. package/dist/components/CorePlugin/index.js +0 -13
  35. package/dist/components/CoreSaveChangesDialog/CoreSaveChangesDialog.js +0 -62
  36. package/dist/components/CoreSaveChangesDialog/index.js +0 -13
  37. package/dist/components/CoreShiftTagFilter/CoreShiftTagFilter.js +0 -351
  38. package/dist/components/CoreShiftTagFilter/OldCoreShiftTagFilter.js +0 -209
  39. package/dist/components/CoreShiftTagFilter/index.js +0 -13
  40. package/dist/components/CoreSideBar/CoreSideBar.js +0 -738
  41. package/dist/components/CoreSideBar/CoreSideBarDrawer.js +0 -173
  42. package/dist/components/CoreSideBar/index.js +0 -13
  43. package/dist/components/CoreSnackBar/CoreSnackBar.js +0 -117
  44. package/dist/components/CoreSnackBar/index.js +0 -13
  45. package/dist/components/CoreSnackBar/readme.md +0 -23
  46. package/dist/components/CoreTable/CoreTable.js +0 -316
  47. package/dist/components/CoreTable/CoreTableChips.js +0 -50
  48. package/dist/components/CoreTable/CoreTableHead.js +0 -176
  49. package/dist/components/CoreTable/CoreTableToolbar.js +0 -108
  50. package/dist/components/CoreTable/index.js +0 -13
  51. package/dist/components/CoreTable/readMe.md +0 -79
  52. package/dist/components/CoreTagFilter/CoreTagFilter.js +0 -276
  53. package/dist/components/CoreTagFilter/OldCoreTagFilter.js +0 -342
  54. package/dist/components/CoreTagFilter/OldTagChip.js +0 -44
  55. package/dist/components/CoreTagFilter/OldTagFilterSelector.js +0 -106
  56. package/dist/components/CoreTagFilter/OldTagOption.js +0 -53
  57. package/dist/components/CoreTagFilter/TagFilterBuilder.js +0 -488
  58. package/dist/components/CoreTagFilter/index.js +0 -13
  59. package/dist/components/CoreTextField/CoreTextField.js +0 -110
  60. package/dist/components/CoreTextField/index.js +0 -13
  61. package/dist/components/CoreTheme/CoreTheme.css +0 -9
  62. package/dist/components/CoreTheme/CoreTheme.js +0 -51
  63. package/dist/components/CoreTheme/README.md +0 -3
  64. package/dist/components/CoreTheme/index.js +0 -13
  65. package/dist/components/CoreTile/CoreTile.js +0 -62
  66. package/dist/components/CoreTile/CoreTileToolbar.js +0 -62
  67. package/dist/components/CoreTile/index.js +0 -13
  68. package/dist/components/CoreTimerInput/CoreTimerInput.js +0 -203
  69. package/dist/components/CoreTimerInput/CoreTimerInputOld.js +0 -146
  70. package/dist/components/CoreTimerInput/index.js +0 -13
  71. package/dist/components/CoreToolbar/CoreToolbar.js +0 -206
  72. package/dist/components/CoreToolbar/index.js +0 -13
  73. package/dist/components/CoreTracker/CoreTracker.js +0 -53
  74. package/dist/components/CoreTracker/index.js +0 -13
  75. package/dist/components/CoreTranslate/CoreTranslate.js +0 -62
  76. package/dist/components/CoreTranslate/README.md +0 -5
  77. package/dist/components/CoreTranslate/index.js +0 -13
  78. package/dist/components/CoreTranslate/translations/en.json +0 -451
  79. package/dist/components/CoreTranslate/translations/es.json +0 -433
  80. package/dist/components/CoreTranslateWrapper/CoreTranslateWrapper.js +0 -36
  81. package/dist/components/CoreTranslateWrapper/index.js +0 -13
  82. package/dist/components/CoreWidget/CoreWidget.js +0 -121
  83. package/dist/components/CoreWidget/index.js +0 -13
  84. package/dist/components/CoreWrapper/CoreWrapper.js +0 -51
  85. package/dist/components/CoreWrapper/README.md +0 -41
  86. package/dist/components/CoreWrapper/index.js +0 -13
  87. package/dist/components/index.js +0 -202
  88. package/dist/constants/index.js +0 -20
  89. package/dist/constants/testOrganization.js +0 -31
  90. package/dist/constants/testToken.js +0 -33
  91. package/dist/context/Authentication/AuthenticationContext.js +0 -10
  92. package/dist/context/Authentication/AuthenticationProvider.js +0 -226
  93. package/dist/context/Authentication/README.md +0 -47
  94. package/dist/context/Authentication/index.js +0 -27
  95. package/dist/context/Authentication/withAuthentication.js +0 -15
  96. package/dist/context/Channels/ChannelsConsumer.js +0 -43
  97. package/dist/context/Channels/ChannelsContext.js +0 -10
  98. package/dist/context/Channels/ChannelsProvider.js +0 -261
  99. package/dist/context/Channels/DataChannel.js +0 -68
  100. package/dist/context/Channels/EntityChannel.js +0 -69
  101. package/dist/context/Channels/EveryoneChannel.js +0 -55
  102. package/dist/context/Channels/OrganizationChannel.js +0 -69
  103. package/dist/context/Channels/README.md +0 -52
  104. package/dist/context/Channels/UserChannel.js +0 -60
  105. package/dist/context/Channels/index.js +0 -69
  106. package/dist/context/Channels/withChannels.js +0 -15
  107. package/dist/context/Core/CoreContext.js +0 -10
  108. package/dist/context/Core/CoreProvider.js +0 -108
  109. package/dist/context/Core/README.md +0 -43
  110. package/dist/context/Core/index.js +0 -27
  111. package/dist/context/Core/withCore.js +0 -15
  112. package/dist/context/Organization/OrganizationContext.js +0 -10
  113. package/dist/context/Organization/OrganizationProvider.js +0 -80
  114. package/dist/context/Organization/README.md +0 -82
  115. package/dist/context/Organization/index.js +0 -27
  116. package/dist/context/Organization/withOrganization.js +0 -15
  117. package/dist/context/Plugin/PluginContext.js +0 -10
  118. package/dist/context/Plugin/PluginProvider.js +0 -79
  119. package/dist/context/Plugin/index.js +0 -27
  120. package/dist/context/Plugin/withPlugin.js +0 -15
  121. package/dist/context/index.js +0 -60
  122. package/dist/css/index.js +0 -20
  123. package/dist/css/junk.module.css +0 -3
  124. package/dist/css/scrollbar.css +0 -35
  125. package/dist/css/scrollbar.module.css +0 -37
  126. package/dist/functions/TagEvaluator.js +0 -165
  127. package/dist/functions/compareObjects.js +0 -27
  128. package/dist/functions/formatElapsedTime.js +0 -18
  129. package/dist/functions/formatNameFileSafe.js +0 -16
  130. package/dist/functions/getIconUrl.js +0 -15
  131. package/dist/functions/getParameterByName.js +0 -34
  132. package/dist/functions/getProperty.js +0 -17
  133. package/dist/functions/getUrl.js +0 -15
  134. package/dist/functions/index.js +0 -62
  135. package/dist/icons/CopyIcon.js +0 -42
  136. package/dist/icons/DeleteIcon.js +0 -42
  137. package/dist/icons/DuplicateIcon.js +0 -42
  138. package/dist/icons/EditIcon.js +0 -42
  139. package/dist/icons/FabAddIcon.js +0 -78
  140. package/dist/icons/PasteIcon.js +0 -42
  141. package/dist/icons/index.js +0 -48
  142. package/dist/index.js +0 -71
@@ -1,738 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _styles = require("@material-ui/core/styles");
10
- var _Avatar = _interopRequireDefault(require("@material-ui/core/Avatar"));
11
- var _Badge = _interopRequireDefault(require("@material-ui/core/Badge"));
12
- var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
13
- var _Divider = _interopRequireDefault(require("@material-ui/core/Divider"));
14
- var _Drawer = _interopRequireDefault(require("@material-ui/core/Drawer"));
15
- var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
16
- var _ListItem = _interopRequireDefault(require("@material-ui/core/ListItem"));
17
- var _ListItemIcon = _interopRequireDefault(require("@material-ui/core/ListItemIcon"));
18
- var _ListItemText = _interopRequireDefault(require("@material-ui/core/ListItemText"));
19
- var _Menu = _interopRequireDefault(require("@material-ui/core/Menu"));
20
- var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
21
- var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
22
- var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
23
- var _AccountCircle = _interopRequireDefault(require("@material-ui/icons/AccountCircle"));
24
- var _Delete = _interopRequireDefault(require("@material-ui/icons/Delete"));
25
- var _LocationCity = _interopRequireDefault(require("@material-ui/icons/LocationCity"));
26
- var _Menu2 = _interopRequireDefault(require("@material-ui/icons/Menu"));
27
- var _ExitToApp = _interopRequireDefault(require("@material-ui/icons/ExitToApp"));
28
- var _Notifications = _interopRequireDefault(require("@material-ui/icons/Notifications"));
29
- var _Error = _interopRequireDefault(require("@material-ui/icons/Error"));
30
- var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
31
- var _Warning = _interopRequireDefault(require("@material-ui/icons/Warning"));
32
- var _StarBorder = _interopRequireDefault(require("@material-ui/icons/StarBorder"));
33
- var _Star = _interopRequireDefault(require("@material-ui/icons/Star"));
34
- var _reactIntl = require("react-intl");
35
- var _context = require("../../context");
36
- var _CoreSideBarDrawer = _interopRequireDefault(require("./CoreSideBarDrawer"));
37
- var _scrollbarModule = _interopRequireDefault(require("../../css/scrollbar.module.css"));
38
- require("../../css/scrollbar.css");
39
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
40
- 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); }
41
- 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; }
42
- // import ListItemAvatar from '@material-ui/core/ListItemAvatar';
43
-
44
- // import Toolbar from '@material-ui/core/Toolbar';
45
-
46
- // import SettingsIcon from '@material-ui/icons/Settings';
47
-
48
- // import SubscriptionActiveIcon from '@material-ui/icons/CheckCircleOutline';
49
- // import SubscriptionInactiveIcon from '@material-ui/icons/ErrorOutline';
50
-
51
- const namespace = 'CoreSideBar';
52
- const styles = theme => ({
53
- root: {
54
- display: 'flex',
55
- height: '100vh',
56
- overflow: 'hidden'
57
- },
58
- content: {
59
- position: 'relative',
60
- width: '100%'
61
- },
62
- topPadding: {
63
- minHeight: 56,
64
- '@media (min-width:600px)': {
65
- minHeight: 64
66
- }
67
- },
68
- drawerPaper: {
69
- position: 'relative',
70
- whiteSpace: 'nowrap',
71
- backgroundColor: '#496b78',
72
- color: '#ffffff',
73
- display: 'flex',
74
- flexDirection: 'column'
75
- },
76
- listItemRoot: {
77
- color: '#ffffff'
78
- },
79
- menuPaper: {
80
- backgroundColor: '#3f5c67'
81
- },
82
- menuItemRoot: {
83
- color: '#ffffff'
84
- },
85
- icon: {
86
- verticalAlign: 'middle',
87
- height: 24,
88
- width: 24
89
- },
90
- svgIcon: {
91
- verticalAlign: 'middle',
92
- height: 24,
93
- width: 24,
94
- filter: 'invert(1)'
95
- },
96
- inline: {
97
- display: 'inline',
98
- color: '#cccccc'
99
- },
100
- notificationRoot: {
101
- width: 200
102
- },
103
- badgeError: {
104
- backgroundColor: theme.palette.error.light,
105
- color: theme.palette.error.contrastText
106
- },
107
- badgeWarning: {
108
- backgroundColor: theme.palette.warning.light,
109
- color: theme.palette.warning.contrastText
110
- },
111
- badgeInfo: {
112
- backgroundColor: theme.palette.info.light,
113
- color: theme.palette.info.contrastText
114
- },
115
- menuIconButton: {
116
- // background: '#3f5c67',
117
- // borderRadius: 10,
118
- // marginRight: 10,
119
- }
120
- });
121
- const style = {
122
- title: {
123
- // flexGrow: 1,
124
- textAlign: 'center',
125
- marginTop: 10,
126
- marginBottom: 10
127
- },
128
- orgEntity: {
129
- flexGrow: 1,
130
- textAlign: 'center'
131
- },
132
- flex: {
133
- // flexGrow: 1,
134
- textAlign: 'center'
135
- },
136
- titleButton: {
137
- textTransform: 'none',
138
- borderColor: 'white'
139
- },
140
- menuButton: {
141
- marginLeft: -12,
142
- marginRight: 12,
143
- backgroundColor: '#496b78'
144
- },
145
- navLink: {
146
- textDecoration: 'none',
147
- color: '#ffffff'
148
- },
149
- // NOTE: activeStyle doesn't really seem to stay applied. Believe this might be because HashRouter/Router is on a different component
150
- activeStyle: {
151
- backgroundColor: '#3f5c67',
152
- color: '#55b7dc',
153
- pointerEvents: 'none'
154
- }
155
- };
156
-
157
- /* const getNotificationsBadgeColor = notifications => {
158
- return 'warning';
159
- let hasError = false;
160
- let hasWarning = false;
161
- notifications.forEach(notification => {
162
- if (notification.type === 'error') {
163
- hasError = true;
164
- } if (notification.type === 'warning') {
165
- hasWarning = true;
166
- }
167
- });
168
- if (hasError) {
169
- return 'error';
170
- } if (hasWarning) {
171
- return 'warning';
172
- }
173
- return 'primary';
174
- }; */
175
-
176
- class CoreSideBar extends _react.Component {
177
- constructor() {
178
- super();
179
- this.state = {
180
- drawer: false,
181
- organizationAnchorEl: null,
182
- entityAnchorEl: null,
183
- authenticationAnchorEl: null,
184
- notificationsAnchorEl: null,
185
- apps: [],
186
- organizations: [],
187
- entities: [],
188
- favorites: [],
189
- // subscription: null,
190
- notifications: []
191
- };
192
- }
193
- componentDidMount() {
194
- this.getOrganizations();
195
- // this.getSubscription();
196
- this.getNotifications();
197
- }
198
- componentDidUpdate(prevProps) {
199
- if (this.props.authentication.didChange(prevProps.authentication)) {
200
- this.getOrganizations();
201
- }
202
- if (this.props.organization.didOrganizationChange(prevProps.organization.organization)) {
203
- this.getEntities();
204
- }
205
- if (this.props.authentication.didChange(prevProps.authentication) || this.props.organization.didChange(prevProps.organization)) {
206
- this.getApps();
207
- this.getFavorites();
208
- // this.getSubscription();
209
- this.getNotifications();
210
- }
211
- }
212
- getOrganizations() {
213
- const methodName = 'getOrganizations()';
214
- this.props.authentication.http({
215
- method: 'get',
216
- url: "".concat(this.props.core.baseUrl, "/api/administration/organizations")
217
- }).then(res => {
218
- if (res.data.length > 0 && typeof res.data[0] === 'object') {
219
- this.setState({
220
- organizations: res.data
221
- });
222
- if (this.props.organization.organization === null || res.data.find(x => x.id === this.props.organization.organization.id) === undefined) {
223
- this.props.organization.setOrganization(res.data[0]);
224
- }
225
- }
226
- }).catch(error => {
227
- this.props.core.log('error', namespace, methodName, error);
228
- });
229
- }
230
- getEntities() {
231
- const methodName = 'getEntities()';
232
- if (this.props.organization.organization !== null) {
233
- this.props.authentication.http({
234
- method: 'get',
235
- url: "".concat(this.props.core.baseUrl, "/api/administration/entities/organization/").concat(this.props.organization.organization.key)
236
- }).then(res => {
237
- if (res.data.length > 0 && typeof res.data[0] === 'object') {
238
- this.setState({
239
- entities: res.data
240
- });
241
- if (this.props.organization.entity === null || res.data.find(x => x.id === this.props.organization.entity.id) === undefined) {
242
- this.props.organization.setEntity(res.data[0]);
243
- }
244
- }
245
- }).catch(error => {
246
- this.props.core.log('error', namespace, methodName, error);
247
- });
248
- }
249
- }
250
- getApps() {
251
- const methodName = 'getApps()';
252
- if (this.props.organization.organization !== null && this.props.organization.entity !== null) {
253
- this.props.authentication.http({
254
- method: 'get',
255
- url: "".concat(this.props.core.baseUrl, "/api/components/tiered"),
256
- params: {
257
- type: 'UI',
258
- organizationId: this.props.organization.organization.id,
259
- entityId: this.props.organization.entity.id
260
- }
261
- }).then(res => {
262
- if (res.data.length > 0 && typeof res.data[0] === 'object') {
263
- this.setState({
264
- apps: res.data
265
- });
266
- }
267
- }).catch(error => {
268
- this.props.core.log('error', namespace, methodName, error);
269
- });
270
- }
271
- }
272
- getFavorites() {
273
- const methodName = 'getFavorites()';
274
- if (this.props.organization.organization !== null && this.props.organization.entity !== null) {
275
- this.props.authentication.http({
276
- method: 'get',
277
- url: "".concat(this.props.core.baseUrl, "/api/user/activity/favorites"),
278
- params: {
279
- type: 'App'
280
- }
281
- }).then(res => {
282
- this.setState({
283
- favorites: res.data
284
- });
285
- }).catch(error => {
286
- this.props.core.log('error', namespace, methodName, error);
287
- });
288
- }
289
- }
290
- getNotifications() {
291
- const methodName = 'getNotifications()';
292
- const {
293
- authentication,
294
- core,
295
- organization
296
- } = this.props;
297
- if (organization.organization !== null && organization.entity !== null) {
298
- authentication.http({
299
- method: 'get',
300
- url: "".concat(core.baseUrl, "/api/user/activity/notifications"),
301
- params: {
302
- organizationId: organization.organization.id,
303
- entityId: organization.entity.id
304
- }
305
- }).then(res => {
306
- this.setState({
307
- notifications: res.data
308
- });
309
- }).catch(error => {
310
- core.log('error', namespace, methodName, error);
311
- });
312
- }
313
- }
314
-
315
- /* getSubscription() {
316
- const methodName = 'getSubscription()';
317
- const { authentication, core, organization } = this.props;
318
- if (organization.organization !== null && organization.entity !== null) {
319
- authentication.http({
320
- method: 'get',
321
- url: `${core.baseUrl}/api/subscriptions/primary`,
322
- params: {
323
- organizationId: organization.organization.id,
324
- entityId: organization.entity.id,
325
- },
326
- }).then(res => {
327
- this.setState({ subscription: res.data });
328
- }).catch(error => {
329
- core.log('error', namespace, methodName, error);
330
- });
331
- }
332
- } */
333
-
334
- getUsersInitials() {
335
- const {
336
- authentication
337
- } = this.props;
338
- let initials = '';
339
- if (authentication.token && authentication.token.userInfo) {
340
- if (authentication.token.userInfo.firstName.length > 0) {
341
- initials += authentication.token.userInfo.firstName[0].toUpperCase();
342
- }
343
- if (authentication.token.userInfo.lastName.length > 0) {
344
- initials += authentication.token.userInfo.lastName[0].toUpperCase();
345
- }
346
- }
347
- return initials;
348
- }
349
- getNotificationBadgeClass() {
350
- const {
351
- notifications
352
- } = this.state;
353
- const {
354
- classes
355
- } = this.props;
356
- let hasError = false;
357
- let hasWarning = false;
358
- notifications.forEach(notification => {
359
- if (notification.type === 'error') {
360
- hasError = true;
361
- }
362
- if (notification.type === 'warning') {
363
- hasWarning = true;
364
- }
365
- });
366
- if (hasError) {
367
- return classes.badgeError;
368
- }
369
- if (hasWarning) {
370
- return classes.badgeWarning;
371
- }
372
- return classes.badgeInfo;
373
- }
374
- getNotificationIcon(type) {
375
- const {
376
- theme
377
- } = this.props;
378
- switch (type.toLowerCase()) {
379
- case 'error':
380
- // '#ff6666'
381
- return /*#__PURE__*/_react.default.createElement(_Error.default, {
382
- style: {
383
- color: theme.palette.error.light
384
- }
385
- });
386
- case 'warning':
387
- // 'yellow'
388
- return /*#__PURE__*/_react.default.createElement(_Warning.default, {
389
- style: {
390
- color: theme.palette.warning.light
391
- }
392
- });
393
- default:
394
- // 'lightblue'
395
- return /*#__PURE__*/_react.default.createElement(_Info.default, {
396
- style: {
397
- color: theme.palette.info.light
398
- }
399
- });
400
- }
401
- }
402
- favoriteApp() {
403
- const methodName = 'favoriteApp()';
404
- if (this.props.organization.organization !== null && this.props.organization.entity !== null) {
405
- this.props.authentication.http({
406
- method: 'post',
407
- url: "".concat(this.props.core.baseUrl, "/api/user/activity/favorite"),
408
- params: {
409
- type: 'App',
410
- itemId: this.props.componentID,
411
- favorite: !this.state.favorites.includes(this.props.componentID)
412
- }
413
- }).then(() => {
414
- this.getFavorites();
415
- }).catch(error => {
416
- this.props.core.log('error', namespace, methodName, error);
417
- });
418
- }
419
- }
420
- dismissNotification(id) {
421
- const methodName = "dismissNotification(".concat(id, ")");
422
- const {
423
- authentication,
424
- core
425
- } = this.props;
426
- authentication.http({
427
- method: 'delete',
428
- url: "".concat(core.baseUrl, "/api/user/activity/notifications/").concat(id)
429
- }).catch(error => {
430
- core.log('error', namespace, methodName, error);
431
- });
432
- }
433
- handleMessage(channel, obj) {
434
- switch (obj.what) {
435
- case 'notifications_changed':
436
- this.getNotifications();
437
- break;
438
- case 'package_enabled':
439
- case 'package_disabled':
440
- case 'package_added':
441
- case 'package_updated':
442
- case 'package_deleted':
443
- this.getApps();
444
- break;
445
- case 'entities_added':
446
- case 'entities_updated':
447
- case 'entities_deleted':
448
- this.getEntities();
449
- break;
450
- default:
451
- break;
452
- }
453
- }
454
- render() {
455
- const {
456
- title,
457
- componentID,
458
- authentication,
459
- organization,
460
- classes
461
- } = this.props;
462
- const {
463
- notificationsAnchorEl,
464
- notifications
465
- } = this.state;
466
- return /*#__PURE__*/_react.default.createElement("div", {
467
- className: classes.root
468
- }, /*#__PURE__*/_react.default.createElement(_context.ChannelsConsumer, {
469
- id: "coreappbar",
470
- handler: (channel, obj) => this.handleMessage(channel, obj)
471
- }), /*#__PURE__*/_react.default.createElement(_Drawer.default, {
472
- variant: "permanent",
473
- classes: {
474
- paper: classes.drawerPaper
475
- }
476
- }, /*#__PURE__*/_react.default.createElement("div", {
477
- style: {
478
- display: 'flex',
479
- flexDirection: ' row',
480
- backgroundColor: '#3f5c67'
481
- }
482
- }, /*#__PURE__*/_react.default.createElement("div", {
483
- style: {
484
- backgroundColor: '#496b78',
485
- alignItems: 'center',
486
- justifyContent: 'center'
487
- }
488
- }, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
489
- style: {
490
- margin: 8
491
- },
492
- color: "inherit",
493
- onClick: () => this.setState({
494
- drawer: true
495
- })
496
- }, /*#__PURE__*/_react.default.createElement(_Menu2.default, null))), /*#__PURE__*/_react.default.createElement("div", {
497
- style: style.orgEntity
498
- }, /*#__PURE__*/_react.default.createElement(_Button.default, {
499
- color: "inherit",
500
- style: style.titleButton,
501
- variant: "text",
502
- onClick: this.state.entities.length > 1 ? e => this.setState({
503
- entityAnchorEl: e.currentTarget
504
- }) : null
505
- }, /*#__PURE__*/_react.default.createElement("div", null, organization.organization ? organization.organization.name : null, this.props.showEntity && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("br", null), organization.entity ? organization.entity.name : null))))), /*#__PURE__*/_react.default.createElement(_Typography.default, {
506
- style: style.title,
507
- variant: "h6",
508
- color: "inherit"
509
- }, title), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement("div", {
510
- className: "".concat(_scrollbarModule.default.scroll, " ").concat(_scrollbarModule.default.white),
511
- style: {
512
- flexGrow: 1,
513
- minHeight: 0,
514
- overflow: 'auto'
515
- }
516
- }, this.props.content), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement("div", {
517
- style: {
518
- padding: 5
519
- }
520
- }, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
521
- title: "".concat(this.props.authentication.token.userInfo.firstName, " ").concat(this.props.authentication.token.userInfo.lastName)
522
- }, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
523
- color: "inherit",
524
- onClick: e => this.setState({
525
- authenticationAnchorEl: e.currentTarget
526
- }),
527
- className: classes.menuIconButton
528
- }, /*#__PURE__*/_react.default.createElement(_AccountCircle.default, null))), /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
529
- title: notifications.length > 0 ? "You have ".concat(notifications.length, " notification").concat(notifications.length > 0 ? 's' : '') : 'There are no notifications'
530
- }, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
531
- color: "inherit",
532
- onClick: notifications.length > 0 ? e => this.setState({
533
- notificationsAnchorEl: e.currentTarget
534
- }) : null,
535
- className: classes.menuIconButton
536
- }, /*#__PURE__*/_react.default.createElement(_Badge.default, {
537
- badgeContent: notifications.length,
538
- classes: {
539
- badge: this.getNotificationBadgeClass()
540
- },
541
- showZero: false
542
- }, /*#__PURE__*/_react.default.createElement(_Notifications.default, null)))), componentID.length > 0 && /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
543
- title: this.state.favorites.includes(componentID) ? /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
544
- id: "__favorite"
545
- }) : /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
546
- id: "__click_to_favorite"
547
- })
548
- }, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
549
- color: "inherit",
550
- onClick: () => this.favoriteApp(),
551
- className: classes.menuIconButton
552
- }, this.state.favorites.includes(componentID) ? /*#__PURE__*/_react.default.createElement(_Star.default, {
553
- color: "inherit"
554
- }) : /*#__PURE__*/_react.default.createElement(_StarBorder.default, {
555
- color: "inherit"
556
- }))))), /*#__PURE__*/_react.default.createElement("div", {
557
- className: classes.content
558
- }, this.props.children), /*#__PURE__*/_react.default.createElement(_CoreSideBarDrawer.default, {
559
- open: this.state.drawer,
560
- onClose: () => this.setState({
561
- drawer: false
562
- }),
563
- apps: this.state.apps
564
- }), /*#__PURE__*/_react.default.createElement(_Menu.default, {
565
- open: !!this.state.organizationAnchorEl,
566
- anchorEl: this.state.organizationAnchorEl,
567
- anchorOrigin: {
568
- vertical: 'top',
569
- horizontal: 'center'
570
- },
571
- transformOrigin: {
572
- vertical: 'top',
573
- horizontal: 'center'
574
- },
575
- onClose: () => this.setState({
576
- organizationAnchorEl: null
577
- })
578
- }, this.state.organizations.map(org => /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
579
- key: org.id,
580
- onClick: () => {
581
- organization.setOrganization(org);
582
- this.setState({
583
- organizationAnchorEl: null
584
- });
585
- }
586
- }, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(_LocationCity.default, null)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
587
- primary: org.name,
588
- inset: true
589
- })))), /*#__PURE__*/_react.default.createElement(_Menu.default, {
590
- classes: {
591
- paper: classes.menuPaper
592
- },
593
- anchorEl: this.state.entityAnchorEl,
594
- anchorOrigin: {
595
- vertical: 'top',
596
- horizontal: 'center'
597
- },
598
- transformOrigin: {
599
- vertical: 'top',
600
- horizontal: 'center'
601
- },
602
- open: !!this.state.entityAnchorEl,
603
- onClose: () => this.setState({
604
- entityAnchorEl: null
605
- })
606
- }, this.state.entities.map(entity => /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
607
- classes: {
608
- root: classes.menuItemRoot
609
- },
610
- key: entity.key,
611
- onClick: () => {
612
- organization.setEntity(entity);
613
- this.setState({
614
- entityAnchorEl: null
615
- });
616
- }
617
- }, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, {
618
- classes: {
619
- root: classes.listItemRoot
620
- }
621
- }, /*#__PURE__*/_react.default.createElement(_LocationCity.default, null)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
622
- classes: {
623
- primary: classes.listItemRoot
624
- },
625
- primary: entity.name,
626
- inset: true
627
- })))), /*#__PURE__*/_react.default.createElement(_Menu.default, {
628
- classes: {
629
- paper: classes.menuPaper
630
- },
631
- open: !!this.state.authenticationAnchorEl,
632
- anchorEl: this.state.authenticationAnchorEl,
633
- onClose: () => this.setState({
634
- authenticationAnchorEl: null
635
- })
636
- }, /*#__PURE__*/_react.default.createElement(_ListItem.default, {
637
- classes: {
638
- root: classes.menuItemRoot
639
- },
640
- style: {
641
- outline: 0
642
- }
643
- }, /*#__PURE__*/_react.default.createElement(_Avatar.default, {
644
- style: {
645
- marginRight: 10
646
- }
647
- }, this.getUsersInitials()), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
648
- classes: {
649
- primary: classes.menuItemRoot,
650
- secondary: classes.menuItemRoot
651
- },
652
- primary: "".concat(this.props.authentication.token.userInfo.firstName, " ").concat(this.props.authentication.token.userInfo.lastName),
653
- secondary: this.props.authentication.token.userInfo.emailAddress
654
- })), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement("a", {
655
- href: this.props.core.formatUrl('/profile'),
656
- style: {
657
- all: 'unset'
658
- }
659
- }, /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
660
- classes: {
661
- root: classes.menuItemRoot
662
- }
663
- }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
664
- id: "__my_profile"
665
- }))), /*#__PURE__*/_react.default.createElement(_Divider.default, null), /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
666
- classes: {
667
- root: classes.menuItemRoot
668
- },
669
- onClick: () => authentication.logout()
670
- }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
671
- id: "__log_out"
672
- }))), /*#__PURE__*/_react.default.createElement(_Menu.default, {
673
- classes: {
674
- paper: classes.menuPaper,
675
- root: classes.notificationRoot
676
- },
677
- open: !!notificationsAnchorEl,
678
- anchorEl: notificationsAnchorEl,
679
- onClose: () => this.setState({
680
- notificationsAnchorEl: null
681
- })
682
- }, notifications.map(notification => /*#__PURE__*/_react.default.createElement(_ListItem.default, {
683
- key: notification.id,
684
- classes: {
685
- root: classes.menuItemRoot
686
- }
687
- }, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, this.getNotificationIcon(notification.type)), /*#__PURE__*/_react.default.createElement(_ListItemText.default, {
688
- primary: notification.title,
689
- secondary: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
690
- component: "span",
691
- variant: "body2",
692
- className: classes.inline,
693
- color: "inherit"
694
- }, notification.description))
695
- }), notification.url && notification.url.length > 0 && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
696
- style: {
697
- marginLeft: 5
698
- },
699
- "aria-label": "navigate",
700
- onClick: () => window.open(notification.url, '__BLANK')
701
- }, /*#__PURE__*/_react.default.createElement(_ExitToApp.default, {
702
- style: {
703
- color: '#ffffff'
704
- }
705
- })), notification.isDismissable && /*#__PURE__*/_react.default.createElement(_IconButton.default, {
706
- style: {
707
- marginLeft: 5
708
- },
709
- "aria-label": "delete",
710
- onClick: () => this.dismissNotification(notification.id)
711
- }, /*#__PURE__*/_react.default.createElement(_Delete.default, {
712
- style: {
713
- color: '#ffffff'
714
- }
715
- }))))));
716
- }
717
- }
718
- CoreSideBar.propTypes = {
719
- title: _propTypes.default.string,
720
- showEntity: _propTypes.default.bool,
721
- componentID: _propTypes.default.string,
722
- core: _propTypes.default.shape().isRequired,
723
- authentication: _propTypes.default.shape().isRequired,
724
- // intl: PropTypes.shape().isRequired,
725
- organization: _propTypes.default.shape().isRequired,
726
- classes: _propTypes.default.shape().isRequired,
727
- theme: _propTypes.default.shape().isRequired,
728
- children: _propTypes.default.node,
729
- content: _propTypes.default.node
730
- };
731
- CoreSideBar.defaultProps = {
732
- showEntity: false,
733
- title: '',
734
- componentID: '',
735
- children: null,
736
- content: null
737
- };
738
- var _default = exports.default = (0, _reactIntl.injectIntl)((0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)((0, _styles.withTheme)((0, _styles.withStyles)(styles)(CoreSideBar))))));