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,43 +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 _OrganizationChannel = _interopRequireDefault(require("./OrganizationChannel"));
10
- var _EveryoneChannel = _interopRequireDefault(require("./EveryoneChannel"));
11
- var _EntityChannel = _interopRequireDefault(require("./EntityChannel"));
12
- var _withChannels = _interopRequireDefault(require("./withChannels"));
13
- var _UserChannel = _interopRequireDefault(require("./UserChannel"));
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);
20
- }
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
- }
28
- ChannelsConsumer.propTypes = {
29
- children: _propTypes.default.node,
30
- id: _propTypes.default.string.isRequired,
31
- handler: _propTypes.default.func.isRequired,
32
- connectionChanged: _propTypes.default.func,
33
- subscribing: _propTypes.default.func,
34
- addDefaultChannels: _propTypes.default.bool,
35
- channels: _propTypes.default.objectOf(_propTypes.default.func).isRequired
36
- };
37
- ChannelsConsumer.defaultProps = {
38
- connectionChanged: null,
39
- subscribing: null,
40
- addDefaultChannels: true,
41
- children: null
42
- };
43
- var _default = exports.default = (0, _withChannels.default)(ChannelsConsumer);
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
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,261 +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 _ChannelsContext = _interopRequireDefault(require("./ChannelsContext"));
10
- var _withCore = _interopRequireDefault(require("../Core/withCore"));
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;
23
- function compareChannelInfo(ci1, ci2) {
24
- if (ci1 !== null) {
25
- if (ci2 !== null) {
26
- if (ci1.channelKey === ci2.channelKey) {
27
- if (ci1.channelName === ci2.channelName) {
28
- return true;
29
- }
30
- return false;
31
- }
32
- return false;
33
- }
34
- return false;
35
- }
36
- if (ci2 !== null) {
37
- return false;
38
- }
39
- return true;
40
- }
41
- const registerHandlers = (id, handler, connectionChanged, subscribing) => {
42
- const existing = handlers.find(x => x.id === id);
43
- if (existing !== undefined) {
44
- existing.handler = handler;
45
- } else {
46
- handlers.push({
47
- id: id,
48
- handler: handler
49
- });
50
- }
51
- if (connectionChanged) {
52
- const existingConnectionChanged = connectionChangedHandlers.find(x => x.id === id);
53
- if (existingConnectionChanged !== undefined) {
54
- existingConnectionChanged.handler = connectionChanged;
55
- } else {
56
- connectionChangedHandlers.push({
57
- id: id,
58
- handler: connectionChanged
59
- });
60
- }
61
- }
62
- if (subscribing) {
63
- const existingSubscribing = subscribingHandlers.find(x => x.id === id);
64
- if (existingSubscribing !== undefined) {
65
- existingSubscribing.handler = subscribing;
66
- } else {
67
- subscribingHandlers.push({
68
- id: id,
69
- handler: subscribing
70
- });
71
- }
72
- }
73
- };
74
- const unregisterHandlers = id => {
75
- const existing = handlers.find(x => x.id === id);
76
- if (existing !== undefined) {
77
- handlers.splice(handlers.indexOf(existing), 1);
78
- }
79
- const existingConnectionChanged = connectionChangedHandlers.find(x => x.id === id);
80
- if (existingConnectionChanged !== undefined) {
81
- connectionChangedHandlers.splice(connectionChangedHandlers.indexOf(existingConnectionChanged), 1);
82
- }
83
- const existingSubscribing = subscribingHandlers.find(x => x.id === id);
84
- if (existingSubscribing !== undefined) {
85
- subscribingHandlers.splice(subscribingHandlers.indexOf(existingSubscribing), 1);
86
- }
87
- };
88
- const registerChannel = (id, channelFunction) => {
89
- const existing = channelFunctions.find(x => x.id === id);
90
- if (existing !== undefined) {
91
- existing.channelFunction = data => channelFunction(data);
92
- } else {
93
- channelFunctions.push({
94
- id: id,
95
- channelFunction: data => channelFunction(data)
96
- });
97
- }
98
- };
99
- const isChannelRegistered = id => {
100
- const existing = channelFunctions.find(x => x.id === id);
101
- return existing !== undefined;
102
- };
103
- const clearTimeoutHandler = id => {
104
- const existing = channelTimeoutHandlers.find(x => x.id === id);
105
- if (existing !== undefined) {
106
- clearTimeout(existing.handler);
107
- channelTimeoutHandlers.splice(channelTimeoutHandlers.indexOf(existing), 1);
108
- }
109
- };
110
- const processMessage = (channel, obj) => {
111
- handlers.forEach(x => {
112
- x.handler(channel, obj);
113
- });
114
- };
115
- const notifyConnectionChanged = connected => {
116
- connectionChangedHandlers.forEach(x => {
117
- x.handler(connected);
118
- });
119
- };
120
- const notifySubscribing = channel => {
121
- subscribingHandlers.forEach(x => {
122
- x.handler(channel);
123
- });
124
- };
125
- class ChannelsProvider extends _react.Component {
126
- constructor(props) {
127
- const methodName = 'constructor()';
128
- super(props);
129
- this.state = {
130
- connected: true
131
- };
132
- const urlArray = props.core.baseUrl.split('://');
133
- const protocol = urlArray[0];
134
- const modifiedUrl = urlArray[urlArray.length - 1];
135
- const isSecure = protocol === 'https';
136
- client = emitter.connect({
137
- host: modifiedUrl,
138
- port: 9090,
139
- secure: isSecure
140
- });
141
- client.on('connect', conack => {
142
- this.props.core.log('system', namespace, methodName, 'Emitter Connect', conack);
143
- if (this.state.connected === false) {
144
- this.resubscribeToChannels();
145
- this.setState({
146
- connected: true
147
- });
148
- notifyConnectionChanged(true);
149
- }
150
- });
151
- client.on('disconnect', () => {
152
- this.props.core.log('system', namespace, methodName, 'Emitter Disconnect');
153
- if (this.state.connected === true) {
154
- this.setState({
155
- connected: false
156
- });
157
- notifyConnectionChanged(false);
158
- }
159
- });
160
- client.on('offline', () => {
161
- this.props.core.log('system', namespace, methodName, 'Emitter Offline');
162
- if (this.state.connected === true) {
163
- this.setState({
164
- connected: false
165
- });
166
- notifyConnectionChanged(false);
167
- }
168
- });
169
- client.on('message', msg => {
170
- processMessage(msg.channel, JSON.parse(msg.asString()));
171
- });
172
- client.on('error', error => {
173
- this.props.core.log('error', namespace, methodName, error);
174
- });
175
- }
176
- updateChannel(id, data) {
177
- const existing = channelTimeoutHandlers.find(x => x.id === id);
178
- if (existing !== undefined) {
179
- clearTimeout(existing.handler);
180
- existing.handler = setTimeout(() => {
181
- this.callChannelFunction(id, data);
182
- }, 500);
183
- } else {
184
- channelTimeoutHandlers.push({
185
- id: id,
186
- handler: setTimeout(() => {
187
- this.callChannelFunction(id, data);
188
- }, 500)
189
- });
190
- }
191
- }
192
- callChannelFunction(id, data) {
193
- const methodName = 'callChannelFunction()';
194
- clearTimeoutHandler(id);
195
- const existingFunction = channelFunctions.find(x => x.id === id);
196
- if (existingFunction !== undefined) {
197
- existingFunction.channelFunction(data).then(channelInfo => {
198
- if (channelInfo != null) {
199
- let channelInfoChanged = true;
200
- const existingChannelInfo = channelInformation.find(x => x.id === id);
201
- if (existingChannelInfo !== undefined) {
202
- if (!compareChannelInfo(channelInfo, existingChannelInfo.channelInfo)) {
203
- this.unsubscribe(existingChannelInfo.channelInfo);
204
- existingChannelInfo.channelInfo = channelInfo;
205
- } else {
206
- channelInfoChanged = false;
207
- }
208
- } else {
209
- channelInformation.push({
210
- id: id,
211
- channelInfo: channelInfo
212
- });
213
- }
214
- if (channelInfoChanged) {
215
- this.subscribe(channelInfo);
216
- }
217
- }
218
- }).catch(error => {
219
- this.props.core.log('error', namespace, methodName, error);
220
- });
221
- }
222
- }
223
- subscribe(channelInfo) {
224
- const methodName = 'subscribe()';
225
- this.props.core.log('system', namespace, methodName, "Subscribing to ".concat(channelInfo.channelName));
226
- client.subscribe({
227
- key: channelInfo.channelKey,
228
- channel: channelInfo.channelName
229
- });
230
- notifySubscribing(channelInfo.channelName);
231
- }
232
- unsubscribe(channelInfo) {
233
- const methodName = 'unsubscribe()';
234
- this.props.core.log('system', namespace, methodName, "Unsubscribing from ".concat(channelInfo.channelName));
235
- client.unsubscribe({
236
- key: channelInfo.channelKey,
237
- channel: channelInfo.channelName
238
- });
239
- }
240
- resubscribeToChannels() {
241
- channelInformation.forEach((item, i) => {
242
- this.subscribe(item.channelInfo);
243
- });
244
- }
245
- render() {
246
- return /*#__PURE__*/_react.default.createElement(_ChannelsContext.default.Provider, {
247
- value: {
248
- unregisterHandlers: id => unregisterHandlers(id),
249
- isChannelRegistered: id => isChannelRegistered(id),
250
- updateChannel: (id, data) => this.updateChannel(id, data),
251
- registerHandlers: (id, handler, connectionChanged, subscribing) => registerHandlers(id, handler, connectionChanged, subscribing),
252
- registerChannel: (id, channelFunction) => registerChannel(id, channelFunction)
253
- }
254
- }, this.props.children);
255
- }
256
- }
257
- ChannelsProvider.propTypes = {
258
- children: _propTypes.default.node.isRequired,
259
- core: _propTypes.default.shape().isRequired
260
- };
261
- var _default = exports.default = (0, _withCore.default)(ChannelsProvider);
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _withAuthentication = _interopRequireDefault(require("../Authentication/withAuthentication"));
10
- var _withOrganization = _interopRequireDefault(require("../Organization/withOrganization"));
11
- var _withChannels = _interopRequireDefault(require("./withChannels"));
12
- var _withCore = _interopRequireDefault(require("../Core/withCore"));
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- const namespace = 'DataChannel';
15
- const channelId = 'data';
16
- class DataChannel extends _react.Component {
17
- componentDidMount() {
18
- if (!this.props.channels.isChannelRegistered(channelId)) {
19
- this.props.channels.registerChannel(channelId, data => this.channelFunction(data));
20
- if (this.props.organization.entity !== null) {
21
- this.props.channels.updateChannel(channelId, {
22
- entityId: this.props.organization.entity.id
23
- });
24
- }
25
- }
26
- }
27
- componentDidUpdate(prevProps) {
28
- if (this.props.organization.entity !== prevProps.organization.entity) {
29
- this.props.channels.updateChannel(channelId, {
30
- entityId: this.props.organization.entity.id
31
- });
32
- }
33
- }
34
- channelFunction(data) {
35
- const methodName = 'channelFunction()';
36
- return new Promise((resolve, reject) => {
37
- if (this.props.authentication.authenticated) {
38
- this.props.authentication.http({
39
- method: 'get',
40
- url: "".concat(this.props.core.baseUrl, "/api/data/subscribe/").concat(data.entityId)
41
- }).then(results => {
42
- resolve(results.data);
43
- }).catch(error => {
44
- this.props.core.log('error', namespace, methodName, error);
45
- reject(error);
46
- });
47
- } else {
48
- reject(new Error({
49
- message: 'Not Authenticated'
50
- }));
51
- }
52
- });
53
- }
54
- render() {
55
- return '';
56
- }
57
- }
58
- DataChannel.propTypes = {
59
- core: _propTypes.default.shape().isRequired,
60
- organization: _propTypes.default.shape().isRequired,
61
- authentication: _propTypes.default.shape().isRequired,
62
- channels: _propTypes.default.shape({
63
- updateChannel: _propTypes.default.func,
64
- registerChannel: _propTypes.default.func,
65
- isChannelRegistered: _propTypes.default.func
66
- }).isRequired
67
- };
68
- var _default = exports.default = (0, _withChannels.default)((0, _withCore.default)((0, _withAuthentication.default)((0, _withOrganization.default)(DataChannel))));
@@ -1,69 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _withAuthentication = _interopRequireDefault(require("../Authentication/withAuthentication"));
10
- var _withOrganization = _interopRequireDefault(require("../Organization/withOrganization"));
11
- var _withChannels = _interopRequireDefault(require("./withChannels"));
12
- var _withCore = _interopRequireDefault(require("../Core/withCore"));
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- const namespace = 'EntityChannel';
15
- const channelId = 'entity';
16
- class EntityChannel extends _react.Component {
17
- componentDidMount() {
18
- if (!this.props.channels.isChannelRegistered(channelId)) {
19
- this.props.channels.registerChannel(channelId, data => this.channelFunction(data));
20
- if (this.props.organization.entity !== null) {
21
- this.props.channels.updateChannel(channelId, {
22
- entityId: this.props.organization.entity.id
23
- });
24
- }
25
- }
26
- }
27
- componentDidUpdate(prevProps) {
28
- if (this.props.organization.entity !== prevProps.organization.entity) {
29
- this.props.channels.updateChannel(channelId, {
30
- entityId: this.props.organization.entity.id
31
- });
32
- }
33
- }
34
- channelFunction(data) {
35
- const methodName = 'channelFunction()';
36
- return new Promise((resolve, reject) => {
37
- if (this.props.authentication.authenticated) {
38
- this.props.authentication.http({
39
- method: 'get',
40
- url: "".concat(this.props.core.baseUrl, "/api/administration/entities/subscribe"),
41
- params: data
42
- }).then(results => {
43
- resolve(results.data);
44
- }).catch(error => {
45
- this.props.core.log('error', namespace, methodName, error);
46
- reject(error);
47
- });
48
- } else {
49
- reject(new Error({
50
- message: 'Not Authenticated'
51
- }));
52
- }
53
- });
54
- }
55
- render() {
56
- return '';
57
- }
58
- }
59
- EntityChannel.propTypes = {
60
- core: _propTypes.default.shape().isRequired,
61
- organization: _propTypes.default.shape().isRequired,
62
- authentication: _propTypes.default.shape().isRequired,
63
- channels: _propTypes.default.shape({
64
- updateChannel: _propTypes.default.func,
65
- registerChannel: _propTypes.default.func,
66
- isChannelRegistered: _propTypes.default.func
67
- }).isRequired
68
- };
69
- var _default = exports.default = (0, _withChannels.default)((0, _withCore.default)((0, _withAuthentication.default)((0, _withOrganization.default)(EntityChannel))));
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _withAuthentication = _interopRequireDefault(require("../Authentication/withAuthentication"));
10
- var _withChannels = _interopRequireDefault(require("./withChannels"));
11
- var _withCore = _interopRequireDefault(require("../Core/withCore"));
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- const namespace = 'EveryoneChannel';
14
- const channelId = 'everyone';
15
- class EveryoneChannel extends _react.Component {
16
- componentDidMount() {
17
- if (!this.props.channels.isChannelRegistered(channelId)) {
18
- this.props.channels.registerChannel(channelId, data => this.channelFunction(data));
19
- this.props.channels.updateChannel(channelId, null);
20
- }
21
- }
22
- channelFunction() {
23
- const methodName = 'channelFunction()';
24
- return new Promise((resolve, reject) => {
25
- if (this.props.authentication.authenticated) {
26
- this.props.authentication.http({
27
- method: 'get',
28
- url: "".concat(this.props.core.baseUrl, "/api/administration/everyone/subscribe")
29
- }).then(results => {
30
- resolve(results.data);
31
- }).catch(error => {
32
- this.props.core.log('error', namespace, methodName, error);
33
- reject(error);
34
- });
35
- } else {
36
- reject(new Error({
37
- message: 'Not Authenticated'
38
- }));
39
- }
40
- });
41
- }
42
- render() {
43
- return '';
44
- }
45
- }
46
- EveryoneChannel.propTypes = {
47
- core: _propTypes.default.shape().isRequired,
48
- authentication: _propTypes.default.shape().isRequired,
49
- channels: _propTypes.default.shape({
50
- updateChannel: _propTypes.default.func,
51
- registerChannel: _propTypes.default.func,
52
- isChannelRegistered: _propTypes.default.func
53
- }).isRequired
54
- };
55
- var _default = exports.default = (0, _withChannels.default)((0, _withAuthentication.default)((0, _withCore.default)(EveryoneChannel)));
@@ -1,69 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _withAuthentication = _interopRequireDefault(require("../Authentication/withAuthentication"));
10
- var _withOrganization = _interopRequireDefault(require("../Organization/withOrganization"));
11
- var _withChannels = _interopRequireDefault(require("./withChannels"));
12
- var _withCore = _interopRequireDefault(require("../Core/withCore"));
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- const namespace = 'OrganizationChannel';
15
- const channelId = 'organization';
16
- class OrganizationChannel extends _react.Component {
17
- componentDidMount() {
18
- if (!this.props.channels.isChannelRegistered(channelId)) {
19
- this.props.channels.registerChannel(channelId, data => this.channelFunction(data));
20
- if (this.props.organization.organization !== null) {
21
- this.props.channels.updateChannel(channelId, {
22
- organizationId: this.props.organization.organization.id
23
- });
24
- }
25
- }
26
- }
27
- componentDidUpdate(prevProps) {
28
- if (this.props.organization.organization !== prevProps.organization.organization) {
29
- this.props.channels.updateChannel(channelId, {
30
- organizationId: this.props.organization.organization.id
31
- });
32
- }
33
- }
34
- channelFunction(data) {
35
- const methodName = 'channelFunction()';
36
- return new Promise((resolve, reject) => {
37
- if (this.props.authentication.authenticated) {
38
- this.props.authentication.http({
39
- method: 'get',
40
- url: "".concat(this.props.core.baseUrl, "/api/administration/organizations/subscribe"),
41
- params: data
42
- }).then(results => {
43
- resolve(results.data);
44
- }).catch(error => {
45
- this.props.core.log('error', namespace, methodName, error);
46
- reject(error);
47
- });
48
- } else {
49
- reject(new Error({
50
- message: 'Not Authenticated'
51
- }));
52
- }
53
- });
54
- }
55
- render() {
56
- return '';
57
- }
58
- }
59
- OrganizationChannel.propTypes = {
60
- core: _propTypes.default.shape().isRequired,
61
- organization: _propTypes.default.shape().isRequired,
62
- authentication: _propTypes.default.shape().isRequired,
63
- channels: _propTypes.default.shape({
64
- updateChannel: _propTypes.default.func,
65
- registerChannel: _propTypes.default.func,
66
- isChannelRegistered: _propTypes.default.func
67
- }).isRequired
68
- };
69
- var _default = exports.default = (0, _withChannels.default)((0, _withCore.default)((0, _withAuthentication.default)((0, _withOrganization.default)(OrganizationChannel))));
@@ -1,52 +0,0 @@
1
- # Channels Context
2
-
3
- This adds the capability to communicate with emitter channels. Typically implemented by adding [CoreWrapper](../../components/CoreWrapper) though it can be added by adding ChannelsProvider directly.
4
-
5
- To utilize this you need to add ChannelsConsumer to your component:
6
-
7
- ```
8
- processMessage(channel, obj) {
9
- if (obj.what !== undefined) {
10
- if (obj.what === 'package_enabled') {
11
- this.refreshPackages();
12
- }
13
- }
14
- }
15
-
16
- connectionChanged(connected) {
17
- if (connected) {
18
- console.log('We are connected');
19
- } else {
20
- console.log('We are disconnected');
21
- }
22
- }
23
-
24
- render() {
25
- return (
26
- <div>
27
- <ChannelsConsumer
28
- id="mycomponent"
29
- handler={(channel, obj) => this.processMessage(channel, obj)}
30
- connectionChanged={connected => this.connectionChanged(connected)}
31
- addDefaultChannels
32
- />
33
- </div>
34
- );
35
- }
36
- ```
37
-
38
- ## ChannelConsumer Props
39
- - id : This is a unique id inside your application to represent your component. It is used to map handlers.
40
- - handler : This is function that is called when something is received on a channel.
41
- - connectionChanged : This is a function that is called when the connection changed. NOTE: It is not called initially. Assume that we started connected. It will notify when the connection is dropped and re-connected.
42
- - addDefaultChannels : If true (default), adds the default channels: EveryoneChannel, UserChannel, OrganizationChannel, EntityChannel
43
-
44
- ## Available functions
45
- These are functions available once adding HOC withChannels to your application. These are typically only used inside a Channel component. Most application components should be using a Channel component to speak to a channel.
46
-
47
- ### registerHandlers(id, handler, connectionChanged)
48
- ### unregisterHandlers(id)
49
- ### registerChannel(id, channelFunction)
50
- ### updateChannel(id, data)
51
- ### isChannelRegistered(id)
52
-