@kineticdata/bundle-tech-bar 5.1.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/lib/App.js +41 -36
  2. package/lib/components/AppointmentForm.js +48 -36
  3. package/lib/components/CheckIn.js +86 -78
  4. package/lib/components/Display.js +64 -53
  5. package/lib/components/Feedback.js +106 -103
  6. package/lib/components/Form.js +56 -48
  7. package/lib/components/Home.js +148 -144
  8. package/lib/components/Overhead.js +52 -44
  9. package/lib/components/Past.js +56 -44
  10. package/lib/components/Sidebar.js +58 -51
  11. package/lib/components/TechBars.js +72 -68
  12. package/lib/components/settings/SchedulerSettings.js +32 -21
  13. package/lib/components/settings/Settings.js +54 -50
  14. package/lib/components/settings/Sidebar.js +41 -31
  15. package/lib/components/settings/TechBarMetrics.js +124 -120
  16. package/lib/components/settings/TechBarSettings.js +46 -36
  17. package/lib/components/settings/metrics/MetricsExport.js +120 -107
  18. package/lib/components/settings/metrics/MetricsSummary.js +140 -141
  19. package/lib/components/settings/metrics/MetricsTrend.js +331 -341
  20. package/lib/components/settings/tech-bar/AppointmentForm.js +30 -20
  21. package/lib/components/settings/tech-bar/TechBar.js +90 -79
  22. package/lib/components/settings/tech-bar/TechBarDisplayMembers.js +108 -108
  23. package/lib/components/settings/tech-bar/TechBarSettingsForm.js +44 -34
  24. package/lib/components/shared/PageTitle.js +24 -15
  25. package/lib/constants.js +38 -16
  26. package/lib/index.js +49 -53
  27. package/lib/redux/modules/app.js +22 -17
  28. package/lib/redux/modules/appointments.js +31 -35
  29. package/lib/redux/modules/export.js +26 -21
  30. package/lib/redux/modules/metrics.js +24 -19
  31. package/lib/redux/modules/techBarApp.js +33 -34
  32. package/lib/redux/modules/walkIns.js +23 -21
  33. package/lib/redux/reducers.js +21 -14
  34. package/lib/redux/sagas/app.js +15 -13
  35. package/lib/redux/sagas/appointments.js +220 -256
  36. package/lib/redux/sagas/export.js +153 -166
  37. package/lib/redux/sagas/metrics.js +76 -76
  38. package/lib/redux/sagas/techBarApp.js +240 -258
  39. package/lib/redux/sagas/walkIns.js +124 -132
  40. package/lib/redux/sagas.js +18 -14
  41. package/lib/redux/store.js +36 -27
  42. package/lib/utils.js +9 -2
  43. package/package.json +6 -15
