versacall-core-library-react 2.0.32 → 2.0.36
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.
- package/dist/components/CoreSideBar/CoreSideBarDrawer.js +3 -1
- package/dist/components/CoreTimerInput/CoreTimerInput.js +120 -63
- package/dist/components/CoreTimerInput/CoreTimerInputOld.js +162 -0
- package/dist/components/CoreToolbar/CoreToolbar.js +5 -2
- package/dist/context/Channels/ChannelsConsumer.js +3 -1
- package/dist/context/Channels/ChannelsProvider.js +36 -5
- package/package.json +2 -2
|
@@ -37,6 +37,8 @@ var _functions = require("../../functions");
|
|
|
37
37
|
|
|
38
38
|
var _context = require("../../context");
|
|
39
39
|
|
|
40
|
+
var _scrollbarModule = _interopRequireDefault(require("../../css/scrollbar.module.css"));
|
|
41
|
+
|
|
40
42
|
require("../../css/scrollbar.css");
|
|
41
43
|
|
|
42
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -161,7 +163,7 @@ function (_Component) {
|
|
|
161
163
|
return _react.default.createElement(_Drawer.default, {
|
|
162
164
|
open: open,
|
|
163
165
|
classes: {
|
|
164
|
-
paper: classes.drawerPaper
|
|
166
|
+
paper: "".concat(classes.drawerPaper, " ").concat(_scrollbarModule.default.scroll, " ").concat(_scrollbarModule.default.white)
|
|
165
167
|
},
|
|
166
168
|
onClose: function onClose() {
|
|
167
169
|
return _this3.props.onClose();
|
|
@@ -7,9 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
10
|
+
var _InputBase = _interopRequireDefault(require("@material-ui/core/InputBase"));
|
|
13
11
|
|
|
14
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
13
|
|
|
@@ -19,12 +17,49 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
19
17
|
|
|
20
18
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
19
|
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
var muiStyle = {
|
|
21
|
+
styleBox: {
|
|
22
|
+
position: 'relative',
|
|
23
|
+
borderStyle: 'solid',
|
|
24
|
+
borderWidth: 1,
|
|
25
|
+
borderColor: 'rgba(0, 0, 0, 0.23)',
|
|
26
|
+
borderRadius: 4,
|
|
27
|
+
paddingTop: 11,
|
|
28
|
+
paddingBottom: 11,
|
|
29
|
+
paddingLeft: 10 // padding: 10,
|
|
30
|
+
|
|
31
|
+
},
|
|
32
|
+
label: {
|
|
33
|
+
fontSize: '1rem',
|
|
34
|
+
padding: 0,
|
|
35
|
+
paddingLeft: 6,
|
|
36
|
+
paddingRight: 6,
|
|
37
|
+
lineHeight: 1,
|
|
38
|
+
zIndex: 1,
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
top: 0,
|
|
41
|
+
left: 0,
|
|
42
|
+
transformOrigin: 'top left',
|
|
43
|
+
transform: 'translate(8px, -6px) scale(0.75)',
|
|
44
|
+
backgroundColor: 'white',
|
|
45
|
+
color: 'rgba(0, 0, 0, 0.6)'
|
|
46
|
+
},
|
|
47
|
+
unitLabel: {
|
|
48
|
+
marginRight: 10,
|
|
49
|
+
color: 'rgba(0, 0, 0, 0.4)',
|
|
50
|
+
fontSize: 'smaller'
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
function CoreTimerInput(props) {
|
|
55
|
+
var label = props.label,
|
|
56
|
+
time = props.time,
|
|
57
|
+
handleUpdateTime = props.handleUpdateTime,
|
|
58
|
+
showSeconds = props.showSeconds,
|
|
59
|
+
showMinutes = props.showMinutes,
|
|
60
|
+
showHours = props.showHours,
|
|
61
|
+
margin = props.margin,
|
|
62
|
+
style = props.style;
|
|
28
63
|
var hours = 0;
|
|
29
64
|
var min = 0;
|
|
30
65
|
var sec = time;
|
|
@@ -66,96 +101,118 @@ var CoreTimerInput = function CoreTimerInput(_ref) {
|
|
|
66
101
|
return handleUpdateTime(Math.abs(newTime));
|
|
67
102
|
};
|
|
68
103
|
|
|
69
|
-
|
|
70
|
-
|
|
104
|
+
function formatValue(value) {
|
|
105
|
+
var str = value.toString();
|
|
106
|
+
|
|
107
|
+
if (str.length === 1) {
|
|
108
|
+
return "0".concat(str);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return str;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function getMarginStyle() {
|
|
115
|
+
if (margin === 'normal') {
|
|
116
|
+
return {
|
|
117
|
+
marginTop: 16,
|
|
118
|
+
marginBottom: 8
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (margin === 'dense') {
|
|
123
|
+
return {
|
|
124
|
+
paddingTop: 3,
|
|
125
|
+
paddingBottom: 3,
|
|
126
|
+
marginTop: 8,
|
|
127
|
+
marginBottom: 4
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return {};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return _react.default.createElement("div", {
|
|
135
|
+
style: _objectSpread({}, muiStyle.styleBox, getMarginStyle(), style)
|
|
136
|
+
}, label && _react.default.createElement("span", {
|
|
137
|
+
style: muiStyle.label
|
|
138
|
+
}, label), _react.default.createElement("span", {
|
|
139
|
+
style: {
|
|
71
140
|
display: 'flex',
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}, showHours && _react.default.createElement(
|
|
141
|
+
alignItems: 'center'
|
|
142
|
+
}
|
|
143
|
+
}, showHours && _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("span", {
|
|
144
|
+
style: muiStyle.unitLabel
|
|
145
|
+
}, "H"), _react.default.createElement("div", {
|
|
146
|
+
style: {
|
|
147
|
+
flexGrow: 1,
|
|
148
|
+
paddingRight: 10
|
|
149
|
+
}
|
|
150
|
+
}, _react.default.createElement(_InputBase.default, {
|
|
75
151
|
id: "hoursInput",
|
|
76
|
-
value: hours,
|
|
152
|
+
value: formatValue(hours),
|
|
77
153
|
onChange: function onChange(event) {
|
|
78
154
|
return handleChange(event.target.value, 'hours');
|
|
79
155
|
},
|
|
80
156
|
type: "number",
|
|
81
|
-
style: {
|
|
82
|
-
width: '32%'
|
|
83
|
-
},
|
|
84
|
-
InputLabelProps: {
|
|
85
|
-
shrink: true
|
|
86
|
-
},
|
|
87
|
-
InputProps: {
|
|
88
|
-
startAdornment: _react.default.createElement(_InputAdornment.default, {
|
|
89
|
-
position: "start"
|
|
90
|
-
}, "H")
|
|
91
|
-
},
|
|
92
157
|
inputProps: {
|
|
93
158
|
min: '0'
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}), _react.default.createElement(
|
|
159
|
+
}
|
|
160
|
+
}))), showMinutes && _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("span", {
|
|
161
|
+
style: muiStyle.unitLabel
|
|
162
|
+
}, "M"), _react.default.createElement("div", {
|
|
163
|
+
style: {
|
|
164
|
+
flexGrow: 1,
|
|
165
|
+
paddingRight: 10
|
|
166
|
+
}
|
|
167
|
+
}, _react.default.createElement(_InputBase.default, {
|
|
98
168
|
id: "minutesInput",
|
|
99
|
-
value: min,
|
|
169
|
+
value: formatValue(min),
|
|
100
170
|
onChange: function onChange(event) {
|
|
101
171
|
return handleChange(event.target.value, 'min');
|
|
102
172
|
},
|
|
103
173
|
type: "number",
|
|
104
|
-
style: {
|
|
105
|
-
width: '32%'
|
|
106
|
-
},
|
|
107
|
-
InputLabelProps: {
|
|
108
|
-
shrink: true
|
|
109
|
-
},
|
|
110
|
-
InputProps: {
|
|
111
|
-
startAdornment: _react.default.createElement(_InputAdornment.default, {
|
|
112
|
-
position: "start"
|
|
113
|
-
}, "M")
|
|
114
|
-
},
|
|
115
174
|
inputProps: {
|
|
116
175
|
min: '0'
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}),
|
|
176
|
+
}
|
|
177
|
+
}))), showSeconds && _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("span", {
|
|
178
|
+
style: muiStyle.unitLabel
|
|
179
|
+
}, "S"), _react.default.createElement("div", {
|
|
180
|
+
style: {
|
|
181
|
+
flexGrow: 1,
|
|
182
|
+
paddingRight: 10
|
|
183
|
+
}
|
|
184
|
+
}, _react.default.createElement(_InputBase.default, {
|
|
121
185
|
id: "secondsInput",
|
|
122
|
-
value: sec,
|
|
186
|
+
value: formatValue(sec),
|
|
123
187
|
onChange: function onChange(event) {
|
|
124
188
|
return handleChange(event.target.value, 'sec');
|
|
125
189
|
},
|
|
126
190
|
type: "number",
|
|
127
|
-
style: {
|
|
128
|
-
width: '32%'
|
|
129
|
-
},
|
|
130
|
-
InputLabelProps: {
|
|
131
|
-
shrink: true
|
|
132
|
-
},
|
|
133
|
-
InputProps: {
|
|
134
|
-
startAdornment: _react.default.createElement(_InputAdornment.default, {
|
|
135
|
-
position: "start"
|
|
136
|
-
}, "S")
|
|
137
|
-
},
|
|
138
191
|
inputProps: {
|
|
139
192
|
min: '0'
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
variant: "outlined"
|
|
143
|
-
})); // should take prop for time in seconds
|
|
193
|
+
}
|
|
194
|
+
}))))); // should take prop for time in seconds
|
|
144
195
|
// should take a handleChange function
|
|
145
196
|
// pull the event target value and then update the time with that * seconds
|
|
146
197
|
// might wanna move this coreLibrary after
|
|
147
|
-
}
|
|
198
|
+
}
|
|
148
199
|
|
|
149
200
|
CoreTimerInput.propTypes = {
|
|
201
|
+
label: _propTypes.default.string,
|
|
150
202
|
time: _propTypes.default.number.isRequired,
|
|
151
203
|
handleUpdateTime: _propTypes.default.func.isRequired,
|
|
152
204
|
showSeconds: _propTypes.default.bool,
|
|
205
|
+
showMinutes: _propTypes.default.bool,
|
|
153
206
|
showHours: _propTypes.default.bool,
|
|
207
|
+
margin: _propTypes.default.string,
|
|
154
208
|
style: _propTypes.default.objectOf(_propTypes.default.string)
|
|
155
209
|
};
|
|
156
210
|
CoreTimerInput.defaultProps = {
|
|
211
|
+
label: null,
|
|
157
212
|
showSeconds: true,
|
|
213
|
+
showMinutes: true,
|
|
158
214
|
showHours: true,
|
|
215
|
+
margin: 'none',
|
|
159
216
|
style: {}
|
|
160
217
|
};
|
|
161
218
|
var _default = CoreTimerInput;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _InputAdornment = _interopRequireDefault(require("@material-ui/core/InputAdornment"));
|
|
11
|
+
|
|
12
|
+
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
19
|
+
|
|
20
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
|
|
22
|
+
var CoreTimerInputOld = function CoreTimerInputOld(_ref) {
|
|
23
|
+
var time = _ref.time,
|
|
24
|
+
handleUpdateTime = _ref.handleUpdateTime,
|
|
25
|
+
showSeconds = _ref.showSeconds,
|
|
26
|
+
showHours = _ref.showHours,
|
|
27
|
+
style = _ref.style;
|
|
28
|
+
var hours = 0;
|
|
29
|
+
var min = 0;
|
|
30
|
+
var sec = time;
|
|
31
|
+
|
|
32
|
+
var getTime = function getTime() {
|
|
33
|
+
hours = Math.floor(sec / 3600);
|
|
34
|
+
sec -= hours * 3600;
|
|
35
|
+
min = Math.floor(sec / 60);
|
|
36
|
+
sec -= min * 60;
|
|
37
|
+
}; // 1000
|
|
38
|
+
// divde by 360 get 2.777
|
|
39
|
+
// math.floor(2.7) = hours
|
|
40
|
+
// 1000 - hours * 360
|
|
41
|
+
// 280 divide by 60 get 4.6
|
|
42
|
+
// math.floor(4.6) = min
|
|
43
|
+
// 280 - min * 60 = seconds
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
getTime();
|
|
47
|
+
|
|
48
|
+
var handleChange = function handleChange(value, type) {
|
|
49
|
+
var newTime = time;
|
|
50
|
+
|
|
51
|
+
if (type === 'hours' && value < 24) {
|
|
52
|
+
newTime -= hours * 3600;
|
|
53
|
+
newTime += 3600 * value;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (type === 'min' && value < 60) {
|
|
57
|
+
newTime -= min * 60;
|
|
58
|
+
newTime += 60 * value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (type === 'sec' && value < 60) {
|
|
62
|
+
newTime -= sec;
|
|
63
|
+
newTime += 1 * value; // added the 1 to convert value to int
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return handleUpdateTime(Math.abs(newTime));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return _react.default.createElement("span", {
|
|
70
|
+
style: _objectSpread({
|
|
71
|
+
display: 'flex',
|
|
72
|
+
justifyContent: 'space-between'
|
|
73
|
+
}, style)
|
|
74
|
+
}, showHours && _react.default.createElement(_TextField.default, {
|
|
75
|
+
id: "hoursInput",
|
|
76
|
+
value: hours,
|
|
77
|
+
onChange: function onChange(event) {
|
|
78
|
+
return handleChange(event.target.value, 'hours');
|
|
79
|
+
},
|
|
80
|
+
type: "number",
|
|
81
|
+
style: {
|
|
82
|
+
width: '32%'
|
|
83
|
+
},
|
|
84
|
+
InputLabelProps: {
|
|
85
|
+
shrink: true
|
|
86
|
+
},
|
|
87
|
+
InputProps: {
|
|
88
|
+
startAdornment: _react.default.createElement(_InputAdornment.default, {
|
|
89
|
+
position: "start"
|
|
90
|
+
}, "H")
|
|
91
|
+
},
|
|
92
|
+
inputProps: {
|
|
93
|
+
min: '0'
|
|
94
|
+
},
|
|
95
|
+
margin: "normal",
|
|
96
|
+
variant: "outlined"
|
|
97
|
+
}), _react.default.createElement(_TextField.default, {
|
|
98
|
+
id: "minutesInput",
|
|
99
|
+
value: min,
|
|
100
|
+
onChange: function onChange(event) {
|
|
101
|
+
return handleChange(event.target.value, 'min');
|
|
102
|
+
},
|
|
103
|
+
type: "number",
|
|
104
|
+
style: {
|
|
105
|
+
width: '32%'
|
|
106
|
+
},
|
|
107
|
+
InputLabelProps: {
|
|
108
|
+
shrink: true
|
|
109
|
+
},
|
|
110
|
+
InputProps: {
|
|
111
|
+
startAdornment: _react.default.createElement(_InputAdornment.default, {
|
|
112
|
+
position: "start"
|
|
113
|
+
}, "M")
|
|
114
|
+
},
|
|
115
|
+
inputProps: {
|
|
116
|
+
min: '0'
|
|
117
|
+
},
|
|
118
|
+
margin: "normal",
|
|
119
|
+
variant: "outlined"
|
|
120
|
+
}), showSeconds && _react.default.createElement(_TextField.default, {
|
|
121
|
+
id: "secondsInput",
|
|
122
|
+
value: sec,
|
|
123
|
+
onChange: function onChange(event) {
|
|
124
|
+
return handleChange(event.target.value, 'sec');
|
|
125
|
+
},
|
|
126
|
+
type: "number",
|
|
127
|
+
style: {
|
|
128
|
+
width: '32%'
|
|
129
|
+
},
|
|
130
|
+
InputLabelProps: {
|
|
131
|
+
shrink: true
|
|
132
|
+
},
|
|
133
|
+
InputProps: {
|
|
134
|
+
startAdornment: _react.default.createElement(_InputAdornment.default, {
|
|
135
|
+
position: "start"
|
|
136
|
+
}, "S")
|
|
137
|
+
},
|
|
138
|
+
inputProps: {
|
|
139
|
+
min: '0'
|
|
140
|
+
},
|
|
141
|
+
margin: "normal",
|
|
142
|
+
variant: "outlined"
|
|
143
|
+
})); // should take prop for time in seconds
|
|
144
|
+
// should take a handleChange function
|
|
145
|
+
// pull the event target value and then update the time with that * seconds
|
|
146
|
+
// might wanna move this coreLibrary after
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
CoreTimerInputOld.propTypes = {
|
|
150
|
+
time: _propTypes.default.number.isRequired,
|
|
151
|
+
handleUpdateTime: _propTypes.default.func.isRequired,
|
|
152
|
+
showSeconds: _propTypes.default.bool,
|
|
153
|
+
showHours: _propTypes.default.bool,
|
|
154
|
+
style: _propTypes.default.objectOf(_propTypes.default.string)
|
|
155
|
+
};
|
|
156
|
+
CoreTimerInputOld.defaultProps = {
|
|
157
|
+
showSeconds: true,
|
|
158
|
+
showHours: true,
|
|
159
|
+
style: {}
|
|
160
|
+
};
|
|
161
|
+
var _default = CoreTimerInputOld;
|
|
162
|
+
exports.default = _default;
|
|
@@ -78,7 +78,8 @@ function CoreToolbar(props) {
|
|
|
78
78
|
var title = props.title,
|
|
79
79
|
warning = props.warning,
|
|
80
80
|
intl = props.intl,
|
|
81
|
-
classes = props.classes
|
|
81
|
+
classes = props.classes,
|
|
82
|
+
showSeperator = props.showSeperator;
|
|
82
83
|
return _react.default.createElement(_Toolbar.default, null, props.icon, _react.default.createElement(_Typography.default, {
|
|
83
84
|
variant: "h6",
|
|
84
85
|
color: "inherit",
|
|
@@ -100,7 +101,7 @@ function CoreToolbar(props) {
|
|
|
100
101
|
className: classes.iconStyle
|
|
101
102
|
}), _react.default.createElement(_reactIntl.FormattedMessage, {
|
|
102
103
|
id: "__print"
|
|
103
|
-
})), (props.handlePrint || props.children) && (props.handleSave || props.handleClose) && _react.default.createElement("div", {
|
|
104
|
+
})), (props.handlePrint || props.children) && (props.handleSave || props.handleClose) && showSeperator && _react.default.createElement("div", {
|
|
104
105
|
className: classes.separator
|
|
105
106
|
}), props.handleSave && _react.default.createElement(_Button.default, {
|
|
106
107
|
variant: "contained",
|
|
@@ -150,6 +151,7 @@ CoreToolbar.propTypes = {
|
|
|
150
151
|
printDisabled: _propTypes.default.bool,
|
|
151
152
|
saveDisabled: _propTypes.default.bool,
|
|
152
153
|
closeDisabled: _propTypes.default.bool,
|
|
154
|
+
showSeperator: _propTypes.default.bool,
|
|
153
155
|
intl: _propTypes.default.shape().isRequired,
|
|
154
156
|
classes: _propTypes.default.shape().isRequired,
|
|
155
157
|
children: _propTypes.default.node
|
|
@@ -164,6 +166,7 @@ CoreToolbar.defaultProps = {
|
|
|
164
166
|
printDisabled: false,
|
|
165
167
|
saveDisabled: false,
|
|
166
168
|
closeDisabled: false,
|
|
169
|
+
showSeperator: true,
|
|
167
170
|
children: null
|
|
168
171
|
};
|
|
169
172
|
|
|
@@ -55,7 +55,7 @@ function (_Component) {
|
|
|
55
55
|
_createClass(ChannelsConsumer, [{
|
|
56
56
|
key: "componentDidMount",
|
|
57
57
|
value: function componentDidMount() {
|
|
58
|
-
this.props.channels.registerHandlers(this.props.id, this.props.handler, this.props.connectionChanged);
|
|
58
|
+
this.props.channels.registerHandlers(this.props.id, this.props.handler, this.props.connectionChanged, this.props.subscribing);
|
|
59
59
|
}
|
|
60
60
|
}, {
|
|
61
61
|
key: "componentWillUnmount",
|
|
@@ -77,11 +77,13 @@ ChannelsConsumer.propTypes = {
|
|
|
77
77
|
id: _propTypes.default.string.isRequired,
|
|
78
78
|
handler: _propTypes.default.func.isRequired,
|
|
79
79
|
connectionChanged: _propTypes.default.func,
|
|
80
|
+
subscribing: _propTypes.default.func,
|
|
80
81
|
addDefaultChannels: _propTypes.default.bool,
|
|
81
82
|
channels: _propTypes.default.objectOf(_propTypes.default.func).isRequired
|
|
82
83
|
};
|
|
83
84
|
ChannelsConsumer.defaultProps = {
|
|
84
85
|
connectionChanged: null,
|
|
86
|
+
subscribing: null,
|
|
85
87
|
addDefaultChannels: true,
|
|
86
88
|
children: null
|
|
87
89
|
};
|
|
@@ -44,6 +44,7 @@ var channelInformation = [];
|
|
|
44
44
|
var channelFunctions = [];
|
|
45
45
|
var handlers = [];
|
|
46
46
|
var connectionChangedHandlers = [];
|
|
47
|
+
var subscribingHandlers = [];
|
|
47
48
|
var client;
|
|
48
49
|
|
|
49
50
|
function compareChannelInfo(ci1, ci2) {
|
|
@@ -70,7 +71,7 @@ function compareChannelInfo(ci1, ci2) {
|
|
|
70
71
|
return true;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
var _registerHandlers = function registerHandlers(id, handler, connectionChanged) {
|
|
74
|
+
var _registerHandlers = function registerHandlers(id, handler, connectionChanged, subscribing) {
|
|
74
75
|
var existing = handlers.find(function (x) {
|
|
75
76
|
return x.id === id;
|
|
76
77
|
});
|
|
@@ -98,6 +99,21 @@ var _registerHandlers = function registerHandlers(id, handler, connectionChanged
|
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
}
|
|
102
|
+
|
|
103
|
+
if (subscribing) {
|
|
104
|
+
var existingSubscribing = subscribingHandlers.find(function (x) {
|
|
105
|
+
return x.id === id;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
if (existing !== undefined) {
|
|
109
|
+
existingSubscribing.handler = subscribing;
|
|
110
|
+
} else {
|
|
111
|
+
subscribingHandlers.push({
|
|
112
|
+
id: id,
|
|
113
|
+
handle: subscribing
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
101
117
|
};
|
|
102
118
|
|
|
103
119
|
var _unregisterHandlers = function unregisterHandlers(id) {
|
|
@@ -116,6 +132,14 @@ var _unregisterHandlers = function unregisterHandlers(id) {
|
|
|
116
132
|
if (existingConnectionChanged !== undefined) {
|
|
117
133
|
connectionChangedHandlers.splice(connectionChangedHandlers.indexOf(existingConnectionChanged), 1);
|
|
118
134
|
}
|
|
135
|
+
|
|
136
|
+
var existingSubscribing = subscribingHandlers.find(function (x) {
|
|
137
|
+
return x.id === id;
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
if (existingSubscribing !== undefined) {
|
|
141
|
+
subscribingHandlers.splice(subscribingHandlers.indexOf(existingSubscribing), 1);
|
|
142
|
+
}
|
|
119
143
|
};
|
|
120
144
|
|
|
121
145
|
var _registerChannel = function registerChannel(id, _channelFunction) {
|
|
@@ -167,6 +191,12 @@ var notifyConnectionChanged = function notifyConnectionChanged(connected) {
|
|
|
167
191
|
});
|
|
168
192
|
};
|
|
169
193
|
|
|
194
|
+
var notifySubscribing = function notifySubscribing(channel) {
|
|
195
|
+
subscribingHandlers.forEach(function (x) {
|
|
196
|
+
x.handler(channel);
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
|
|
170
200
|
var ChannelsProvider =
|
|
171
201
|
/*#__PURE__*/
|
|
172
202
|
function (_Component) {
|
|
@@ -303,17 +333,18 @@ function (_Component) {
|
|
|
303
333
|
key: "subscribe",
|
|
304
334
|
value: function subscribe(channelInfo) {
|
|
305
335
|
var methodName = 'subscribe()';
|
|
306
|
-
this.props.core.log('system', namespace, methodName,
|
|
336
|
+
this.props.core.log('system', namespace, methodName, "Subscribing to ".concat(channelInfo.channelName));
|
|
307
337
|
client.subscribe({
|
|
308
338
|
key: channelInfo.channelKey,
|
|
309
339
|
channel: channelInfo.channelName
|
|
310
340
|
});
|
|
341
|
+
notifySubscribing(channelInfo.channelName);
|
|
311
342
|
}
|
|
312
343
|
}, {
|
|
313
344
|
key: "unsubscribe",
|
|
314
345
|
value: function unsubscribe(channelInfo) {
|
|
315
346
|
var methodName = 'unsubscribe()';
|
|
316
|
-
this.props.core.log('system', namespace, methodName,
|
|
347
|
+
this.props.core.log('system', namespace, methodName, "Unsubscribing from ".concat(channelInfo.channelName));
|
|
317
348
|
client.unsubscribe({
|
|
318
349
|
key: channelInfo.channelKey,
|
|
319
350
|
channel: channelInfo.channelName
|
|
@@ -344,8 +375,8 @@ function (_Component) {
|
|
|
344
375
|
updateChannel: function updateChannel(id, data) {
|
|
345
376
|
return _this5.updateChannel(id, data);
|
|
346
377
|
},
|
|
347
|
-
registerHandlers: function registerHandlers(id, handler, connectionChanged) {
|
|
348
|
-
return _registerHandlers(id, handler, connectionChanged);
|
|
378
|
+
registerHandlers: function registerHandlers(id, handler, connectionChanged, subscribing) {
|
|
379
|
+
return _registerHandlers(id, handler, connectionChanged, subscribing);
|
|
349
380
|
},
|
|
350
381
|
registerChannel: function registerChannel(id, channelFunction) {
|
|
351
382
|
return _registerChannel(id, channelFunction);
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"versacall": {
|
|
3
3
|
"title": "Versacall Core Library React",
|
|
4
4
|
"applicationType": "react-library",
|
|
5
|
-
"build":
|
|
5
|
+
"build": 36
|
|
6
6
|
},
|
|
7
7
|
"name": "versacall-core-library-react",
|
|
8
|
-
"version": "2.0.
|
|
8
|
+
"version": "2.0.36",
|
|
9
9
|
"description": "Versacall Core Library",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"module": "dist/index.js",
|