versacall-core-library-react 2.0.66 → 2.0.67

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 +132 -278
  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
@@ -1,83 +1,30 @@
1
1
  "use strict";
2
2
 
3
- 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); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
7
  var _react = _interopRequireWildcard(require("react"));
11
-
12
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
9
  var _OrganizationChannel = _interopRequireDefault(require("./OrganizationChannel"));
15
-
16
10
  var _EveryoneChannel = _interopRequireDefault(require("./EveryoneChannel"));
17
-
18
11
  var _EntityChannel = _interopRequireDefault(require("./EntityChannel"));
19
-
20
12
  var _withChannels = _interopRequireDefault(require("./withChannels"));
21
-
22
13
  var _UserChannel = _interopRequireDefault(require("./UserChannel"));
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- 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); }
27
-
28
- 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; }
29
-
30
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
-
32
- 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); } }
33
-
34
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
35
-
36
- 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); }
37
-
38
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
39
-
40
- 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); }; }
41
-
42
- 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); }
43
-
44
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
-
46
- 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; } }
47
-
48
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
49
-
50
- var ChannelsConsumer = /*#__PURE__*/function (_Component) {
51
- _inherits(ChannelsConsumer, _Component);
52
-
53
- var _super = _createSuper(ChannelsConsumer);
54
-
55
- function ChannelsConsumer() {
56
- _classCallCheck(this, ChannelsConsumer);
57
-
58
- return _super.apply(this, arguments);
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ 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); }
16
+ 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; }
17
+ class ChannelsConsumer extends _react.Component {
18
+ componentDidMount() {
19
+ this.props.channels.registerHandlers(this.props.id, this.props.handler, this.props.connectionChanged, this.props.subscribing);
59
20
  }
60
-
61
- _createClass(ChannelsConsumer, [{
62
- key: "componentDidMount",
63
- value: function componentDidMount() {
64
- this.props.channels.registerHandlers(this.props.id, this.props.handler, this.props.connectionChanged, this.props.subscribing);
65
- }
66
- }, {
67
- key: "componentWillUnmount",
68
- value: function componentWillUnmount() {
69
- this.props.channels.unregisterHandlers(this.props.id);
70
- }
71
- }, {
72
- key: "render",
73
- value: function render() {
74
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, this.props.addDefaultChannels && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_EveryoneChannel.default, null), /*#__PURE__*/_react.default.createElement(_UserChannel.default, null), /*#__PURE__*/_react.default.createElement(_OrganizationChannel.default, null), /*#__PURE__*/_react.default.createElement(_EntityChannel.default, null)), this.props.children);
75
- }
76
- }]);
77
-
78
- return ChannelsConsumer;
79
- }(_react.Component);
80
-
21
+ componentWillUnmount() {
22
+ this.props.channels.unregisterHandlers(this.props.id);
23
+ }
24
+ render() {
25
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, this.props.addDefaultChannels && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_EveryoneChannel.default, null), /*#__PURE__*/_react.default.createElement(_UserChannel.default, null), /*#__PURE__*/_react.default.createElement(_OrganizationChannel.default, null), /*#__PURE__*/_react.default.createElement(_EntityChannel.default, null)), this.props.children);
26
+ }
27
+ }
81
28
  ChannelsConsumer.propTypes = {
82
29
  children: _propTypes.default.node,
83
30
  id: _propTypes.default.string.isRequired,
@@ -93,7 +40,4 @@ ChannelsConsumer.defaultProps = {
93
40
  addDefaultChannels: true,
94
41
  children: null
95
42
  };
96
-
97
- var _default = (0, _withChannels.default)(ChannelsConsumer);
98
-
99
- exports.default = _default;
43
+ var _default = exports.default = (0, _withChannels.default)(ChannelsConsumer);
@@ -4,12 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- var ChannelsContext = /*#__PURE__*/_react.default.createContext();
13
-
14
- var _default = ChannelsContext;
15
- exports.default = _default;
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const ChannelsContext = /*#__PURE__*/_react.default.createContext();
10
+ var _default = exports.default = ChannelsContext;
@@ -1,58 +1,25 @@
1
1
  "use strict";
2
2
 
3
- 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); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
7
  var _react = _interopRequireWildcard(require("react"));
11
-
12
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
9
  var _ChannelsContext = _interopRequireDefault(require("./ChannelsContext"));