@@ -1,70 +1,78 @@
1
- import React from 'react';
2
- import { connect } from '../redux/store';
3
- import { compose, lifecycle, withHandlers, withState, withProps } from 'recompose';
4
- import { actions as appointmentActions } from '../redux/modules/appointments';
5
- import { actions as walkInActions } from '../redux/modules/walkIns';
6
- import { I18n, Moment } from '@kineticdata/react';
7
- import moment from 'moment';
8
- import { List } from 'immutable';
9
- export var OverheadComponent = function OverheadComponent(_ref) {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.mapStateToProps = exports.mapDispatchToProps = exports.OverheadComponent = exports.Overhead = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _store = require("../redux/store");
10
+ var _recompose = require("recompose");
11
+ var _appointments = require("../redux/modules/appointments");
12
+ var _walkIns = require("../redux/modules/walkIns");
13
+ var _react2 = require("@kineticdata/react");
14
+ var _moment = _interopRequireDefault(require("moment"));
15
+ var _immutable = require("immutable");
16
+ var OverheadComponent = function OverheadComponent(_ref) {
10
17
  var errors = _ref.errors,
11
- records = _ref.records;
18
+ records = _ref.records;
12
19
  var checkedIn = records && records.filter(function (r) {
13
20
  return r.status === 'Checked In';
14
21
  });
15
22
  var inProgress = records && records.filter(function (r) {
16
23
  return r.status === 'In Progress';
17
24
  });
18
- return /*#__PURE__*/React.createElement("section", {
25
+ return /*#__PURE__*/_react["default"].createElement("section", {
19
26
  className: "tech-bar-display tech-bar-display--overhead"
20
- }, /*#__PURE__*/React.createElement("div", {
27
+ }, /*#__PURE__*/_react["default"].createElement("div", {
21
28
  className: "full-screen-container"
22
- }, /*#__PURE__*/React.createElement("div", {
29
+ }, /*#__PURE__*/_react["default"].createElement("div", {
23
30
  className: "header bg-dark"
24
- }), /*#__PURE__*/React.createElement("div", {
31
+ }), /*#__PURE__*/_react["default"].createElement("div", {
25
32
  className: "body"
26
- }, /*#__PURE__*/React.createElement("div", {
33
+ }, /*#__PURE__*/_react["default"].createElement("div", {
27
34
  className: "form"
28
- }, /*#__PURE__*/React.createElement("h1", null, errors.length > 0 && /*#__PURE__*/React.createElement("span", {
35
+ }, /*#__PURE__*/_react["default"].createElement("h1", null, errors.length > 0 && /*#__PURE__*/_react["default"].createElement("span", {
29
36
  className: "fa fa-fw fa-exclamation-triangle text-danger mr-2"
30
- }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(I18n, null, "Checked In"))), /*#__PURE__*/React.createElement("ol", {
37
+ }), /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Checked In"))), /*#__PURE__*/_react["default"].createElement("ol", {
31
38
  className: "overhead-display-list ".concat(checkedIn.size < 10 ? 'overhead-display-list--short' : 'overhead-display-list--long')
32
39
  }, checkedIn.map(function (r) {
33
- return /*#__PURE__*/React.createElement("li", {
40
+ return /*#__PURE__*/_react["default"].createElement("li", {
34
41
  key: r.id
35
- }, r.displayName, ' ', r.isWalkIn ? /*#__PURE__*/React.createElement("small", null, /*#__PURE__*/React.createElement(I18n, {
42
+ }, r.displayName, ' ', r.isWalkIn ? /*#__PURE__*/_react["default"].createElement("small", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, {
36
43
  render: function render(translate) {
37
44
  return "(".concat(translate('Walk-In'), ")");
38
45
  }
39
- })) : /*#__PURE__*/React.createElement("small", null, '(', /*#__PURE__*/React.createElement(Moment, {
46
+ })) : /*#__PURE__*/_react["default"].createElement("small", null, '(', /*#__PURE__*/_react["default"].createElement(_react2.Moment, {
40
47
  timestamp: r.appointmentTime,
41
- format: Moment.formats.time
48
+ format: _react2.Moment.formats.time
42
49
  }), ')'));
43
- }))), /*#__PURE__*/React.createElement("div", {
50
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
44
51
  className: "form"
45
- }, /*#__PURE__*/React.createElement("h1", null, errors.length > 0 && /*#__PURE__*/React.createElement("span", {
52
+ }, /*#__PURE__*/_react["default"].createElement("h1", null, errors.length > 0 && /*#__PURE__*/_react["default"].createElement("span", {
46
53
  className: "fa fa-fw fa-exclamation-triangle text-danger mr-2"
47
- }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(I18n, null, "Now Serving"))), /*#__PURE__*/React.createElement("ol", {
54
+ }), /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Now Serving"))), /*#__PURE__*/_react["default"].createElement("ol", {
48
55
  className: "overhead-display-list ".concat(inProgress.size < 10 ? 'overhead-display-list--short' : 'overhead-display-list--long')
49
56
  }, inProgress.map(function (r) {
50
- return /*#__PURE__*/React.createElement("li", {
57
+ return /*#__PURE__*/_react["default"].createElement("li", {
51
58
  key: r.id
52
- }, r.displayName, ' ', r.isWalkIn ? /*#__PURE__*/React.createElement("small", null, /*#__PURE__*/React.createElement(I18n, {
59
+ }, r.displayName, ' ', r.isWalkIn ? /*#__PURE__*/_react["default"].createElement("small", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, {
53
60
  render: function render(translate) {
54
61
  return "(".concat(translate('Walk-In'), ")");
55
62
  }
56
- })) : /*#__PURE__*/React.createElement("small", null, '(', /*#__PURE__*/React.createElement(Moment, {
63
+ })) : /*#__PURE__*/_react["default"].createElement("small", null, '(', /*#__PURE__*/_react["default"].createElement(_react2.Moment, {
57
64
  timestamp: r.appointmentTime,
58
- format: Moment.formats.time
65
+ format: _react2.Moment.formats.time
59
66
  }), ')'));
60
67
  }))))));
61
68
  };
62
- export var mapStateToProps = function mapStateToProps(state, props) {
69
+ exports.OverheadComponent = OverheadComponent;
70
+ var mapStateToProps = function mapStateToProps(state, props) {
63
71
  return {
64
72
  errors: [state.appointments.error, state.walkIns.error].filter(function (e) {
65
73
  return e;
66
74
  }),
67
- records: (state.appointments.today || List()).map(function (a) {
75
+ records: (state.appointments.today || (0, _immutable.List)()).map(function (a) {
68
76
  return {
69
77
  id: a.id,
70
78
  updatedAt: "".concat(a.values['Event Date'], " ").concat(a.values['Event Time']),
@@ -73,10 +81,10 @@ export var mapStateToProps = function mapStateToProps(state, props) {
73
81
  displayName: a.values['Requested For Display Name'],
74
82
  status: a.values['Status']
75
83
  };
76
- }).concat((state.walkIns.today || List()).map(function (w) {
84
+ }).concat((state.walkIns.today || (0, _immutable.List)()).map(function (w) {
77
85
  return {
78
86
  id: w.id,
79
- updatedAt: moment.utc(w.updatedAt).tz(props.techBar.values['Timezone'] || moment.tz.guess()).format('YYYY-MM-DD HH:mm'),
87
+ updatedAt: _moment["default"].utc(w.updatedAt).tz(props.techBar.values['Timezone'] || _moment["default"].tz.guess()).format('YYYY-MM-DD HH:mm'),
80
88
  isWalkIn: true,
81
89
  username: w.values['Requested For'] || w.values['Email'],
82
90
  displayName: w.values['Requested For Display Name'] || "".concat(w.values['First Name'], " ").concat(w.values['Last Name']),
@@ -87,15 +95,16 @@ export var mapStateToProps = function mapStateToProps(state, props) {
87
95
  })
88
96
  };
89
97
  };
90
- export var mapDispatchToProps = {
91
- fetchTodayAppointmentsRequest: appointmentActions.fetchTodayAppointmentsRequest,
92
- fetchTodayWalkInsRequest: walkInActions.fetchTodayWalkInsRequest
98
+ exports.mapStateToProps = mapStateToProps;
99
+ var mapDispatchToProps = {
100
+ fetchTodayAppointmentsRequest: _appointments.actions.fetchTodayAppointmentsRequest,
101
+ fetchTodayWalkInsRequest: _walkIns.actions.fetchTodayWalkInsRequest
93
102
  };
94
-
103
+ exports.mapDispatchToProps = mapDispatchToProps;
95
104
  var fetchData = function fetchData(_ref2) {
96
105
  var techBarId = _ref2.techBarId,
97
- fetchTodayAppointmentsRequest = _ref2.fetchTodayAppointmentsRequest,
98
- fetchTodayWalkInsRequest = _ref2.fetchTodayWalkInsRequest;
106
+ fetchTodayAppointmentsRequest = _ref2.fetchTodayAppointmentsRequest,
107
+ fetchTodayWalkInsRequest = _ref2.fetchTodayWalkInsRequest;
99
108
  return function () {
100
109
  fetchTodayAppointmentsRequest({
101
110
  schedulerId: techBarId,
@@ -107,18 +116,16 @@ var fetchData = function fetchData(_ref2) {
107
116
  });
108
117
  };
109
118
  };
110
-
111
- export var Overhead = compose(withProps(function (_ref3) {
119
+ var Overhead = (0, _recompose.compose)((0, _recompose.withProps)(function (_ref3) {
112
120
  var techBar = _ref3.techBar;
113
121
  return {
114
122
  techBarId: techBar.values['Id']
115
123
  };
116
- }), connect(mapStateToProps, mapDispatchToProps), withState('poller', 'setPoller', null), withHandlers({
124
+ }), (0, _store.connect)(mapStateToProps, mapDispatchToProps), (0, _recompose.withState)('poller', 'setPoller', null), (0, _recompose.withHandlers)({
117
125
  fetchData: fetchData
118
- }), lifecycle({
126
+ }), (0, _recompose.lifecycle)({
119
127
  componentDidMount: function componentDidMount() {
120
128
  var _this = this;
121
-
122
129
  this.props.fetchData();
123
130
  this.props.setPoller(setInterval(function () {
124
131
  _this.props.fetchData();
@@ -127,4 +134,5 @@ export var Overhead = compose(withProps(function (_ref3) {
127
134
  componentWillUnmount: function componentWillUnmount() {
128
135
  clearInterval(this.props.poller);
129
136
  }
130
- }))(OverheadComponent);
137
+ }))(OverheadComponent);
138
+ exports.Overhead = Overhead;
@@ -1,22 +1,30 @@
1
- import React, { Fragment } from 'react';
2
- import { connect } from '../redux/store';
3
- import { compose, lifecycle } from 'recompose';
4
- import { Card, CardCol, CardRow, StateListWrapper } from '@kineticdata/bundle-common';
5
- import { PageTitle } from './shared/PageTitle';
6
- import { Link } from '@reach/router';
7
- import { actions } from '../redux/modules/appointments';
8
- import moment from 'moment';
9
- import { I18n, Moment } from '@kineticdata/react';
10
- import { DATE_FORMAT, TIME_FORMAT } from '../constants';
11
- export var PastComponent = function PastComponent(_ref) {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.mapStateToProps = exports.mapDispatchToProps = exports.PastComponent = exports.Past = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _store = require("../redux/store");
11
+ var _recompose = require("recompose");
12
+ var _bundleCommon = require("@kineticdata/bundle-common");
13
+ var _PageTitle = require("./shared/PageTitle");
14
+ var _router = require("@reach/router");
15
+ var _appointments = require("../redux/modules/appointments");
16
+ var _moment = _interopRequireDefault(require("moment"));
17
+ var _react2 = require("@kineticdata/react");
18
+ var _constants = require("../constants");
19
+ var PastComponent = function PastComponent(_ref) {
12
20
  var techBars = _ref.techBars,
13
- error = _ref.error,
14
- pastAppointments = _ref.pastAppointments;
15
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
21
+ error = _ref.error,
22
+ pastAppointments = _ref.pastAppointments;
23
+ return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
16
24
  className: "page-container page-container--tech-bar page-container--lg"
17
- }, /*#__PURE__*/React.createElement("div", {
25
+ }, /*#__PURE__*/_react["default"].createElement("div", {
18
26
  className: "page-panel"
19
- }, /*#__PURE__*/React.createElement(PageTitle, {
27
+ }, /*#__PURE__*/_react["default"].createElement(_PageTitle.PageTitle, {
20
28
  parts: ['Past Appointments'],
21
29
  breadcrumbs: [{
22
30
  label: 'Home',
@@ -26,64 +34,65 @@ export var PastComponent = function PastComponent(_ref) {
26
34
  to: '..'
27
35
  }],
28
36
  title: "Past Appointments"
29
- }), /*#__PURE__*/React.createElement("section", {
37
+ }), /*#__PURE__*/_react["default"].createElement("section", {
30
38
  className: "mb-4"
31
- }, /*#__PURE__*/React.createElement(StateListWrapper, {
39
+ }, /*#__PURE__*/_react["default"].createElement(_bundleCommon.StateListWrapper, {
32
40
  data: pastAppointments,
33
41
  error: error,
34
42
  emptyTitle: "You have no past appointments.",
35
43
  emptyMessage: "Your completed and cancelled appointments will appear here."
36
44
  }, function (data) {
37
- return /*#__PURE__*/React.createElement("div", {
45
+ return /*#__PURE__*/_react["default"].createElement("div", {
38
46
  className: "cards"
39
47
  }, data.map(function (appt) {
40
48
  var techBar = techBars.find(function (t) {
41
49
  return t.values['Id'] === appt.values['Scheduler Id'];
42
50
  });
43
- var date = moment.utc(appt.values['Event Date'], DATE_FORMAT);
44
- var start = moment.utc(appt.values['Event Time'], TIME_FORMAT);
51
+ var date = _moment["default"].utc(appt.values['Event Date'], _constants.DATE_FORMAT);
52
+ var start = _moment["default"].utc(appt.values['Event Time'], _constants.TIME_FORMAT);
45
53
  var end = start.clone().add(appt.values['Event Duration'], 'minute');
46
- return /*#__PURE__*/React.createElement(Card, {
54
+ return /*#__PURE__*/_react["default"].createElement(_bundleCommon.Card, {
47
55
  key: appt.id,
48
56
  to: "appointment/".concat(appt.values['Scheduler Id'], "/").concat(appt.id),
49
57
  components: {
50
- Link: Link
58
+ Link: _router.Link
51
59
  }
52
- }, /*#__PURE__*/React.createElement(CardRow, null, /*#__PURE__*/React.createElement(CardRow, {
60
+ }, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, null, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
53
61
  type: "prepend"
54
- }, /*#__PURE__*/React.createElement("span", {
62
+ }, /*#__PURE__*/_react["default"].createElement("span", {
55
63
  className: "fa fa-calendar fa-rounded",
56
64
  style: {
57
65
  background: 'rgb(255, 74, 94)'
58
66
  }
59
- })), /*#__PURE__*/React.createElement(CardCol, null, /*#__PURE__*/React.createElement(CardRow, {
67
+ })), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardCol, null, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
60
68
  type: "multi"
61
- }, /*#__PURE__*/React.createElement(CardRow, {
69
+ }, /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
62
70
  type: "subtitle"
63
- }, /*#__PURE__*/React.createElement(Moment, {
71
+ }, /*#__PURE__*/_react["default"].createElement(_react2.Moment, {
64
72
  timestamp: date,
65
- format: Moment.formats.dateWithDay
66
- })), /*#__PURE__*/React.createElement(CardRow, {
73
+ format: _react2.Moment.formats.dateWithDay
74
+ })), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
67
75
  className: "text-muted"
68
- }, /*#__PURE__*/React.createElement(Moment, {
76
+ }, /*#__PURE__*/_react["default"].createElement(_react2.Moment, {
69
77
  timestamp: start,
70
- format: Moment.formats.time
71
- }), " - ", /*#__PURE__*/React.createElement(Moment, {
78
+ format: _react2.Moment.formats.time
79
+ }), " - ", /*#__PURE__*/_react["default"].createElement(_react2.Moment, {
72
80
  timestamp: end,
73
- format: Moment.formats.time
74
- })), /*#__PURE__*/React.createElement(CardRow, {
81
+ format: _react2.Moment.formats.time
82
+ })), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
75
83
  type: "meta"
76
- }, /*#__PURE__*/React.createElement("strong", null, /*#__PURE__*/React.createElement(I18n, null, techBar.values['Name']))), /*#__PURE__*/React.createElement(CardRow, {
84
+ }, /*#__PURE__*/_react["default"].createElement("strong", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, techBar.values['Name']))), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
77
85
  type: "meta"
78
- }, appt.values['Summary']))), /*#__PURE__*/React.createElement(CardRow, {
86
+ }, appt.values['Summary']))), /*#__PURE__*/_react["default"].createElement(_bundleCommon.CardRow, {
79
87
  type: "append"
80
- }, /*#__PURE__*/React.createElement("span", {
88
+ }, /*#__PURE__*/_react["default"].createElement("span", {
81
89
  className: "badge badge-stylized badge-".concat(appt.coreState === 'Closed' ? 'dark' : 'success')
82
- }, /*#__PURE__*/React.createElement(I18n, null, appt.values['Status'])))));
90
+ }, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, appt.values['Status'])))));
83
91
  }));
84
92
  })))));
85
93
  };
86
- export var mapStateToProps = function mapStateToProps(state) {
94
+ exports.PastComponent = PastComponent;
95
+ var mapStateToProps = function mapStateToProps(state) {
87
96
  return {
88
97
  techBars: state.techBarApp.schedulers.filter(function (s) {
89
98
  return s.values['Status'] === 'Active';
@@ -92,11 +101,14 @@ export var mapStateToProps = function mapStateToProps(state) {
92
101
  pastAppointments: state.appointments.past
93
102
  };
94
103
  };
95
- export var mapDispatchToProps = {
96
- fetchPastAppointmentsRequest: actions.fetchPastAppointmentsRequest
104
+ exports.mapStateToProps = mapStateToProps;
105
+ var mapDispatchToProps = {
106
+ fetchPastAppointmentsRequest: _appointments.actions.fetchPastAppointmentsRequest
97
107
  };
98
- export var Past = compose(connect(mapStateToProps, mapDispatchToProps), lifecycle({
108
+ exports.mapDispatchToProps = mapDispatchToProps;
109
+ var Past = (0, _recompose.compose)((0, _store.connect)(mapStateToProps, mapDispatchToProps), (0, _recompose.lifecycle)({
99
110
  componentDidMount: function componentDidMount() {
100
111
  this.props.fetchPastAppointmentsRequest();
101
112
  }
102
- }))(PastComponent);
113
+ }))(PastComponent);
114
+ exports.Past = Past;
@@ -1,122 +1,129 @@
1
- import React from 'react';
2
- import { connect } from '../redux/store';
3
- import { compose, withHandlers, withState } from 'recompose';
4
- import { selectHasRoleSchedulerAdmin, selectHasRoleSchedulerManager, selectHasRoleSchedulerAgent, Utils } from '@kineticdata/bundle-common';
5
- import { Link } from '@reach/router';
6
- import { Dropdown, DropdownToggle, DropdownMenu, Nav, NavItem } from 'reactstrap';
7
- import { I18n } from '@kineticdata/react';
8
- import { isActiveClass } from '../utils';
9
- export var SidebarComponent = function SidebarComponent(_ref) {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.mapStateToProps = exports.SidebarComponent = exports.Sidebar = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _store = require("../redux/store");
10
+ var _recompose = require("recompose");
11
+ var _bundleCommon = require("@kineticdata/bundle-common");
12
+ var _router = require("@reach/router");
13
+ var _reactstrap = require("reactstrap");
14
+ var _react2 = require("@kineticdata/react");
15
+ var _utils = require("../utils");
16
+ var SidebarComponent = function SidebarComponent(_ref) {
10
17
  var hasSettingsAccess = _ref.hasSettingsAccess,
11
- techBars = _ref.techBars,
12
- openDropdown = _ref.openDropdown,
13
- toggleDropdown = _ref.toggleDropdown,
14
- hasTechBarDisplayRole = _ref.hasTechBarDisplayRole;
15
- return /*#__PURE__*/React.createElement("div", {
18
+ techBars = _ref.techBars,
19
+ openDropdown = _ref.openDropdown,
20
+ toggleDropdown = _ref.toggleDropdown,
21
+ hasTechBarDisplayRole = _ref.hasTechBarDisplayRole;
22
+ return /*#__PURE__*/_react["default"].createElement("div", {
16
23
  className: "sidebar sidebar--tech-bar"
17
- }, /*#__PURE__*/React.createElement("div", {
24
+ }, /*#__PURE__*/_react["default"].createElement("div", {
18
25
  className: "sidebar-group--content-wrapper"
19
- }, /*#__PURE__*/React.createElement("div", {
26
+ }, /*#__PURE__*/_react["default"].createElement("div", {
20
27
  className: "sidebar-group"
21
- }, /*#__PURE__*/React.createElement(Nav, {
28
+ }, /*#__PURE__*/_react["default"].createElement(_reactstrap.Nav, {
22
29
  vertical: true
23
- }, /*#__PURE__*/React.createElement(NavItem, null, /*#__PURE__*/React.createElement(Link, {
30
+ }, /*#__PURE__*/_react["default"].createElement(_reactstrap.NavItem, null, /*#__PURE__*/_react["default"].createElement(_router.Link, {
24
31
  to: "past",
25
- getProps: isActiveClass('nav-link'),
32
+ getProps: (0, _utils.isActiveClass)('nav-link'),
26
33
  className: "nav-link"
27
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(I18n, null, "Past Appointments"))))))), /*#__PURE__*/React.createElement("div", {
34
+ }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Past Appointments"))))))), /*#__PURE__*/_react["default"].createElement("div", {
28
35
  className: "sidebar-group sidebar-group--tech-bars"
29
- }, /*#__PURE__*/React.createElement("div", {
36
+ }, /*#__PURE__*/_react["default"].createElement("div", {
30
37
  className: "sidebar-group__label"
31
- }, /*#__PURE__*/React.createElement(I18n, null, "Tech Bars"), /*#__PURE__*/React.createElement(Link, {
38
+ }, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Tech Bars"), /*#__PURE__*/_react["default"].createElement(_router.Link, {
32
39
  to: "tech-bars",
33
40
  className: "view-all"
34
- }, /*#__PURE__*/React.createElement(I18n, null, "View All"))), /*#__PURE__*/React.createElement(Nav, {
41
+ }, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "View All"))), /*#__PURE__*/_react["default"].createElement(_reactstrap.Nav, {
35
42
  vertical: true
36
43
  }, techBars.map(function (techBar) {
37
- return /*#__PURE__*/React.createElement(NavItem, {
44
+ return /*#__PURE__*/_react["default"].createElement(_reactstrap.NavItem, {
38
45
  key: techBar.id
39
- }, /*#__PURE__*/React.createElement(Link, {
46
+ }, /*#__PURE__*/_react["default"].createElement(_router.Link, {
40
47
  to: "appointment/".concat(techBar.values['Id']),
41
48
  className: "nav-link"
42
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(I18n, null, techBar.values['Name'])))), hasTechBarDisplayRole(techBar.values['Name']) && /*#__PURE__*/React.createElement(Dropdown, {
49
+ }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, techBar.values['Name'])))), hasTechBarDisplayRole(techBar.values['Name']) && /*#__PURE__*/_react["default"].createElement(_reactstrap.Dropdown, {
43
50
  toggle: toggleDropdown(techBar.id),
44
51
  isOpen: openDropdown === techBar.id
45
- }, /*#__PURE__*/React.createElement(DropdownToggle, {
52
+ }, /*#__PURE__*/_react["default"].createElement(_reactstrap.DropdownToggle, {
46
53
  color: "link",
47
54
  className: "btn-sm"
48
- }, /*#__PURE__*/React.createElement("span", {
55
+ }, /*#__PURE__*/_react["default"].createElement("span", {
49
56
  className: "fa fa-ellipsis-v fa-lg"
50
- })), /*#__PURE__*/React.createElement(DropdownMenu, {
57
+ })), /*#__PURE__*/_react["default"].createElement(_reactstrap.DropdownMenu, {
51
58
  right: true
52
- }, /*#__PURE__*/React.createElement(Link, {
59
+ }, /*#__PURE__*/_react["default"].createElement(_router.Link, {
53
60
  to: "display/".concat(techBar.values['Id'], "/checkin"),
54
61
  onClick: toggleDropdown(techBar.id),
55
62
  className: "dropdown-item",
56
63
  target: "_blank"
57
- }, /*#__PURE__*/React.createElement("span", {
64
+ }, /*#__PURE__*/_react["default"].createElement("span", {
58
65
  className: "fa fa-fw fa-external-link mr-2"
59
- }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(I18n, null, "Check In"))), /*#__PURE__*/React.createElement(Link, {
66
+ }), /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Check In"))), /*#__PURE__*/_react["default"].createElement(_router.Link, {
60
67
  to: "display/".concat(techBar.values['Id'], "/feedback"),
61
68
  onClick: toggleDropdown(techBar.id),
62
69
  className: "dropdown-item",
63
70
  target: "_blank"
64
- }, /*#__PURE__*/React.createElement("span", {
71
+ }, /*#__PURE__*/_react["default"].createElement("span", {
65
72
  className: "fa fa-external-link fa-fw mr-2"
66
- }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(I18n, null, "Feedback"))), /*#__PURE__*/React.createElement(Link, {
73
+ }), /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Feedback"))), /*#__PURE__*/_react["default"].createElement(_router.Link, {
67
74
  to: "display/".concat(techBar.values['Id'], "/checkin?crosslink"),
68
75
  onClick: toggleDropdown(techBar.id),
69
76
  className: "dropdown-item",
70
77
  target: "_blank"
71
- }, /*#__PURE__*/React.createElement("span", {
78
+ }, /*#__PURE__*/_react["default"].createElement("span", {
72
79
  className: "fa fa-external-link fa-fw mr-2"
73
- }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(I18n, null, "Check In"), " / ", /*#__PURE__*/React.createElement(I18n, null, "Feedback"))), /*#__PURE__*/React.createElement(Link, {
80
+ }), /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Check In"), " / ", /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Feedback"))), /*#__PURE__*/_react["default"].createElement(_router.Link, {
74
81
  to: "display/".concat(techBar.values['Id'], "/overhead"),
75
82
  onClick: toggleDropdown(techBar.id),
76
83
  className: "dropdown-item",
77
84
  target: "_blank"
78
- }, /*#__PURE__*/React.createElement("span", {
85
+ }, /*#__PURE__*/_react["default"].createElement("span", {
79
86
  className: "fa fa-external-link fa-fw mr-2"
80
- }), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(I18n, null, "Overhead"))))));
81
- })))), hasSettingsAccess && /*#__PURE__*/React.createElement("div", {
87
+ }), /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Overhead"))))));
88
+ })))), hasSettingsAccess && /*#__PURE__*/_react["default"].createElement("div", {
82
89
  className: "sidebar-group sidebar-group--settings"
83
- }, /*#__PURE__*/React.createElement("ul", {
90
+ }, /*#__PURE__*/_react["default"].createElement("ul", {
84
91
  className: "nav flex-column settings-group"
85
- }, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Link, {
92
+ }, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement(_router.Link, {
86
93
  to: "settings/general",
87
94
  className: "nav-link"
88
- }, /*#__PURE__*/React.createElement(I18n, null, "Settings"), /*#__PURE__*/React.createElement("span", {
95
+ }, /*#__PURE__*/_react["default"].createElement(_react2.I18n, null, "Settings"), /*#__PURE__*/_react["default"].createElement("span", {
89
96
  className: "fa fa-fw fa-angle-right"
90
97
  }))))));
91
98
  };
92
- export var mapStateToProps = function mapStateToProps(state) {
99
+ exports.SidebarComponent = SidebarComponent;
100
+ var mapStateToProps = function mapStateToProps(state) {
93
101
  return {
94
102
  techBars: state.techBarApp.schedulers.filter(function (s) {
95
103
  return s.values['Status'] === 'Active';
96
104
  }),
97
- hasSettingsAccess: selectHasRoleSchedulerManager(state.app.profile) || selectHasRoleSchedulerAdmin(state.app.profile) || selectHasRoleSchedulerAgent(state.app.profile),
105
+ hasSettingsAccess: (0, _bundleCommon.selectHasRoleSchedulerManager)(state.app.profile) || (0, _bundleCommon.selectHasRoleSchedulerAdmin)(state.app.profile) || (0, _bundleCommon.selectHasRoleSchedulerAgent)(state.app.profile),
98
106
  profile: state.app.profile
99
107
  };
100
108
  };
101
-
109
+ exports.mapStateToProps = mapStateToProps;
102
110
  var toggleDropdown = function toggleDropdown(_ref2) {
103
111
  var setOpenDropdown = _ref2.setOpenDropdown,
104
- openDropdown = _ref2.openDropdown;
112
+ openDropdown = _ref2.openDropdown;
105
113
  return function (dropdownSlug) {
106
114
  return function () {
107
115
  return setOpenDropdown(dropdownSlug === openDropdown ? false : dropdownSlug);
108
116
  };
109
117
  };
110
118
  };
111
-
112
119
  var hasTechBarDisplayRole = function hasTechBarDisplayRole(_ref3) {
113
120
  var profile = _ref3.profile;
114
121
  return function (techBarName) {
115
- return Utils.isMemberOf(profile, "Role::Tech Bar Display::".concat(techBarName));
122
+ return _bundleCommon.Utils.isMemberOf(profile, "Role::Tech Bar Display::".concat(techBarName));
116
123
  };
117
124
  };
118
-
119
- export var Sidebar = compose(connect(mapStateToProps), withState('openDropdown', 'setOpenDropdown', false), withHandlers({
125
+ var Sidebar = (0, _recompose.compose)((0, _store.connect)(mapStateToProps), (0, _recompose.withState)('openDropdown', 'setOpenDropdown', false), (0, _recompose.withHandlers)({
120
126
  toggleDropdown: toggleDropdown,
121
127
  hasTechBarDisplayRole: hasTechBarDisplayRole
122
- }))(SidebarComponent);
128
+ }))(SidebarComponent);
129
+ exports.Sidebar = Sidebar;