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
@@ -4,66 +4,51 @@ 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
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _LinearProgress = _interopRequireDefault(require("@material-ui/core/LinearProgress"));
13
-
14
10
  var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
15
-
16
11
  var _DialogContent = _interopRequireDefault(require("@material-ui/core/DialogContent"));
17
-
18
12
  var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
19
-
20
13
  var _Slide = _interopRequireDefault(require("@material-ui/core/Slide"));
21
-
22
14
  var _FiberManualRecord = _interopRequireDefault(require("@material-ui/icons/FiberManualRecord"));
23
-
24
15
  var _FiberManualRecordOutlined = _interopRequireDefault(require("@material-ui/icons/FiberManualRecordOutlined"));
25
-
26
16
  var _reactIntl = require("react-intl");
27
-
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
31
-
17
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
32
19
  function Transition(props) {
33
20
  return /*#__PURE__*/_react.default.createElement(_Slide.default, _extends({
34
21
  direction: "up"
35
22
  }, props));
36
23
  }
37
-
38
24
  function Importing(props) {
39
- var plan = props.plan,
40
- waiting = props.waiting;
25
+ const {
26
+ plan,
27
+ waiting
28
+ } = props;
41
29
  return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
42
30
  open: true,
43
31
  keepMounted: true,
44
32
  TransitionComponent: Transition
45
33
  }, /*#__PURE__*/_react.default.createElement(_DialogTitle.default, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
46
34
  id: "__importing"
47
- }), /*#__PURE__*/_react.default.createElement(_LinearProgress.default, null)), /*#__PURE__*/_react.default.createElement(_DialogContent.default, null, plan.map(function (item) {
48
- return /*#__PURE__*/_react.default.createElement("div", {
49
- key: item.id,
50
- style: {
51
- display: 'flex',
52
- alignItems: 'center',
53
- marginBottom: 10
54
- }
55
- }, waiting.includes(item.id) ? /*#__PURE__*/_react.default.createElement(_FiberManualRecordOutlined.default, {
56
- style: {
57
- marginRight: 10
58
- }
59
- }) : /*#__PURE__*/_react.default.createElement(_FiberManualRecord.default, {
60
- style: {
61
- marginRight: 10
62
- }
63
- }), "".concat(item.name, " (").concat(item.quantity, ")"));
64
- })));
35
+ }), /*#__PURE__*/_react.default.createElement(_LinearProgress.default, null)), /*#__PURE__*/_react.default.createElement(_DialogContent.default, null, plan.map(item => /*#__PURE__*/_react.default.createElement("div", {
36
+ key: item.id,
37
+ style: {
38
+ display: 'flex',
39
+ alignItems: 'center',
40
+ marginBottom: 10
41
+ }
42
+ }, waiting.includes(item.id) ? /*#__PURE__*/_react.default.createElement(_FiberManualRecordOutlined.default, {
43
+ style: {
44
+ marginRight: 10
45
+ }
46
+ }) : /*#__PURE__*/_react.default.createElement(_FiberManualRecord.default, {
47
+ style: {
48
+ marginRight: 10
49
+ }
50
+ }), "".concat(item.name, " (").concat(item.quantity, ")")))));
65
51
  }
