versacall-core-library-react 2.0.70 → 2.0.72
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/CoreAlert/CoreAlert.js +85 -0
- package/dist/components/CoreAlert/index.js +13 -0
- package/dist/components/CoreAlert/readme.md +21 -0
- package/dist/components/CoreAppBar/CoreAppBar.js +364 -0
- package/dist/components/CoreAppBar/CoreAppBarDrawer.js +134 -0
- package/dist/components/CoreAppBar/README.md +27 -0
- package/dist/components/CoreAppBar/index.js +13 -0
- package/dist/components/CoreAppBar/screenshot.png +0 -0
- package/dist/components/CoreAppSelector/AppLink.js +101 -0
- package/dist/components/CoreAppSelector/CoreAppSelector.js +155 -0
- package/dist/components/CoreAppSelector/index.js +13 -0
- package/dist/components/CoreDialogueToolBar/CoreDialogueToolBar.js +123 -0
- package/dist/components/CoreDialogueToolBar/index.js +13 -0
- package/dist/components/CoreDrawer/CoreDrawer.js +236 -0
- package/dist/components/CoreDrawer/README.md +36 -0
- package/dist/components/CoreDrawer/index.js +13 -0
- package/dist/components/CoreDrawer/screenshot_collapsed.png +0 -0
- package/dist/components/CoreDrawer/screenshot_expanded.png +0 -0
- package/dist/components/CoreDropDownTextfield/CoreDropDownTextfield.js +85 -0
- package/dist/components/CoreDropDownTextfield/index.js +13 -0
- package/dist/components/CoreElapsedTime/CoreElapsedTime.js +57 -0
- package/dist/components/CoreElapsedTime/index.js +13 -0
- package/dist/components/CoreFrame/CoreFrame.js +64 -0
- package/dist/components/CoreFrame/index.js +13 -0
- package/dist/components/CoreImportDialog/CoreImportDialog.js +350 -0
- package/dist/components/CoreImportDialog/index.js +13 -0
- package/dist/components/CoreImportResultsDialog/CoreImportResultsDialog.js +103 -0
- package/dist/components/CoreImportResultsDialog/index.js +13 -0
- package/dist/components/CoreImporting/CoreImporting.js +60 -0
- package/dist/components/CoreImporting/index.js +13 -0
- package/dist/components/CorePlugin/CorePlugin.js +134 -0
- package/dist/components/CorePlugin/OldCorePlugin.js +124 -0
- package/dist/components/CorePlugin/index.js +13 -0
- package/dist/components/CoreSaveChangesDialog/CoreSaveChangesDialog.js +62 -0
- package/dist/components/CoreSaveChangesDialog/index.js +13 -0
- package/dist/components/CoreShiftTagFilter/CoreShiftTagFilter.js +350 -0
- package/dist/components/CoreShiftTagFilter/OldCoreShiftTagFilter.js +208 -0
- package/dist/components/CoreShiftTagFilter/index.js +13 -0
- package/dist/components/CoreSideBar/CoreSideBar.js +737 -0
- package/dist/components/CoreSideBar/CoreSideBarDrawer.js +172 -0
- package/dist/components/CoreSideBar/index.js +13 -0
- package/dist/components/CoreSnackBar/CoreSnackBar.js +116 -0
- package/dist/components/CoreSnackBar/index.js +13 -0
- package/dist/components/CoreSnackBar/readme.md +23 -0
- package/dist/components/CoreTable/CoreTable.js +315 -0
- package/dist/components/CoreTable/CoreTableChips.js +50 -0
- package/dist/components/CoreTable/CoreTableHead.js +175 -0
- package/dist/components/CoreTable/CoreTableToolbar.js +108 -0
- package/dist/components/CoreTable/index.js +13 -0
- package/dist/components/CoreTable/readMe.md +79 -0
- package/dist/components/CoreTagFilter/CoreTagFilter.js +275 -0
- package/dist/components/CoreTagFilter/OldCoreTagFilter.js +341 -0
- package/dist/components/CoreTagFilter/OldTagChip.js +44 -0
- package/dist/components/CoreTagFilter/OldTagFilterSelector.js +105 -0
- package/dist/components/CoreTagFilter/OldTagOption.js +53 -0
- package/dist/components/CoreTagFilter/TagFilterBuilder.js +487 -0
- package/dist/components/CoreTagFilter/index.js +13 -0
- package/dist/components/CoreTextField/CoreTextField.js +109 -0
- package/dist/components/CoreTextField/index.js +13 -0
- package/dist/components/CoreTheme/CoreTheme.css +9 -0
- package/dist/components/CoreTheme/CoreTheme.js +51 -0
- package/dist/components/CoreTheme/README.md +3 -0
- package/dist/components/CoreTheme/index.js +13 -0
- package/dist/components/CoreTile/CoreTile.js +62 -0
- package/dist/components/CoreTile/CoreTileToolbar.js +62 -0
- package/dist/components/CoreTile/index.js +13 -0
- package/dist/components/CoreTimerInput/CoreTimerInput.js +203 -0
- package/dist/components/CoreTimerInput/CoreTimerInputOld.js +146 -0
- package/dist/components/CoreTimerInput/index.js +13 -0
- package/dist/components/CoreToolbar/CoreToolbar.js +205 -0
- package/dist/components/CoreToolbar/index.js +13 -0
- package/dist/components/CoreTracker/CoreTracker.js +52 -0
- package/dist/components/CoreTracker/index.js +13 -0
- package/dist/components/CoreTranslate/CoreTranslate.js +62 -0
- package/dist/components/CoreTranslate/README.md +5 -0
- package/dist/components/CoreTranslate/index.js +13 -0
- package/dist/components/CoreTranslate/translations/en.json +451 -0
- package/dist/components/CoreTranslate/translations/es.json +433 -0
- package/dist/components/CoreTranslateWrapper/CoreTranslateWrapper.js +36 -0
- package/dist/components/CoreTranslateWrapper/index.js +13 -0
- package/dist/components/CoreWidget/CoreWidget.js +120 -0
- package/dist/components/CoreWidget/index.js +13 -0
- package/dist/components/CoreWrapper/CoreWrapper.js +51 -0
- package/dist/components/CoreWrapper/README.md +41 -0
- package/dist/components/CoreWrapper/index.js +13 -0
- package/dist/components/index.js +202 -0
- package/dist/constants/index.js +20 -0
- package/dist/constants/testOrganization.js +31 -0
- package/dist/constants/testToken.js +33 -0
- package/dist/context/Authentication/AuthenticationContext.js +10 -0
- package/dist/context/Authentication/AuthenticationProvider.js +225 -0
- package/dist/context/Authentication/README.md +47 -0
- package/dist/context/Authentication/index.js +27 -0
- package/dist/context/Authentication/withAuthentication.js +15 -0
- package/dist/context/Channels/ChannelsConsumer.js +42 -0
- package/dist/context/Channels/ChannelsContext.js +10 -0
- package/dist/context/Channels/ChannelsProvider.js +258 -0
- package/dist/context/Channels/DataChannel.js +68 -0
- package/dist/context/Channels/EntityChannel.js +69 -0
- package/dist/context/Channels/EveryoneChannel.js +55 -0
- package/dist/context/Channels/OrganizationChannel.js +69 -0
- package/dist/context/Channels/README.md +52 -0
- package/dist/context/Channels/UserChannel.js +60 -0
- package/dist/context/Channels/index.js +69 -0
- package/dist/context/Channels/withChannels.js +15 -0
- package/dist/context/Core/CoreContext.js +10 -0
- package/dist/context/Core/CoreProvider.js +107 -0
- package/dist/context/Core/README.md +43 -0
- package/dist/context/Core/index.js +27 -0
- package/dist/context/Core/withCore.js +15 -0
- package/dist/context/Organization/OrganizationContext.js +10 -0
- package/dist/context/Organization/OrganizationProvider.js +113 -0
- package/dist/context/Organization/README.md +82 -0
- package/dist/context/Organization/index.js +27 -0
- package/dist/context/Organization/withOrganization.js +15 -0
- package/dist/context/Plugin/PluginContext.js +10 -0
- package/dist/context/Plugin/PluginProvider.js +78 -0
- package/dist/context/Plugin/index.js +27 -0
- package/dist/context/Plugin/withPlugin.js +15 -0
- package/dist/context/index.js +60 -0
- package/dist/css/index.js +20 -0
- package/dist/css/junk.module.css +3 -0
- package/dist/css/scrollbar.css +35 -0
- package/dist/css/scrollbar.module.css +37 -0
- package/dist/functions/TagEvaluator.js +165 -0
- package/dist/functions/compareObjects.js +27 -0
- package/dist/functions/formatElapsedTime.js +18 -0
- package/dist/functions/formatNameFileSafe.js +16 -0
- package/dist/functions/getIconUrl.js +15 -0
- package/dist/functions/getParameterByName.js +34 -0
- package/dist/functions/getProperty.js +17 -0
- package/dist/functions/getUrl.js +15 -0
- package/dist/functions/index.js +62 -0
- package/dist/icons/CopyIcon.js +42 -0
- package/dist/icons/DeleteIcon.js +42 -0
- package/dist/icons/DuplicateIcon.js +42 -0
- package/dist/icons/EditIcon.js +42 -0
- package/dist/icons/FabAddIcon.js +78 -0
- package/dist/icons/PasteIcon.js +42 -0
- package/dist/icons/index.js +48 -0
- package/dist/index.js +71 -0
- package/package.json +2 -2
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
10
|
+
var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
|
|
11
|
+
var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
|
|
12
|
+
var _DialogContent = _interopRequireDefault(require("@material-ui/core/DialogContent"));
|
|
13
|
+
var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
|
|
14
|
+
var _Slide = _interopRequireDefault(require("@material-ui/core/Slide"));
|
|
15
|
+
var _styles = require("@material-ui/core/styles");
|
|
16
|
+
var _reactIntl = require("react-intl");
|
|
17
|
+
var _CoreTable = _interopRequireDefault(require("../CoreTable"));
|
|
18
|
+
var _css = require("../../css");
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
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); } // import DialogContentText from '@material-ui/core/DialogContentText';
|
|
21
|
+
function Transition(props) {
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_Slide.default, _extends({
|
|
23
|
+
direction: "up"
|
|
24
|
+
}, props));
|
|
25
|
+
}
|
|
26
|
+
const styles = () => ({
|
|
27
|
+
scrollViewer: {
|
|
28
|
+
maxHeight: 'calc(100vh - 100px)'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
function CoreImportResultsDialog(props) {
|
|
32
|
+
const {
|
|
33
|
+
classes,
|
|
34
|
+
intl,
|
|
35
|
+
results
|
|
36
|
+
} = props;
|
|
37
|
+
const customCellStatus = _ref => {
|
|
38
|
+
let {
|
|
39
|
+
row
|
|
40
|
+
} = _ref;
|
|
41
|
+
switch (row.statusCode) {
|
|
42
|
+
case 'added':
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
44
|
+
id: "__added"
|
|
45
|
+
});
|
|
46
|
+
case 'updated':
|
|
47
|
+
return /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
48
|
+
id: "__updated"
|
|
49
|
+
});
|
|
50
|
+
default:
|
|
51
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
52
|
+
style: {
|
|
53
|
+
color: '#ff0000'
|
|
54
|
+
}
|
|
55
|
+
}, row.statusCode);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const columns = [{
|
|
59
|
+
id: 'id',
|
|
60
|
+
label: 'Id'
|
|
61
|
+
}, {
|
|
62
|
+
id: 'name',
|
|
63
|
+
label: intl.formatMessage({
|
|
64
|
+
id: '__name'
|
|
65
|
+
})
|
|
66
|
+
}, {
|
|
67
|
+
id: 'statusCode',
|
|
68
|
+
label: intl.formatMessage({
|
|
69
|
+
id: '__status'
|
|
70
|
+
}),
|
|
71
|
+
customCell: cc => customCellStatus(cc)
|
|
72
|
+
}];
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
|
|
74
|
+
open: true,
|
|
75
|
+
TransitionComponent: Transition,
|
|
76
|
+
keepMounted: true,
|
|
77
|
+
onClose: props.onClose
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_DialogTitle.default, null, "".concat(intl.formatMessage({
|
|
79
|
+
id: '__import_results'
|
|
80
|
+
}), " (").concat(results.length, ")")), /*#__PURE__*/_react.default.createElement(_DialogContent.default, {
|
|
81
|
+
className: "".concat(classes.scrollViewer, " ").concat(_css.ScrollbarStyles.scroll)
|
|
82
|
+
}, /*#__PURE__*/_react.default.createElement(_CoreTable.default, {
|
|
83
|
+
id: "id",
|
|
84
|
+
columns: columns,
|
|
85
|
+
data: results,
|
|
86
|
+
hover: false
|
|
87
|
+
})), /*#__PURE__*/_react.default.createElement(_DialogActions.default, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
88
|
+
color: "primary",
|
|
89
|
+
onClick: props.onClose
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
91
|
+
id: "__close"
|
|
92
|
+
}))));
|
|
93
|
+
}
|
|
94
|
+
CoreImportResultsDialog.propTypes = {
|
|
95
|
+
classes: _propTypes.default.shape().isRequired,
|
|
96
|
+
intl: _propTypes.default.shape().isRequired,
|
|
97
|
+
results: _propTypes.default.arrayOf(_propTypes.default.shape()),
|
|
98
|
+
onClose: _propTypes.default.func.isRequired
|
|
99
|
+
};
|
|
100
|
+
CoreImportResultsDialog.defaultProps = {
|
|
101
|
+
results: []
|
|
102
|
+
};
|
|
103
|
+
var _default = exports.default = (0, _reactIntl.injectIntl)((0, _styles.withStyles)(styles)(CoreImportResultsDialog));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CoreImportResultsDialog.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CoreImportResultsDialog = _interopRequireDefault(require("./CoreImportResultsDialog"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _LinearProgress = _interopRequireDefault(require("@material-ui/core/LinearProgress"));
|
|
10
|
+
var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
|
|
11
|
+
var _DialogContent = _interopRequireDefault(require("@material-ui/core/DialogContent"));
|
|
12
|
+
var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
|
|
13
|
+
var _Slide = _interopRequireDefault(require("@material-ui/core/Slide"));
|
|
14
|
+
var _FiberManualRecord = _interopRequireDefault(require("@material-ui/icons/FiberManualRecord"));
|
|
15
|
+
var _FiberManualRecordOutlined = _interopRequireDefault(require("@material-ui/icons/FiberManualRecordOutlined"));
|
|
16
|
+
var _reactIntl = require("react-intl");
|
|
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); }
|
|
19
|
+
function Transition(props) {
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_Slide.default, _extends({
|
|
21
|
+
direction: "up"
|
|
22
|
+
}, props));
|
|
23
|
+
}
|
|
24
|
+
function Importing(props) {
|
|
25
|
+
const {
|
|
26
|
+
plan,
|
|
27
|
+
waiting
|
|
28
|
+
} = props;
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
|
|
30
|
+
open: true,
|
|
31
|
+
keepMounted: true,
|
|
32
|
+
TransitionComponent: Transition
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement(_DialogTitle.default, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
|
|
34
|
+
id: "__importing"
|
|
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, ")")))));
|
|
51
|
+
}
|
|
52
|
+
Importing.propTypes = {
|
|
53
|
+
plan: _propTypes.default.arrayOf(_propTypes.default.shape()),
|
|
54
|
+
waiting: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
55
|
+
};
|
|
56
|
+
Importing.defaultProps = {
|
|
57
|
+
plan: [],
|
|
58
|
+
waiting: []
|
|
59
|
+
};
|
|
60
|
+
var _default = exports.default = Importing;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CoreImporting.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CoreImporting = _interopRequireDefault(require("./CoreImporting"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,134 @@
|
|
|
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 _context = require("../../context");
|
|
10
|
+
var _functions = require("../../functions");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
+
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); }
|
|
18
|
+
class CorePlugin extends _react.Component {
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
this.state = {
|
|
22
|
+
versaCallPluginId: Math.floor(Math.random() * 10000 + 9999)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
componentDidMount() {
|
|
26
|
+
// this.onReceiveMessageBinded = this.onReceiveMessage.bind(this);
|
|
27
|
+
window.addEventListener('message', e => this.onReceiveMessage(e));
|
|
28
|
+
}
|
|
29
|
+
componentDidUpdate(prevProps) {
|
|
30
|
+
if (this.props.withAuthentication && this.props.authentication.didChange(prevProps.authentication)) {
|
|
31
|
+
this.updateAuthentication();
|
|
32
|
+
}
|
|
33
|
+
if (this.props.withOrganization && this.props.organization.didChange(prevProps.organization)) {
|
|
34
|
+
this.updateOrganization();
|
|
35
|
+
}
|
|
36
|
+
if (JSON.stringify(this.props.controller) !== JSON.stringify(prevProps.controller)) {
|
|
37
|
+
this.postMessage({
|
|
38
|
+
controller: this.props.controller
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
componentWillUnmount() {
|
|
43
|
+
window.removeEventListener('message', e => this.onReceiveMessage(e), false);
|
|
44
|
+
}
|
|
45
|
+
onReceiveMessage(event) {
|
|
46
|
+
if (this.props.onChange && typeof event.data === 'object' && event.data.versaCallPluginId && event.data.versaCallPluginId === this.state.versaCallPluginId) {
|
|
47
|
+
this.props.onChange(event.data.controller);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
postMessage(message) {
|
|
51
|
+
this.ifr.contentWindow.postMessage(_objectSpread({
|
|
52
|
+
versaCallPluginId: this.state.versaCallPluginId
|
|
53
|
+
}, message), '*');
|
|
54
|
+
}
|
|
55
|
+
updateAuthentication() {
|
|
56
|
+
if (this.props.withAuthentication) {
|
|
57
|
+
this.postMessage({
|
|
58
|
+
authentication: JSON.parse(JSON.stringify(this.props.authentication))
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
updateOrganization() {
|
|
63
|
+
if (this.props.withOrganization) {
|
|
64
|
+
this.postMessage({
|
|
65
|
+
organization: JSON.parse(JSON.stringify(this.props.organization))
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
handleLoad() {
|
|
70
|
+
this.postMessage({
|
|
71
|
+
// id: this.state.id,
|
|
72
|
+
authentication: this.props.withAuthentication ? JSON.parse(JSON.stringify(this.props.authentication)) : null,
|
|
73
|
+
organization: this.props.withOrganization ? JSON.parse(JSON.stringify(this.props.organization)) : null,
|
|
74
|
+
controller: this.props.controller
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
const {
|
|
79
|
+
core,
|
|
80
|
+
plugin,
|
|
81
|
+
sandbox
|
|
82
|
+
} = this.props;
|
|
83
|
+
const {
|
|
84
|
+
versaCallPluginId
|
|
85
|
+
} = this.state;
|
|
86
|
+
return versaCallPluginId !== '' ? /*#__PURE__*/_react.default.createElement("iframe", {
|
|
87
|
+
frameBorder: "0",
|
|
88
|
+
title: "CorePluginFrame",
|
|
89
|
+
sandbox: sandbox,
|
|
90
|
+
onLoad: () => this.handleLoad(),
|
|
91
|
+
ref: f => {
|
|
92
|
+
this.ifr = f;
|
|
93
|
+
return this.ifr;
|
|
94
|
+
},
|
|
95
|
+
style: {
|
|
96
|
+
width: plugin.metadata.width,
|
|
97
|
+
height: plugin.metadata.height
|
|
98
|
+
},
|
|
99
|
+
src: "".concat(core.formatUrl((0, _functions.getUrl)(plugin.metadata)), "?version=").concat(encodeURI(plugin.version))
|
|
100
|
+
}) : /*#__PURE__*/_react.default.createElement("div", null);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
CorePlugin.propTypes = {
|
|
104
|
+
plugin: _propTypes.default.shape({
|
|
105
|
+
componentID: _propTypes.default.string,
|
|
106
|
+
componentType: _propTypes.default.string,
|
|
107
|
+
name: _propTypes.default.string,
|
|
108
|
+
description: _propTypes.default.string,
|
|
109
|
+
version: _propTypes.default.string,
|
|
110
|
+
translation: _propTypes.default.array,
|
|
111
|
+
metadata: _propTypes.default.shape({
|
|
112
|
+
url: _propTypes.default.string,
|
|
113
|
+
iconUrl: _propTypes.default.string,
|
|
114
|
+
width: _propTypes.default.string,
|
|
115
|
+
height: _propTypes.default.string
|
|
116
|
+
})
|
|
117
|
+
}).isRequired,
|
|
118
|
+
sandbox: _propTypes.default.string,
|
|
119
|
+
controller: _propTypes.default.shape(),
|
|
120
|
+
onChange: _propTypes.default.func,
|
|
121
|
+
core: _propTypes.default.shape().isRequired,
|
|
122
|
+
authentication: _propTypes.default.shape().isRequired,
|
|
123
|
+
organization: _propTypes.default.shape().isRequired,
|
|
124
|
+
withAuthentication: _propTypes.default.bool,
|
|
125
|
+
withOrganization: _propTypes.default.bool
|
|
126
|
+
};
|
|
127
|
+
CorePlugin.defaultProps = {
|
|
128
|
+
sandbox: null,
|
|
129
|
+
controller: {},
|
|
130
|
+
onChange: null,
|
|
131
|
+
withAuthentication: false,
|
|
132
|
+
withOrganization: false
|
|
133
|
+
};
|
|
134
|
+
var _default = exports.default = (0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)(CorePlugin)));
|
|
@@ -0,0 +1,124 @@
|
|
|
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 _context = require("../../context");
|
|
10
|
+
var _functions = require("../../functions");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
class CorePlugin extends _react.Component {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.state = {
|
|
17
|
+
id: Math.floor(Math.random() * 10000 + 9999)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
componentDidMount() {
|
|
21
|
+
window.addEventListener('message', e => this.onReceiveMessage(e));
|
|
22
|
+
}
|
|
23
|
+
componentDidUpdate(prevProps) {
|
|
24
|
+
if (this.props.withAuthentication && this.props.authentication !== prevProps.authentication) {
|
|
25
|
+
this.updateAuthentication();
|
|
26
|
+
}
|
|
27
|
+
if (this.props.withOrganization && this.props.organization !== prevProps.organization) {
|
|
28
|
+
this.updateOrganization();
|
|
29
|
+
}
|
|
30
|
+
if (this.props.controller !== prevProps.controller) {
|
|
31
|
+
this.postMessage(this.props.controller);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
componentWillUnmount() {
|
|
35
|
+
window.removeEventListener('message', e => this.onReceiveMessage(e), false);
|
|
36
|
+
}
|
|
37
|
+
onReceiveMessage(event) {
|
|
38
|
+
if (this.props.onChange && this.state.id === event.data.id) {
|
|
39
|
+
this.props.onChange(event);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
postMessage(message) {
|
|
43
|
+
this.ifr.contentWindow.postMessage(message, '*');
|
|
44
|
+
}
|
|
45
|
+
updateAuthentication() {
|
|
46
|
+
if (this.props.withAuthentication) {
|
|
47
|
+
this.postMessage({
|
|
48
|
+
authentication: JSON.parse(JSON.stringify(this.props.authentication))
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
updateOrganization() {
|
|
53
|
+
if (this.props.withOrganization) {
|
|
54
|
+
this.postMessage({
|
|
55
|
+
organization: JSON.parse(JSON.stringify(this.props.organization))
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
handleLoad() {
|
|
60
|
+
this.postMessage({
|
|
61
|
+
id: this.state.id,
|
|
62
|
+
authentication: this.props.withAuthentication ? JSON.parse(JSON.stringify(this.props.authentication)) : {},
|
|
63
|
+
organization: this.props.withOrganization ? JSON.parse(JSON.stringify(this.props.organization)) : {},
|
|
64
|
+
controller: this.props.controller
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
const {
|
|
69
|
+
core,
|
|
70
|
+
plugin,
|
|
71
|
+
sandbox
|
|
72
|
+
} = this.props;
|
|
73
|
+
const {
|
|
74
|
+
id
|
|
75
|
+
} = this.state;
|
|
76
|
+
return id !== '' ? /*#__PURE__*/_react.default.createElement("iframe", {
|
|
77
|
+
frameBorder: "0",
|
|
78
|
+
title: "CorePluginFrame",
|
|
79
|
+
sandbox: sandbox,
|
|
80
|
+
onLoad: () => this.handleLoad(),
|
|
81
|
+
ref: f => {
|
|
82
|
+
this.ifr = f;
|
|
83
|
+
return this.ifr;
|
|
84
|
+
},
|
|
85
|
+
style: {
|
|
86
|
+
width: plugin.metadata.width,
|
|
87
|
+
height: plugin.metadata.height
|
|
88
|
+
},
|
|
89
|
+
src: "".concat(core.formatUrl((0, _functions.getUrl)(plugin.metadata)), "?version=").concat(encodeURI(plugin.version))
|
|
90
|
+
}) : /*#__PURE__*/_react.default.createElement("div", null);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
CorePlugin.propTypes = {
|
|
94
|
+
plugin: _propTypes.default.shape({
|
|
95
|
+
componentID: _propTypes.default.string,
|
|
96
|
+
componentType: _propTypes.default.string,
|
|
97
|
+
name: _propTypes.default.string,
|
|
98
|
+
description: _propTypes.default.string,
|
|
99
|
+
version: _propTypes.default.string,
|
|
100
|
+
translation: _propTypes.default.array,
|
|
101
|
+
metadata: _propTypes.default.shape({
|
|
102
|
+
url: _propTypes.default.string,
|
|
103
|
+
iconUrl: _propTypes.default.string,
|
|
104
|
+
width: _propTypes.default.string,
|
|
105
|
+
height: _propTypes.default.string
|
|
106
|
+
})
|
|
107
|
+
}).isRequired,
|
|
108
|
+
sandbox: _propTypes.default.string,
|
|
109
|
+
controller: _propTypes.default.shape(),
|
|
110
|
+
onChange: _propTypes.default.func,
|
|
111
|
+
core: _propTypes.default.shape().isRequired,
|
|
112
|
+
authentication: _propTypes.default.shape().isRequired,
|
|
113
|
+
organization: _propTypes.default.shape().isRequired,
|
|
114
|
+
withAuthentication: _propTypes.default.bool,
|
|
115
|
+
withOrganization: _propTypes.default.bool
|
|
116
|
+
};
|
|
117
|
+
CorePlugin.defaultProps = {
|
|
118
|
+
sandbox: null,
|
|
119
|
+
controller: {},
|
|
120
|
+
onChange: null,
|
|
121
|
+
withAuthentication: false,
|
|
122
|
+
withOrganization: false
|
|
123
|
+
};
|
|
124
|
+
var _default = exports.default = (0, _context.withCore)((0, _context.withAuthentication)((0, _context.withOrganization)(CorePlugin)));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CorePlugin.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CorePlugin = _interopRequireDefault(require("./CorePlugin"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
var _DialogContentText = _interopRequireDefault(require("@material-ui/core/DialogContentText"));
|
|
9
|
+
var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
|
|
10
|
+
var _DialogContent = _interopRequireDefault(require("@material-ui/core/DialogContent"));
|
|
11
|
+
var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
|
|
12
|
+
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
13
|
+
var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
14
|
+
var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
|
|
15
|
+
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
16
|
+
var _reactIntl = require("react-intl");
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
const styles = {
|
|
20
|
+
closeButton: {
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
color: 'gray',
|
|
23
|
+
right: 10,
|
|
24
|
+
top: 10
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function CoreSaveChangesDialog(props) {
|
|
28
|
+
const {
|
|
29
|
+
intl,
|
|
30
|
+
open
|
|
31
|
+
} = props;
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
|
|
33
|
+
open: open
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(_DialogTitle.default, null, intl.formatMessage({
|
|
35
|
+
id: '__unsaved_title'
|
|
36
|
+
}), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
37
|
+
style: styles.closeButton,
|
|
38
|
+
onClick: () => props.close()
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_Close.default, null))), /*#__PURE__*/_react.default.createElement(_DialogContent.default, null, /*#__PURE__*/_react.default.createElement(_DialogContentText.default, null, intl.formatMessage({
|
|
40
|
+
id: '__unsaved_message'
|
|
41
|
+
}))), /*#__PURE__*/_react.default.createElement(_DialogActions.default, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
42
|
+
variant: "contained",
|
|
43
|
+
onClick: () => props.keep(),
|
|
44
|
+
color: "primary",
|
|
45
|
+
autoFocus: true
|
|
46
|
+
}, intl.formatMessage({
|
|
47
|
+
id: '__yes'
|
|
48
|
+
})), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
49
|
+
onClick: () => props.discard(),
|
|
50
|
+
color: "primary"
|
|
51
|
+
}, intl.formatMessage({
|
|
52
|
+
id: '__no'
|
|
53
|
+
}))));
|
|
54
|
+
}
|
|
55
|
+
CoreSaveChangesDialog.propTypes = {
|
|
56
|
+
intl: _propTypes.default.shape().isRequired,
|
|
57
|
+
discard: _propTypes.default.func.isRequired,
|
|
58
|
+
close: _propTypes.default.func.isRequired,
|
|
59
|
+
keep: _propTypes.default.func.isRequired,
|
|
60
|
+
open: _propTypes.default.bool.isRequired
|
|
61
|
+
};
|
|
62
|
+
var _default = exports.default = (0, _reactIntl.injectIntl)(CoreSaveChangesDialog);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CoreSaveChangesDialog.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CoreSaveChangesDialog = _interopRequireDefault(require("./CoreSaveChangesDialog"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|