15
-
16
10
  var _withCore = _interopRequireDefault(require("../Core/withCore"));
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- 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); }
21
-
22
- 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; }
23
-
24
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
-
26
- 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); } }
27
-
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
-
30
- 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); }
31
-
32
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
-
34
- 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); }; }
35
-
36
- 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); }
37
-
38
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
-
40
- 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; } }
41
-
42
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
-
44
- var namespace = 'ChannelsProvider';
45
-
46
- var emitter = require('emitter-io');
47
-
48
- var channelTimeoutHandlers = [];
49
- var channelInformation = [];
50
- var channelFunctions = [];
51
- var handlers = [];
52
- var connectionChangedHandlers = [];
53
- var subscribingHandlers = [];
54
- var client;
55
-
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ 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); }
13
+ 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; }
14
+ const namespace = 'ChannelsProvider';
15
+ const emitter = require('emitter-io');
16
+ const channelTimeoutHandlers = [];
17
+ const channelInformation = [];
18
+ const channelFunctions = [];
19
+ const handlers = [];
20
+ const connectionChangedHandlers = [];
21
+ const subscribingHandlers = [];
22
+ let client;
56
23
  function compareChannelInfo(ci1, ci2) {
57
24
  if (ci1 !== null) {
58
25
  if (ci2 !== null) {
@@ -60,28 +27,19 @@ function compareChannelInfo(ci1, ci2) {
60
27
  if (ci1.channelName === ci2.channelName) {
61
28
  return true;
62
29
  }
63
-
64
30
  return false;
65
31
  }
66
-
67
32
  return false;
68
33
  }
69
-
70
34
  return false;
71
35
  }
72
-
73
36
  if (ci2 !== null) {
74
37
  return false;
75
38
  }
76
-
77
39
  return true;
78
40
  }
79
-
80
- var _registerHandlers = function registerHandlers(id, handler, connectionChanged, subscribing) {
81
- var existing = handlers.find(function (x) {
82
- return x.id === id;
83
- });
84
-
41
+ const registerHandlers = (id, handler, connectionChanged, subscribing) => {
42
+ const existing = handlers.find(x => x.id === id);
85
43
  if (existing !== undefined) {
86
44
  existing.handler = handler;
87
45
  } else {
@@ -90,12 +48,8 @@ var _registerHandlers = function registerHandlers(id, handler, connectionChanged
90
48
  handler: handler
91
49
  });
92
50
  }
93
-
94
51
  if (connectionChanged) {
95
- var existingConnectionChanged = connectionChangedHandlers.find(function (x) {
96
- return x.id === id;
97
- });
98
-
52
+ const existingConnectionChanged = connectionChangedHandlers.find(x => x.id === id);
99
53
  if (existingConnectionChanged !== undefined) {
100
54
  existingConnectionChanged.handler = connectionChanged;
101
55
  } else {
@@ -105,12 +59,8 @@ var _registerHandlers = function registerHandlers(id, handler, connectionChanged
105
59
  });
106
60
  }
107
61
  }
108
-
109
62
  if (subscribing) {
110
- var existingSubscribing = subscribingHandlers.find(function (x) {
111
- return x.id === id;
112
- });
113
-
63
+ const existingSubscribing = subscribingHandlers.find(x => x.id === id);
114
64
  if (existingSubscribing !== undefined) {
115
65
  existingSubscribing.handler = subscribing;
116
66
  } else {
@@ -121,285 +71,189 @@ var _registerHandlers = function registerHandlers(id, handler, connectionChanged
121
71
  }
122
72
  }
123
73
  };