66
-
67
52
  Importing.propTypes = {
68
53
  plan: _propTypes.default.arrayOf(_propTypes.default.shape()),
69
54
  waiting: _propTypes.default.arrayOf(_propTypes.default.string)
@@ -72,5 +57,4 @@ Importing.defaultProps = {
72
57
  plan: [],
73
58
  waiting: []
74
59
  };
75
- var _default = Importing;
76
- exports.default = _default;
60
+ var _default = exports.default = Importing;
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "default", {
7
7
  enumerable: true,
8
- get: function get() {
8
+ get: function () {
9
9
  return _CoreImporting.default;
10
10
  }
11
11
  });
12
-
13
12
  var _CoreImporting = _interopRequireDefault(require("./CoreImporting"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -4,177 +4,103 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireWildcard(require("react"));
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _context = require("../../context");
13
-
14
10
  var _functions = require("../../functions");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- 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); }
19
-
20
- 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; }
21
-
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
-
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
-
26
- 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; }
27
-
28
- 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); }
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 CorePlugin = /*#__PURE__*/function (_Component) {
51
- _inherits(CorePlugin, _Component);
52
-
53
- var _super = _createSuper(CorePlugin);
54
-
55
- function CorePlugin() {
56
- var _this;
57
-
58
- _classCallCheck(this, CorePlugin);
59
-
60
- _this = _super.call(this);
61
- _this.state = {
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
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
18
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
19
+ class CorePlugin extends _react.Component {
20
+ constructor() {
21
+ super();
22
+ this.state = {
62
23
  versaCallPluginId: Math.floor(Math.random() * 10000 + 9999)
63
24
  };
64
- return _this;
65
25
  }
66
-
67
- _createClass(CorePlugin, [{
68
- key: "componentDidMount",
69
- value: function componentDidMount() {
70
- var _this2 = this;
71
-
72
- // this.onReceiveMessageBinded = this.onReceiveMessage.bind(this);
73
- window.addEventListener('message', function (e) {
74
- return _this2.onReceiveMessage(e);
75
- });
76
- }
77
- }, {
78
- key: "componentDidUpdate",
79
- value: function componentDidUpdate(prevProps) {
80
- if (this.props.withAuthentication && this.props.authentication.didChange(prevProps.authentication)) {
81
- this.updateAuthentication();
82
- }
83
-
84
- if (this.props.withOrganization && this.props.organization.didChange(prevProps.organization)) {
85
- this.updateOrganization();
86
- }
87
-
88
- if (JSON.stringify(this.props.controller) !== JSON.stringify(prevProps.controller)) {
89
- this.postMessage({
90
- controller: this.props.controller
91
- });
92
- }
93
- }
94
- }, {
95
- key: "componentWillUnmount",
96
- value: function componentWillUnmount() {
97
- var _this3 = this;
98
-
99
- window.removeEventListener('message', function (e) {
100
- return _this3.onReceiveMessage(e);
101
- }, false);
102
- }
103
- }, {
104
- key: "onReceiveMessage",
105
- value: function onReceiveMessage(event) {
106
- if (this.props.onChange && _typeof(event.data) === 'object' && event.data.versaCallPluginId && event.data.versaCallPluginId === this.state.versaCallPluginId) {
107
- this.props.onChange(event.data.controller);
108
- }
26
+ componentDidMount() {
27
+ // this.onReceiveMessageBinded = this.onReceiveMessage.bind(this);
28
+ window.addEventListener('message', e => this.onReceiveMessage(e));
29
+ }
30
+ componentDidUpdate(prevProps) {
31
+ if (this.props.withAuthentication && this.props.authentication.didChange(prevProps.authentication)) {
32
+ this.updateAuthentication();
109
33
  }
110
- }, {
111
- key: "postMessage",
112
- value: function postMessage(message) {
113
- this.ifr.contentWindow.postMessage(_objectSpread({
114
- versaCallPluginId: this.state.versaCallPluginId
115
- }, message), '*');
34
+ if (this.props.withOrganization && this.props.organization.didChange(prevProps.organization)) {
35
+ this.updateOrganization();
116
36
  }
117
- }, {
118
- key: "updateAuthentication",
119
- value: function updateAuthentication() {
120
- if (this.props.withAuthentication) {
121
- this.postMessage({
122
- authentication: JSON.parse(JSON.stringify(this.props.authentication))
123
- });
124
- }
37
+ if (JSON.stringify(this.props.controller) !== JSON.stringify(prevProps.controller)) {
38
+ this.postMessage({
39
+ controller: this.props.controller
40
+ });
125
41
  }
126
- }, {
127
- key: "updateOrganization",
128
- value: function updateOrganization() {
129
- if (this.props.withOrganization) {
130
- this.postMessage({
131
- organization: JSON.parse(JSON.stringify(this.props.organization))
132
- });
133
- }
42
+ }
43
+ componentWillUnmount() {
44
+ window.removeEventListener('message', e => this.onReceiveMessage(e), false);
45
+ }
46
+ onReceiveMessage(event) {
47
+ if (this.props.onChange && typeof event.data === 'object' && event.data.versaCallPluginId && event.data.versaCallPluginId === this.state.versaCallPluginId) {
48
+ this.props.onChange(event.data.controller);
134
49
  }
135
- }, {
136
- key: "handleLoad",
137
- value: function handleLoad() {
50
+ }
51
+ postMessage(message) {
52
+ this.ifr.contentWindow.postMessage(_objectSpread({
53
+ versaCallPluginId: this.state.versaCallPluginId
54
+ }, message), '*');
55
+ }
56
+ updateAuthentication() {
57
+ if (this.props.withAuthentication) {
138
58
  this.postMessage({
139
- // id: this.state.id,
140
- authentication: this.props.withAuthentication ? JSON.parse(JSON.stringify(this.props.authentication)) : null,
141
- organization: this.props.withOrganization ? JSON.parse(JSON.stringify(this.props.organization)) : null,
142
- controller: this.props.controller
59
+ authentication: JSON.parse(JSON.stringify(this.props.authentication))
143
60
  });
144
61
  }
145
- }, {
146
- key: "render",
147
- value: function render() {
148
- var _this4 = this;
149
-
150
- var _this$props = this.props,
151
- core = _this$props.core,
152
- plugin = _this$props.plugin,
153
- sandbox = _this$props.sandbox;
154
- var versaCallPluginId = this.state.versaCallPluginId;
155
- return versaCallPluginId !== '' ? /*#__PURE__*/_react.default.createElement("iframe", {
156
- frameBorder: "0",
157
- title: "CorePluginFrame",
158
- sandbox: sandbox,
159
- onLoad: function onLoad() {
160
- return _this4.handleLoad();
161
- },
162
- ref: function ref(f) {
163
- _this4.ifr = f;
164
- return _this4.ifr;
165
- },
166
- style: {
167
- width: plugin.metadata.width,
168
- height: plugin.metadata.height
169
- },
170
- src: "".concat(core.formatUrl((0, _functions.getUrl)(plugin.metadata)), "?version=").concat(encodeURI(plugin.version))
171
- }) : /*#__PURE__*/_react.default.createElement("div", null);
62
+ }
63
+ updateOrganization() {
64
+ if (this.props.withOrganization) {
65
+ this.postMessage({
66
+ organization: JSON.parse(JSON.stringify(this.props.organization))
67
+ });
172
68
  }
173
- }]);
174
-
175
- return CorePlugin;
176
- }(_react.Component);
177
-
69
+ }
70
+ handleLoad() {
71
+ this.postMessage({
72
+ // id: this.state.id,
73
+ authentication: this.props.withAuthentication ? JSON.parse(JSON.stringify(this.props.authentication)) : null,
74
+ organization: this.props.withOrganization ? JSON.parse(JSON.stringify(this.props.organization)) : null,
75
+ controller: this.props.controller
76
+ });
77
+ }
78
+ render() {
79
+ const {
80
+ core,
81
+ plugin,
82
+ sandbox
83
+ } = this.props;
84
+ const {
85
+ versaCallPluginId
86
+ } = this.state;
87
+ return versaCallPluginId !== '' ? /*#__PURE__*/_react.default.createElement("iframe", {
88
+ frameBorder: "0",
89
+ title: "CorePluginFrame",
90
+ sandbox: sandbox,
91
+ onLoad: () => this.handleLoad(),
92
+ ref: f => {
93
+ this.ifr = f;
94
+ return this.ifr;
95
+ },
96
+ style: {
97
+ width: plugin.metadata.width,
98
+ height: plugin.metadata.height
99
+ },
100
+ src: "".concat(core.formatUrl((0, _functions.getUrl)(plugin.metadata)), "?version=").concat(encodeURI(plugin.version))
101
+ }) : /*#__PURE__*/_react.default.createElement("div", null);
102
+ }
103
+ }
178
104
  CorePlugin.propTypes = {
179
105
  plugin: _propTypes.default.shape({
180
106
  componentID: _propTypes.default.string,
@@ -206,7 +132,4 @@ CorePlugin.defaultProps = {
206
132
  withAuthentication: false,
207
133
  withOrganization: false
208
134
  };
209
-
210
- var _default = (0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)(CorePlugin)));
211
-
212
- exports.default = _default;
135
+ var _default = exports.default = (0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)(CorePlugin)));
@@ -1,169 +1,96 @@
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 _context = require("../../context");
15
-
16
10
  var _functions = require("../../functions");
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 CorePlugin = /*#__PURE__*/function (_Component) {
45
- _inherits(CorePlugin, _Component);
46
-
47
- var _super = _createSuper(CorePlugin);
48
-
49
- function CorePlugin() {
50
- var _this;
51
-
52
- _classCallCheck(this, CorePlugin);
53
-
54
- _this = _super.call(this);
55
- _this.state = {
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
+ class CorePlugin extends _react.Component {
15
+ constructor() {
16
+ super();
17
+ this.state = {
56
18
  id: Math.floor(Math.random() * 10000 + 9999)
57
19
  };
58
- return _this;
59
20
  }
60
-
61
- _createClass(CorePlugin, [{
62
- key: "componentDidMount",
63
- value: function componentDidMount() {
64
- var _this2 = this;
65
-
66
- window.addEventListener('message', function (e) {
67
- return _this2.onReceiveMessage(e);
68
- });
69
- }
70
- }, {
71
- key: "componentDidUpdate",
72
- value: function componentDidUpdate(prevProps) {
73
- if (this.props.withAuthentication && this.props.authentication !== prevProps.authentication) {
74
- this.updateAuthentication();
75
- }
76
-
77
- if (this.props.withOrganization && this.props.organization !== prevProps.organization) {
78
- this.updateOrganization();
79
- }
80
-
81
- if (this.props.controller !== prevProps.controller) {
82
- this.postMessage(this.props.controller);
83
- }
84
- }
85
- }, {
86
- key: "componentWillUnmount",
87
- value: function componentWillUnmount() {
88
- var _this3 = this;
89
-
90
- window.removeEventListener('message', function (e) {
91
- return _this3.onReceiveMessage(e);
92
- }, false);
93
- }
94
- }, {
95
- key: "onReceiveMessage",
96
- value: function onReceiveMessage(event) {
97
- if (this.props.onChange && this.state.id === event.data.id) {
98
- this.props.onChange(event);
99
- }
21
+ componentDidMount() {
22
+ window.addEventListener('message', e => this.onReceiveMessage(e));
23
+ }
24
+ componentDidUpdate(prevProps) {
25
+ if (this.props.withAuthentication && this.props.authentication !== prevProps.authentication) {
26
+ this.updateAuthentication();
100
27
  }
101
- }, {
102
- key: "postMessage",
103
- value: function postMessage(message) {
104
- this.ifr.contentWindow.postMessage(message, '*');
28
+ if (this.props.withOrganization && this.props.organization !== prevProps.organization) {
29
+ this.updateOrganization();
105
30
  }
106
- }, {
107
- key: "updateAuthentication",
108
- value: function updateAuthentication() {
109
- if (this.props.withAuthentication) {
110
- this.postMessage({
111
- authentication: JSON.parse(JSON.stringify(this.props.authentication))
112
- });
113
- }
31
+ if (this.props.controller !== prevProps.controller) {
32
+ this.postMessage(this.props.controller);
114
33
  }
115
- }, {
116
- key: "updateOrganization",
117
- value: function updateOrganization() {
118
- if (this.props.withOrganization) {
119
- this.postMessage({
120
- organization: JSON.parse(JSON.stringify(this.props.organization))
121
- });
122
- }
34
+ }
35
+ componentWillUnmount() {
36
+ window.removeEventListener('message', e => this.onReceiveMessage(e), false);
37
+ }
38
+ onReceiveMessage(event) {
39
+ if (this.props.onChange && this.state.id === event.data.id) {
40
+ this.props.onChange(event);
123
41
  }
124
- }, {
125
- key: "handleLoad",
126
- value: function handleLoad() {
42
+ }
43
+ postMessage(message) {
44
+ this.ifr.contentWindow.postMessage(message, '*');
45
+ }
46
+ updateAuthentication() {
47
+ if (this.props.withAuthentication) {
127
48
  this.postMessage({
128
- id: this.state.id,
129
- authentication: this.props.withAuthentication ? JSON.parse(JSON.stringify(this.props.authentication)) : {},
130
- organization: this.props.withOrganization ? JSON.parse(JSON.stringify(this.props.organization)) : {},
131
- controller: this.props.controller
49
+ authentication: JSON.parse(JSON.stringify(this.props.authentication))
132
50
  });
133
51
  }
134
- }, {
135
- key: "render",
136
- value: function render() {
137
- var _this4 = this;
138
-
139
- var _this$props = this.props,
140
- core = _this$props.core,
141
- plugin = _this$props.plugin,
142
- sandbox = _this$props.sandbox;
143
- var id = this.state.id;
144
- return id !== '' ? /*#__PURE__*/_react.default.createElement("iframe", {
145
- frameBorder: "0",
146
- title: "CorePluginFrame",
147
- sandbox: sandbox,
148
- onLoad: function onLoad() {
149
- return _this4.handleLoad();
150
- },
151
- ref: function ref(f) {
152
- _this4.ifr = f;
153
- return _this4.ifr;
154
- },
155
- style: {
156
- width: plugin.metadata.width,
157
- height: plugin.metadata.height
158
- },
159
- src: "".concat(core.formatUrl((0, _functions.getUrl)(plugin.metadata)), "?version=").concat(encodeURI(plugin.version))
160
- }) : /*#__PURE__*/_react.default.createElement("div", null);
52
+ }
53
+ updateOrganization() {
54
+ if (this.props.withOrganization) {
55
+ this.postMessage({
56
+ organization: JSON.parse(JSON.stringify(this.props.organization))
57
+ });
161
58
  }
162
- }]);
163
-
164
- return CorePlugin;
165
- }(_react.Component);
166
-
59
+ }
60
+ handleLoad() {
61
+ this.postMessage({
62
+ id: this.state.id,
63
+ authentication: this.props.withAuthentication ? JSON.parse(JSON.stringify(this.props.authentication)) : {},
64
+ organization: this.props.withOrganization ? JSON.parse(JSON.stringify(this.props.organization)) : {},
65
+ controller: this.props.controller
66
+ });
67
+ }
68
+ render() {
69
+ const {
70
+ core,
71
+ plugin,
72
+ sandbox
73
+ } = this.props;
74
+ const {
75
+ id
76
+ } = this.state;
77
+ return id !== '' ? /*#__PURE__*/_react.default.createElement("iframe", {
78
+ frameBorder: "0",
79
+ title: "CorePluginFrame",
80
+ sandbox: sandbox,
81
+ onLoad: () => this.handleLoad(),
82
+ ref: f => {
83
+ this.ifr = f;
84
+ return this.ifr;
85
+ },
86
+ style: {
87
+ width: plugin.metadata.width,
88
+ height: plugin.metadata.height
89
+ },
90
+ src: "".concat(core.formatUrl((0, _functions.getUrl)(plugin.metadata)), "?version=").concat(encodeURI(plugin.version))
91
+ }) : /*#__PURE__*/_react.default.createElement("div", null);
92
+ }
93
+ }
167
94
  CorePlugin.propTypes = {
168
95
  plugin: _propTypes.default.shape({
169
96
  componentID: _propTypes.default.string,
@@ -195,7 +122,4 @@ CorePlugin.defaultProps = {
195
122
  withAuthentication: false,
196
123
  withOrganization: false
197
124
  };
198
-
199
- var _default = (0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)(CorePlugin)));
200
-
201
- exports.default = _default;
125
+ var _default = exports.default = (0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)(CorePlugin)));
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "default", {
7
7
  enumerable: true,
8
- get: function get() {
8
+ get: function () {
9
9
  return _CorePlugin.default;
10
10
  }
11
11
  });
12
-
13
12
  var _CorePlugin = _interopRequireDefault(require("./CorePlugin"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }