versacall-core-library-react 2.0.26 → 2.0.30

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.
@@ -17,6 +17,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
 
18
18
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
19
19
 
20
+ 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; }
21
+
22
+ 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; }
23
+
20
24
  function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
21
25
 
22
26
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -47,7 +51,7 @@ function (_Component) {
47
51
 
48
52
  _this = _possibleConstructorReturn(this, _getPrototypeOf(CorePlugin).call(this));
49
53
  _this.state = {
50
- id: Math.floor(Math.random() * 10000 + 9999)
54
+ versaCallPluginId: Math.floor(Math.random() * 10000 + 9999)
51
55
  };
52
56
  return _this;
53
57
  }
@@ -57,6 +61,7 @@ function (_Component) {
57
61
  value: function componentDidMount() {
58
62
  var _this2 = this;
59
63
 
64
+ // this.onReceiveMessageBinded = this.onReceiveMessage.bind(this);
60
65
  window.addEventListener('message', function (e) {
61
66
  return _this2.onReceiveMessage(e);
62
67
  });
@@ -64,16 +69,18 @@ function (_Component) {
64
69
  }, {
65
70
  key: "componentDidUpdate",
66
71
  value: function componentDidUpdate(prevProps) {
67
- if (this.props.withAuthentication && this.props.authentication !== prevProps.authentication) {
72
+ if (this.props.withAuthentication && this.props.authentication.didChange(prevProps.authentication)) {
68
73
  this.updateAuthentication();
69
74
  }
70
75
 
71
- if (this.props.withOrganization && this.props.organization !== prevProps.organization) {
76
+ if (this.props.withOrganization && this.props.organization.didChange(prevProps.organization)) {
72
77
  this.updateOrganization();
73
78
  }
74
79
 
75
- if (this.props.controller !== prevProps.controller) {
76
- this.postMessage(this.props.controller);
80
+ if (JSON.stringify(this.props.controller) !== JSON.stringify(prevProps.controller)) {
81
+ this.postMessage({
82
+ controller: this.props.controller
83
+ });
77
84
  }
78
85
  }
79
86
  }, {
@@ -88,14 +95,16 @@ function (_Component) {
88
95
  }, {
89
96
  key: "onReceiveMessage",
90
97
  value: function onReceiveMessage(event) {
91
- if (this.props.onChange && this.state.id === event.data.id) {
92
- this.props.onChange(event);
98
+ if (this.props.onChange && _typeof(event.data) === 'object' && event.data.versaCallPluginId && event.data.versaCallPluginId === this.state.versaCallPluginId) {
99
+ this.props.onChange(event.data.controller);
93
100
  }
94
101
  }
95
102
  }, {
96
103
  key: "postMessage",
97
104
  value: function postMessage(message) {
98
- this.ifr.contentWindow.postMessage(message, '*');
105
+ this.ifr.contentWindow.postMessage(_objectSpread({
106
+ versaCallPluginId: this.state.versaCallPluginId
107
+ }, message), '*');
99
108
  }
100
109
  }, {
101
110
  key: "updateAuthentication",
@@ -119,9 +128,9 @@ function (_Component) {
119
128
  key: "handleLoad",
120
129
  value: function handleLoad() {
121
130
  this.postMessage({
122
- id: this.state.id,
123
- authentication: this.props.withAuthentication ? JSON.parse(JSON.stringify(this.props.authentication)) : {},
124
- organization: this.props.withOrganization ? JSON.parse(JSON.stringify(this.props.organization)) : {},
131
+ // id: this.state.id,
132
+ authentication: this.props.withAuthentication ? JSON.parse(JSON.stringify(this.props.authentication)) : null,
133
+ organization: this.props.withOrganization ? JSON.parse(JSON.stringify(this.props.organization)) : null,
125
134
  controller: this.props.controller
126
135
  });
127
136
  }
@@ -134,8 +143,8 @@ function (_Component) {
134
143
  core = _this$props.core,
135
144
  plugin = _this$props.plugin,
136
145
  sandbox = _this$props.sandbox;
137
- var id = this.state.id;
138
- return id !== '' ? _react.default.createElement("iframe", {
146
+ var versaCallPluginId = this.state.versaCallPluginId;
147
+ return versaCallPluginId !== '' ? _react.default.createElement("iframe", {
139
148
  frameBorder: "0",
140
149
  title: "CorePluginFrame",
141
150
  sandbox: sandbox,
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _context = require("../../context");
13
+
14
+ var _functions = require("../../functions");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
19
+
20
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
21
+
22
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
+
24
+ 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); } }
25
+
26
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
27
+
28
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
29
+
30
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
+
32
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
33
+
34
+ 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
35
+
36
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
37
+
38
+ var CorePlugin =
39
+ /*#__PURE__*/
40
+ function (_Component) {
41
+ _inherits(CorePlugin, _Component);
42
+
43
+ function CorePlugin() {
44
+ var _this;
45
+
46
+ _classCallCheck(this, CorePlugin);
47
+
48
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(CorePlugin).call(this));
49
+ _this.state = {
50
+ id: Math.floor(Math.random() * 10000 + 9999)
51
+ };
52
+ return _this;
53
+ }
54
+
55
+ _createClass(CorePlugin, [{
56
+ key: "componentDidMount",
57
+ value: function componentDidMount() {
58
+ var _this2 = this;
59
+
60
+ window.addEventListener('message', function (e) {
61
+ return _this2.onReceiveMessage(e);
62
+ });
63
+ }
64
+ }, {
65
+ key: "componentDidUpdate",
66
+ value: function componentDidUpdate(prevProps) {
67
+ if (this.props.withAuthentication && this.props.authentication !== prevProps.authentication) {
68
+ this.updateAuthentication();
69
+ }
70
+
71
+ if (this.props.withOrganization && this.props.organization !== prevProps.organization) {
72
+ this.updateOrganization();
73
+ }
74
+
75
+ if (this.props.controller !== prevProps.controller) {
76
+ this.postMessage(this.props.controller);
77
+ }
78
+ }
79
+ }, {
80
+ key: "componentWillUnmount",
81
+ value: function componentWillUnmount() {
82
+ var _this3 = this;
83
+
84
+ window.removeEventListener('message', function (e) {
85
+ return _this3.onReceiveMessage(e);
86
+ }, false);
87
+ }
88
+ }, {
89
+ key: "onReceiveMessage",
90
+ value: function onReceiveMessage(event) {
91
+ if (this.props.onChange && this.state.id === event.data.id) {
92
+ this.props.onChange(event);
93
+ }
94
+ }
95
+ }, {
96
+ key: "postMessage",
97
+ value: function postMessage(message) {
98
+ this.ifr.contentWindow.postMessage(message, '*');
99
+ }
100
+ }, {
101
+ key: "updateAuthentication",
102
+ value: function updateAuthentication() {
103
+ if (this.props.withAuthentication) {
104
+ this.postMessage({
105
+ authentication: JSON.parse(JSON.stringify(this.props.authentication))
106
+ });
107
+ }
108
+ }
109
+ }, {
110
+ key: "updateOrganization",
111
+ value: function updateOrganization() {
112
+ if (this.props.withOrganization) {
113
+ this.postMessage({
114
+ organization: JSON.parse(JSON.stringify(this.props.organization))
115
+ });
116
+ }
117
+ }
118
+ }, {
119
+ key: "handleLoad",
120
+ value: function handleLoad() {
121
+ this.postMessage({
122
+ id: this.state.id,
123
+ authentication: this.props.withAuthentication ? JSON.parse(JSON.stringify(this.props.authentication)) : {},
124
+ organization: this.props.withOrganization ? JSON.parse(JSON.stringify(this.props.organization)) : {},
125
+ controller: this.props.controller
126
+ });
127
+ }
128
+ }, {
129
+ key: "render",
130
+ value: function render() {
131
+ var _this4 = this;
132
+
133
+ var _this$props = this.props,
134
+ core = _this$props.core,
135
+ plugin = _this$props.plugin,
136
+ sandbox = _this$props.sandbox;
137
+ var id = this.state.id;
138
+ return id !== '' ? _react.default.createElement("iframe", {
139
+ frameBorder: "0",
140
+ title: "CorePluginFrame",
141
+ sandbox: sandbox,
142
+ onLoad: function onLoad() {
143
+ return _this4.handleLoad();
144
+ },
145
+ ref: function ref(f) {
146
+ _this4.ifr = f;
147
+ return _this4.ifr;
148
+ },
149
+ style: {
150
+ width: plugin.metadata.width,
151
+ height: plugin.metadata.height
152
+ },
153
+ src: "".concat(core.formatUrl((0, _functions.getUrl)(plugin.metadata)), "?version=").concat(encodeURI(plugin.version))
154
+ }) : _react.default.createElement("div", null);
155
+ }
156
+ }]);
157
+
158
+ return CorePlugin;
159
+ }(_react.Component);
160
+
161
+ CorePlugin.propTypes = {
162
+ plugin: _propTypes.default.shape({
163
+ componentID: _propTypes.default.string,
164
+ componentType: _propTypes.default.string,
165
+ name: _propTypes.default.string,
166
+ description: _propTypes.default.string,
167
+ version: _propTypes.default.string,
168
+ translation: _propTypes.default.array,
169
+ metadata: _propTypes.default.shape({
170
+ url: _propTypes.default.string,
171
+ iconUrl: _propTypes.default.string,
172
+ width: _propTypes.default.string,
173
+ height: _propTypes.default.string
174
+ })
175
+ }).isRequired,
176
+ sandbox: _propTypes.default.string,
177
+ controller: _propTypes.default.shape(),
178
+ onChange: _propTypes.default.func,
179
+ core: _propTypes.default.shape().isRequired,
180
+ authentication: _propTypes.default.shape().isRequired,
181
+ organization: _propTypes.default.shape().isRequired,
182
+ withAuthentication: _propTypes.default.bool,
183
+ withOrganization: _propTypes.default.bool
184
+ };
185
+ CorePlugin.defaultProps = {
186
+ sandbox: null,
187
+ controller: {},
188
+ onChange: null,
189
+ withAuthentication: false,
190
+ withOrganization: false
191
+ };
192
+
193
+ var _default = (0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)(CorePlugin)));
194
+
195
+ exports.default = _default;
@@ -11,10 +11,6 @@ var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormCo
11
11
 
12
12
  var _reactIntl = require("react-intl");
13
13
 
14
- var _DeleteSweep = _interopRequireDefault(require("@material-ui/icons/DeleteSweep"));
15
-
16
- var _CardContent = _interopRequireDefault(require("@material-ui/core/CardContent"));
17
-
18
14
  var _Edit = _interopRequireDefault(require("@material-ui/icons/Edit"));
19
15
 
20
16
  var _Schedule = _interopRequireDefault(require("@material-ui/icons/Schedule"));
@@ -25,30 +21,14 @@ var _Typography = _interopRequireDefault(require("@material-ui/core/Typography")
25
21
 
26
22
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
27
23
 
28
- var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
29
-
30
24
  var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
31
25
 
32
- var _ListItem = _interopRequireDefault(require("@material-ui/core/ListItem"));
33
-
34
- var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
35
-
36
26
  var _Switch = _interopRequireDefault(require("@material-ui/core/Switch"));
37
27
 
38
28
  var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
39
29
 
40
- var _Avatar = _interopRequireDefault(require("@material-ui/core/Avatar"));
41
-
42
- var _Add = _interopRequireDefault(require("@material-ui/icons/Add"));
43
-
44
30
  var _Chip = _interopRequireDefault(require("@material-ui/core/Chip"));
45
31
 
46
- var _List = _interopRequireDefault(require("@material-ui/core/List"));
47
-
48
- var _Card = _interopRequireDefault(require("@material-ui/core/Card"));
49
-
50
- var _Grid = _interopRequireDefault(require("@material-ui/core/Grid"));
51
-
52
32
  var _propTypes = _interopRequireDefault(require("prop-types"));
53
33
 
54
34
  var _CoreToolbar = _interopRequireDefault(require("../CoreToolbar"));
@@ -206,7 +206,11 @@ function (_Component) {
206
206
  openDialog: true
207
207
  });
208
208
  }
209
- }, _react.default.createElement(_Edit.default, null), _react.default.createElement(_reactIntl.FormattedMessage, {
209
+ }, _react.default.createElement(_Edit.default, {
210
+ style: {
211
+ marginRight: 10
212
+ }
213
+ }), _react.default.createElement(_reactIntl.FormattedMessage, {
210
214
  id: "__edit"
211
215
  })), !hideAdvanced && _react.default.createElement(_FormControlLabel.default, {
212
216
  style: {
@@ -248,9 +248,9 @@ function TagFilterBuilder(props) {
248
248
  style: style.list,
249
249
  className: _scrollbarModule.default.scroll
250
250
  }, !hideModuleTagFilters && filteredModuleTags.map(function (moduleTag) {
251
- return _react.default.createElement(_react.default.Fragment, null, renderTag(moduleTag, 'moduleTagFilters'));
251
+ return renderTag(moduleTag, 'moduleTagFilters');
252
252
  }), !hideModuleLocationFilters && filteredLocationTags.map(function (locationTag) {
253
- return _react.default.createElement(_react.default.Fragment, null, renderTag(locationTag, 'moduleLocationFilters'));
253
+ return renderTag(locationTag, 'moduleLocationFilters');
254
254
  }))), showMonitoringPoints && _react.default.createElement(_Grid.default, {
255
255
  item: true,
256
256
  xs: columns === 1 ? 12 : 6,
@@ -261,9 +261,9 @@ function TagFilterBuilder(props) {
261
261
  style: style.list,
262
262
  className: _scrollbarModule.default.scroll
263
263
  }, !hideMonitoringPointTagFilters && filteredMonitoringPointTags.map(function (mpTag) {
264
- return _react.default.createElement(_react.default.Fragment, null, renderTag(mpTag, 'monitoringPointTagFilters'));
264
+ return renderTag(mpTag, 'monitoringPointTagFilters');
265
265
  }), !hideMonitoringPointTypeFilters && filteredTypeTags.map(function (typeTag) {
266
- return _react.default.createElement(_react.default.Fragment, null, renderTag(typeTag, 'monitoringPointTypeFilters'));
266
+ return renderTag(typeTag, 'monitoringPointTypeFilters');
267
267
  }))), columns === 0 && _react.default.createElement(_Grid.default, {
268
268
  item: true,
269
269
  xs: 12,
@@ -96,6 +96,9 @@ function (_Component) {
96
96
  style: {
97
97
  width: fullWidth ? '100%' : 'auto'
98
98
  },
99
+ InputLabelProps: {
100
+ shrink: true
101
+ },
99
102
  onChange: function onChange(event) {
100
103
  return _this2.updateValue(event.target.value);
101
104
  },
@@ -103,6 +106,7 @@ function (_Component) {
103
106
  endAdornment: options.length > 0 ? _react.default.createElement(_InputAdornment.default, {
104
107
  position: "end"
105
108
  }, _react.default.createElement(_IconButton.default, {
109
+ size: "small",
106
110
  onClick: function onClick(event) {
107
111
  return _this2.setState({
108
112
  textMenuElement: event.currentTarget
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": 26
5
+ "build": 30
6
6
  },
7
7
  "name": "versacall-core-library-react",
8
- "version": "2.0.26",
8
+ "version": "2.0.30",
9
9
  "description": "Versacall Core Library",
10
10
  "main": "dist/index.js",
11
11
  "module": "dist/index.js",