124
-
125
- var _unregisterHandlers = function unregisterHandlers(id) {
126
- var existing = handlers.find(function (x) {
127
- return x.id === id;
128
- });
129
-
74
+ const unregisterHandlers = id => {
75
+ const existing = handlers.find(x => x.id === id);
130
76
  if (existing !== undefined) {
131
77
  handlers.splice(handlers.indexOf(existing), 1);
132
78
  }
133
-
134
- var existingConnectionChanged = connectionChangedHandlers.find(function (x) {
135
- return x.id === id;
136
- });
137
-
79
+ const existingConnectionChanged = connectionChangedHandlers.find(x => x.id === id);
138
80
  if (existingConnectionChanged !== undefined) {
139
81
  connectionChangedHandlers.splice(connectionChangedHandlers.indexOf(existingConnectionChanged), 1);
140
82
  }
141
-
142
- var existingSubscribing = subscribingHandlers.find(function (x) {
143
- return x.id === id;
144
- });
145
-
83
+ const existingSubscribing = subscribingHandlers.find(x => x.id === id);
146
84
  if (existingSubscribing !== undefined) {
147
85
  subscribingHandlers.splice(subscribingHandlers.indexOf(existingSubscribing), 1);
148
86
  }
149
87
  };
150
-
151
- var _registerChannel = function registerChannel(id, _channelFunction) {
152
- var existing = channelFunctions.find(function (x) {
153
- return x.id === id;
154
- });
155
-
88
+ const registerChannel = (id, channelFunction) => {
89
+ const existing = channelFunctions.find(x => x.id === id);
156
90
  if (existing !== undefined) {
157
- existing.channelFunction = function (data) {
158
- return _channelFunction(data);
159
- };
91
+ existing.channelFunction = data => channelFunction(data);
160
92
  } else {
161
93
  channelFunctions.push({
162
94
  id: id,
163
- channelFunction: function channelFunction(data) {
164
- return _channelFunction(data);
165
- }
95
+ channelFunction: data => channelFunction(data)
166
96
  });
167
97
  }
168
98
  };
169
-
170
- var _isChannelRegistered = function isChannelRegistered(id) {
171
- var existing = channelFunctions.find(function (x) {
172
- return x.id === id;
173
- });
99
+ const isChannelRegistered = id => {
100
+ const existing = channelFunctions.find(x => x.id === id);
174
101
  return existing !== undefined;
175
102
  };
176
-
177
- var clearTimeoutHandler = function clearTimeoutHandler(id) {
178
- var existing = channelTimeoutHandlers.find(function (x) {
179
- return x.id === id;
180
- });
181
-
103
+ const clearTimeoutHandler = id => {
104
+ const existing = channelTimeoutHandlers.find(x => x.id === id);
182
105
  if (existing !== undefined) {
183
106
  clearTimeout(existing.handler);
184
107
  channelTimeoutHandlers.splice(channelTimeoutHandlers.indexOf(existing), 1);
185
108
  }
186
109
  };
187
-
188
- var processMessage = function processMessage(channel, obj) {
189
- handlers.forEach(function (x) {
110
+ const processMessage = (channel, obj) => {
111
+ handlers.forEach(x => {
190
112
  x.handler(channel, obj);
191
113
  });
192
114
  };
193
-
194
- var notifyConnectionChanged = function notifyConnectionChanged(connected) {
195
- connectionChangedHandlers.forEach(function (x) {
115
+ const notifyConnectionChanged = connected => {
116
+ connectionChangedHandlers.forEach(x => {
196
117
  x.handler(connected);
197
118
  });
198
119
  };
199
-
200
- var notifySubscribing = function notifySubscribing(channel) {
201
- subscribingHandlers.forEach(function (x) {
120
+ const notifySubscribing = channel => {
121
+ subscribingHandlers.forEach(x => {
202
122
  x.handler(channel);
203
123
  });
204
124
  };
205
-
206
- var ChannelsProvider = /*#__PURE__*/function (_Component) {
207
- _inherits(ChannelsProvider, _Component);
208
-
209
- var _super = _createSuper(ChannelsProvider);
210
-
211
- function ChannelsProvider(props) {
212
- var _this;
213
-
214
- _classCallCheck(this, ChannelsProvider);
215
-
216
- var methodName = 'constructor()';
217
- _this = _super.call(this, props);
218
- _this.state = {
125
+ class ChannelsProvider extends _react.Component {
126
+ constructor(props) {
127
+ const methodName = 'constructor()';
128
+ super(props);
129
+ this.state = {
219
130
  connected: true
220
131
  };
221
- var urlArray = props.core.baseUrl.split('://');
222
- var modifiedUrl = urlArray[urlArray.length - 1];
132
+ const urlArray = props.core.baseUrl.split('://');
133
+ const modifiedUrl = urlArray[urlArray.length - 1];
223
134
  client = emitter.connect({
224
135
  host: modifiedUrl,
225
136
  port: 9090,
226
- secure: false
137
+ secure: true
227
138
  });
228
- client.on('connect', function (conack) {
229
- _this.props.core.log('system', namespace, methodName, 'Emitter Connect', conack);
230
-
231
- if (_this.state.connected === false) {
232
- _this.resubscribeToChannels();
233
-
234
- _this.setState({
139
+ client.on('connect', conack => {
140
+ this.props.core.log('system', namespace, methodName, 'Emitter Connect', conack);
141
+ if (this.state.connected === false) {
142
+ this.resubscribeToChannels();
143
+ this.setState({
235
144
  connected: true
236
145
  });
237
-
238
146
  notifyConnectionChanged(true);
239
147
  }
240
148
  });
241
- client.on('disconnect', function () {
242
- _this.props.core.log('system', namespace, methodName, 'Emitter Disconnect');
243
-
244
- if (_this.state.connected === true) {
245
- _this.setState({
149
+ client.on('disconnect', () => {
150
+ this.props.core.log('system', namespace, methodName, 'Emitter Disconnect');
151
+ if (this.state.connected === true) {
152
+ this.setState({
246
153
  connected: false
247
154
  });
248
-
249
155
  notifyConnectionChanged(false);
250
156
  }
251
157
  });
252
- client.on('offline', function () {
253
- _this.props.core.log('system', namespace, methodName, 'Emitter Offline');
254
-
255
- if (_this.state.connected === true) {
256
- _this.setState({
158
+ client.on('offline', () => {
159
+ this.props.core.log('system', namespace, methodName, 'Emitter Offline');
160
+ if (this.state.connected === true) {
161
+ this.setState({
257
162
  connected: false
258
163
  });
259
-
260
164
  notifyConnectionChanged(false);
261
165
  }
262
166
  });
263
- client.on('message', function (msg) {
167
+ client.on('message', msg => {
264
168
  processMessage(msg.channel, JSON.parse(msg.asString()));
265
169
  });
266
- client.on('error', function (error) {
267
- _this.props.core.log('error', namespace, methodName, error);
170
+ client.on('error', error => {
171
+ this.props.core.log('error', namespace, methodName, error);
268
172
  });
269
- return _this;
270
173
  }
271
-
272
- _createClass(ChannelsProvider, [{
273
- key: "updateChannel",
274
- value: function updateChannel(id, data) {
275
- var _this2 = this;
276
-
277
- var existing = channelTimeoutHandlers.find(function (x) {
278
- return x.id === id;
174
+ updateChannel(id, data) {
175
+ const existing = channelTimeoutHandlers.find(x => x.id === id);
176
+ if (existing !== undefined) {
177
+ clearTimeout(existing.handler);
178
+ existing.handler = setTimeout(() => {
179
+ this.callChannelFunction(id, data);
180
+ }, 500);
181
+ } else {
182
+ channelTimeoutHandlers.push({
183
+ id: id,
184
+ handler: setTimeout(() => {
185
+ this.callChannelFunction(id, data);
186
+ }, 500)
279
187
  });
280
-
281
- if (existing !== undefined) {
282
- clearTimeout(existing.handler);
283
- existing.handler = setTimeout(function () {
284
- _this2.callChannelFunction(id, data);
285
- }, 500);
286
- } else {
287
- channelTimeoutHandlers.push({
288
- id: id,
289
- handler: setTimeout(function () {
290
- _this2.callChannelFunction(id, data);
291
- }, 500)
292
- });
293
- }
294
188
  }
295
- }, {
296
- key: "callChannelFunction",
297
- value: function callChannelFunction(id, data) {
298
- var _this3 = this;
299
-
300
- var methodName = 'callChannelFunction()';
301
- clearTimeoutHandler(id);
302
- var existingFunction = channelFunctions.find(function (x) {
303
- return x.id === id;
304
- });
305
-
306
- if (existingFunction !== undefined) {
307
- existingFunction.channelFunction(data).then(function (channelInfo) {
308
- if (channelInfo != null) {
309
- var channelInfoChanged = true;
310
- var existingChannelInfo = channelInformation.find(function (x) {
311
- return x.id === id;
312
- });
313
-
314
- if (existingChannelInfo !== undefined) {
315
- if (!compareChannelInfo(channelInfo, existingChannelInfo.channelInfo)) {
316
- _this3.unsubscribe(existingChannelInfo.channelInfo);
317
-
318
- existingChannelInfo.channelInfo = channelInfo;
319
- } else {
320
- channelInfoChanged = false;
321
- }
189
+ }
190
+ callChannelFunction(id, data) {
191
+ const methodName = 'callChannelFunction()';
192
+ clearTimeoutHandler(id);
193
+ const existingFunction = channelFunctions.find(x => x.id === id);
194
+ if (existingFunction !== undefined) {
195
+ existingFunction.channelFunction(data).then(channelInfo => {
196
+ if (channelInfo != null) {
197
+ let channelInfoChanged = true;
198
+ const existingChannelInfo = channelInformation.find(x => x.id === id);
199
+ if (existingChannelInfo !== undefined) {
200
+ if (!compareChannelInfo(channelInfo, existingChannelInfo.channelInfo)) {
201
+ this.unsubscribe(existingChannelInfo.channelInfo);
202
+ existingChannelInfo.channelInfo = channelInfo;
322
203
  } else {
323
- channelInformation.push({
324
- id: id,
325
- channelInfo: channelInfo
326
- });
327
- }
328
-
329
- if (channelInfoChanged) {
330
- _this3.subscribe(channelInfo);
204
+ channelInfoChanged = false;
331
205
  }
206
+ } else {
207
+ channelInformation.push({
208
+ id: id,
209
+ channelInfo: channelInfo
210
+ });
332
211
  }
333
- }).catch(function (error) {
334
- _this3.props.core.log('error', namespace, methodName, error);
335
- });
336
- }
337
- }
338
- }, {
339
- key: "subscribe",
340
- value: function subscribe(channelInfo) {
341
- var methodName = 'subscribe()';
342
- this.props.core.log('system', namespace, methodName, "Subscribing to ".concat(channelInfo.channelName));
343
- client.subscribe({
344
- key: channelInfo.channelKey,
345
- channel: channelInfo.channelName
346
- });
347
- notifySubscribing(channelInfo.channelName);
348
- }
349
- }, {
350
- key: "unsubscribe",
351
- value: function unsubscribe(channelInfo) {
352
- var methodName = 'unsubscribe()';
353
- this.props.core.log('system', namespace, methodName, "Unsubscribing from ".concat(channelInfo.channelName));
354
- client.unsubscribe({
355
- key: channelInfo.channelKey,
356
- channel: channelInfo.channelName
357
- });
358
- }
359
- }, {
360
- key: "resubscribeToChannels",
361
- value: function resubscribeToChannels() {
362
- var _this4 = this;
363
-
364
- channelInformation.forEach(function (item, i) {
365
- _this4.subscribe(item.channelInfo);
366
- });
367
- }
368
- }, {
369
- key: "render",
370
- value: function render() {
371
- var _this5 = this;
372
-
373
- return /*#__PURE__*/_react.default.createElement(_ChannelsContext.default.Provider, {
374
- value: {
375
- unregisterHandlers: function unregisterHandlers(id) {
376
- return _unregisterHandlers(id);
377
- },
378
- isChannelRegistered: function isChannelRegistered(id) {
379
- return _isChannelRegistered(id);
380
- },
381
- updateChannel: function updateChannel(id, data) {
382
- return _this5.updateChannel(id, data);
383
- },
384
- registerHandlers: function registerHandlers(id, handler, connectionChanged, subscribing) {
385
- return _registerHandlers(id, handler, connectionChanged, subscribing);
386
- },
387
- registerChannel: function registerChannel(id, channelFunction) {
388
- return _registerChannel(id, channelFunction);
212
+ if (channelInfoChanged) {
213
+ this.subscribe(channelInfo);
389
214
  }
390
215
  }
391
- }, this.props.children);
216
+ }).catch(error => {
217
+ this.props.core.log('error', namespace, methodName, error);
218
+ });
392
219
  }
393
- }]);
394
-
395
- return ChannelsProvider;
396
- }(_react.Component);
397
-
220
+ }
221
+ subscribe(channelInfo) {
222
+ const methodName = 'subscribe()';
223
+ this.props.core.log('system', namespace, methodName, "Subscribing to ".concat(channelInfo.channelName));
224
+ client.subscribe({
225
+ key: channelInfo.channelKey,
226
+ channel: channelInfo.channelName
227
+ });
228
+ notifySubscribing(channelInfo.channelName);
229
+ }
230
+ unsubscribe(channelInfo) {
231
+ const methodName = 'unsubscribe()';
232
+ this.props.core.log('system', namespace, methodName, "Unsubscribing from ".concat(channelInfo.channelName));
233
+ client.unsubscribe({
234
+ key: channelInfo.channelKey,
235
+ channel: channelInfo.channelName
236
+ });
237
+ }
238
+ resubscribeToChannels() {
239
+ channelInformation.forEach((item, i) => {
240
+ this.subscribe(item.channelInfo);
241
+ });
242
+ }
243
+ render() {
244
+ return /*#__PURE__*/_react.default.createElement(_ChannelsContext.default.Provider, {
245
+ value: {
246
+ unregisterHandlers: id => unregisterHandlers(id),
247
+ isChannelRegistered: id => isChannelRegistered(id),
248
+ updateChannel: (id, data) => this.updateChannel(id, data),
249
+ registerHandlers: (id, handler, connectionChanged, subscribing) => registerHandlers(id, handler, connectionChanged, subscribing),
250
+ registerChannel: (id, channelFunction) => registerChannel(id, channelFunction)
251
+ }
252
+ }, console.log('-------------------- We are here'), this.props.children);
253
+ }
254
+ }
398
255
  ChannelsProvider.propTypes = {
399
256
  children: _propTypes.default.node.isRequired,
400
257
  core: _propTypes.default.shape().isRequired
401
258
  };
402
-
403
- var _default = (0, _withCore.default)(ChannelsProvider);
404
-
405
- exports.default = _default;
259
+ var _default = exports.default = (0, _withCore.default)(ChannelsProvider);