@agilemotion/oui-react-js 1.3.8 → 1.4.0
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/README.TXT +1 -0
- package/dist/{ApplicationContext.js → ApplicationManager.js} +334 -335
- package/dist/BasicApp.js +67 -64
- package/dist/BasicAppHome.js +90 -110
- package/dist/BusinessPortalApp.js +1 -1
- package/dist/BusinessPortalAppHome.js +15 -50
- package/dist/DynamicJS.js +24 -52
- package/dist/RestUtils.js +90 -116
- package/dist/Utils.js +49 -37
- package/dist/WithRouter.js +34 -0
- package/dist/assets/jss/components/authNavbarStyle.js +34 -35
- package/dist/assets/jss/components/cardHeaderStyle.js +12 -12
- package/dist/assets/jss/components/customDropdownStyle.js +26 -26
- package/dist/assets/jss/components/customInputStyle.js +2 -8
- package/dist/assets/jss/components/dropdownStyle.js +10 -15
- package/dist/assets/jss/components/footerStyle.js +12 -18
- package/dist/assets/jss/components/headerLinksStyle.js +7 -13
- package/dist/assets/jss/components/headerStyle.js +24 -25
- package/dist/assets/jss/components/navbarLinksStyle.js +7 -13
- package/dist/assets/jss/components/navbarStyle.js +24 -25
- package/dist/assets/jss/components/sidebarStyle.js +41 -43
- package/dist/assets/jss/components/typographyStyle.js +2 -8
- package/dist/assets/jss/rootStyle.js +32 -47
- package/dist/assets/jss/views/layoutStyle.js +6 -11
- package/dist/assets/jss/views/loginStyle.js +4 -10
- package/dist/assets/lotties/call-loading.json +1 -0
- package/dist/assets/lotties/calling-2.json +1 -0
- package/dist/assets/lotties/calling.json +1 -0
- package/dist/assets/lotties/calling2.json +1 -0
- package/dist/assets/lotties/chat.json +1 -0
- package/dist/assets/lotties/join.json +1 -0
- package/dist/assets/lotties/loading.json +1 -0
- package/dist/assets/lotties/msg2.json +1 -0
- package/dist/assets/lotties/recording.json +1 -0
- package/dist/assets/lotties/waiting.json +1 -0
- package/dist/assets/scss/black-dashboard-react/bootstrap/_card.scss +5 -5
- package/dist/assets/scss/black-dashboard-react/bootstrap/_carousel.scss +2 -2
- package/dist/assets/scss/black-dashboard-react/bootstrap/_custom-forms.scss +3 -3
- package/dist/assets/scss/black-dashboard-react/bootstrap/_functions.scss +1 -1
- package/dist/assets/scss/black-dashboard-react/bootstrap/_images.scss +1 -1
- package/dist/assets/scss/black-dashboard-react/bootstrap/_jumbotron.scss +1 -1
- package/dist/assets/scss/black-dashboard-react/bootstrap/_popover.scss +7 -5
- package/dist/assets/scss/black-dashboard-react/bootstrap/_tooltip.scss +4 -4
- package/dist/assets/scss/black-dashboard-react/bootstrap/_variables.scss +5 -5
- package/dist/assets/scss/black-dashboard-react/bootstrap/mixins/_grid-framework.scss +2 -2
- package/dist/assets/scss/black-dashboard-react/bootstrap/mixins/_grid.scss +11 -9
- package/dist/assets/scss/black-dashboard-react/bootstrap/utilities/_embed.scss +6 -4
- package/dist/assets/scss/black-dashboard-react/custom/_sidebar-and-main-panel.scss +1 -1
- package/dist/assets/scss/black-dashboard-react/custom/_variables.scss +1 -1
- package/dist/components/AlertBar.js +39 -80
- package/dist/components/AlertItem.js +4 -26
- package/dist/components/Button.js +49 -52
- package/dist/components/Calendar.js +442 -0
- package/dist/components/Calender.css +244 -0
- package/dist/components/ConfirmationDialog.js +5 -29
- package/dist/components/DataGrid.js +207 -345
- package/dist/components/DataGridColumn.js +6 -29
- package/dist/components/DataGridFilter.js +48 -116
- package/dist/components/DataGridHeading.js +11 -19
- package/dist/components/Dialog.js +27 -121
- package/dist/components/DocumentViewer.js +12 -38
- package/dist/components/DocumentViewerComponent.js +2 -20
- package/dist/components/FileThumb.js +126 -0
- package/dist/components/Graph.js +33 -75
- package/dist/components/GraphNode.js +5 -22
- package/dist/components/HtmlPanel.js +68 -82
- package/dist/components/Icon.js +107 -1
- package/dist/components/LoadingIndicator.js +4 -4
- package/dist/components/LottieIcon.js +134 -0
- package/dist/components/PopupView.js +3 -21
- package/dist/components/Portlet.js +100 -0
- package/dist/components/RegularButton.js +15 -19
- package/dist/components/SignaturePanel.js +9 -40
- package/dist/components/SocketManager.js +170 -0
- package/dist/components/StepperTitleBar.js +33 -59
- package/dist/components/TabPage.js +6 -9
- package/dist/components/TabPanel.js +49 -98
- package/dist/components/TableCellContent.js +31 -39
- package/dist/components/TemplateDesigner.js +114 -158
- package/dist/components/TemplateItemEventHandler.js +33 -100
- package/dist/components/TemplateTable.js +6 -42
- package/dist/components/TitleBar.js +38 -54
- package/dist/components/Toolbar.js +67 -182
- package/dist/components/Tree.js +29 -66
- package/dist/components/card/Card.js +16 -20
- package/dist/components/card/CardAvatar.js +9 -13
- package/dist/components/card/CardBody.js +13 -17
- package/dist/components/card/CardFooter.js +12 -16
- package/dist/components/card/CardHeader.js +13 -17
- package/dist/components/card/CardIcon.js +6 -10
- package/dist/components/card/CardText.js +6 -10
- package/dist/components/customInput/CustomInput.js +12 -10
- package/dist/components/dashboard/BasicBusinessAppDashboard.js +85 -159
- package/dist/components/dashboard/BusinessPortalAppDashboard.js +30 -75
- package/dist/components/dashboard/components/Header.js +9 -26
- package/dist/components/dashboard/components/LeftDrawer.js +3 -1
- package/dist/components/dashboard/components/blackDashboard/fixedPlugin/FixedPlugin.js +1 -1
- package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.css +7 -0
- package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.js +189 -79
- package/dist/components/footer/Footer.js +6 -18
- package/dist/components/form/AddressSearch.js +32 -66
- package/dist/components/form/AutoComplete.js +161 -0
- package/dist/components/form/BaseField.js +89 -107
- package/dist/components/form/DatePicker.js +8 -23
- package/dist/components/form/FieldSet.js +161 -191
- package/dist/components/form/Form.css +1 -1
- package/dist/components/form/Form.js +153 -479
- package/dist/components/form/GridField.js +46 -146
- package/dist/components/form/IconField.js +35 -0
- package/dist/components/form/ImageEditor.js +22 -60
- package/dist/components/form/LookupField.js +8 -29
- package/dist/components/form/MultiFileUploadField.js +187 -0
- package/dist/components/form/RadioGroup.js +10 -26
- package/dist/components/form/Section.js +40 -91
- package/dist/components/form/SelectItem.js +14 -33
- package/dist/components/form/SignatureTemplateDesignerField.js +0 -1
- package/dist/components/form/Switch.js +53 -0
- package/dist/components/form/TextField.js +10 -17
- package/dist/components/form/TimePicker.js +8 -1
- package/dist/components/form/TransferList.css +2 -2
- package/dist/components/form/TransferList.js +67 -125
- package/dist/components/form/UploadField.js +132 -177
- package/dist/components/form/fieldset.css +8 -0
- package/dist/components/grid/GridContainer.js +5 -9
- package/dist/components/grid/GridItem.js +5 -9
- package/dist/components/layout/CollapsiblePanel.js +11 -33
- package/dist/components/layout/Layout.js +228 -290
- package/dist/components/layout/VC.css +17 -0
- package/dist/components/layout/View.css +18 -1
- package/dist/components/layout/View.js +80 -200
- package/dist/components/layout/ViewContainer.css +3 -0
- package/dist/components/layout/ViewContainer.js +59 -0
- package/dist/components/layout/ViewPort.js +50 -80
- package/dist/components/layout/Window.css +18 -0
- package/dist/components/layout/Window.js +287 -0
- package/dist/components/layout/WindowViewPort.js +71 -0
- package/dist/components/loader.css +1 -1
- package/dist/components/media/ClosablePanel.css +37 -0
- package/dist/components/media/ClosablePanel.js +53 -0
- package/dist/components/media/LobbyWaitingList.js +91 -0
- package/dist/components/media/MediaSoupHelper.js +223 -0
- package/dist/components/media/Recorder.js +235 -0
- package/dist/components/media/SideBarContent.css +54 -0
- package/dist/components/media/SideBarContent.js +46 -0
- package/dist/components/media/SocketRequest.js +20 -0
- package/dist/components/media/SocketResponse.js +16 -0
- package/dist/components/media/Timer.css +30 -0
- package/dist/components/media/Timer.js +88 -0
- package/dist/components/media/Toolbar.css +35 -0
- package/dist/components/media/Toolbar.js +494 -0
- package/dist/components/media/Tracks.js +39 -0
- package/dist/components/media/TrainingRoom.js +608 -0
- package/dist/components/media/Transports.js +35 -0
- package/dist/components/media/VCEventManager.js +74 -0
- package/dist/components/media/VCEventType.js +164 -0
- package/dist/components/media/VCParticipantList.css +72 -0
- package/dist/components/media/VCParticipantList.js +56 -0
- package/dist/components/media/VCParticipantListItem.css +73 -0
- package/dist/components/media/VCParticipantListItem.js +319 -0
- package/dist/components/media/VCRoom.css +42 -0
- package/dist/components/media/VCRoom.js +90 -0
- package/dist/components/media/VCRoomParticipant.css +25 -0
- package/dist/components/media/VCRoomParticipant.js +808 -0
- package/dist/components/media/VCRoomRecorder.js +223 -0
- package/dist/components/media/VCRoomWorkspace.css +86 -0
- package/dist/components/media/VCRoomWorkspace.js +666 -0
- package/dist/components/media/Video.css +4 -0
- package/dist/components/media/Video.js +131 -0
- package/dist/components/media/VideoPlayer.css +10 -0
- package/dist/components/media/VideoPlayer.js +86 -0
- package/dist/components/media/chat/ChatRoom.js +926 -0
- package/dist/components/media/chat/ChatRoomItem.js +83 -0
- package/dist/components/media/chat/ChatRoomList.js +78 -0
- package/dist/components/media/chat/ChatRooms.scss +567 -0
- package/dist/components/menu/CollapsibleMenu.js +2 -19
- package/dist/components/menu/MenuBars.js +6 -33
- package/dist/components/menu/MenuButton.js +27 -39
- package/dist/components/menu/MenuItem.js +3 -20
- package/dist/components/menu/MenuLink.js +22 -13
- package/dist/components/navbars/AuthNavbar.js +5 -18
- package/dist/components/navbars/HomeNavbar.js +5 -7
- package/dist/components/navbars/PortalNavbar.js +7 -25
- package/dist/components/signatures/AgilitySignaturePanel.js +38 -104
- package/dist/components/signatures/AlertItem.js +3 -24
- package/dist/components/signatures/DocumentContainer.js +47 -134
- package/dist/components/signatures/ImageSignatureInput.js +11 -38
- package/dist/components/signatures/MenuButton.js +1 -16
- package/dist/components/signatures/Prompt.js +3 -24
- package/dist/components/signatures/ResponsiveTable.js +42 -83
- package/dist/components/signatures/SearchView.js +13 -50
- package/dist/components/signatures/SignatorySearch.js +83 -99
- package/dist/components/signatures/SignatorySearchForm.js +11 -17
- package/dist/components/signatures/SignatureInput.js +18 -47
- package/dist/components/signatures/SignatureInputProps.js +18 -60
- package/dist/components/signatures/SignatureTemplateDesigner.js +151 -239
- package/dist/components/signatures/Toolbar.js +7 -34
- package/dist/components/signatures/ViewUtils.js +2 -6
- package/dist/components/typography/Danger.js +3 -1
- package/dist/components/typography/Info.js +3 -1
- package/dist/components/typography/Link.js +6 -2
- package/dist/event/ActionHandlers.js +6 -6
- package/dist/event/EventType.js +7 -1
- package/dist/event/LoadDataActionHandler.js +1 -1
- package/dist/event/Observable.js +80 -174
- package/dist/event/RouteActionHandler.js +74 -31
- package/dist/event/ServiceCallActionHandler.js +36 -24
- package/dist/event/SignalGraphActionHandler.js +2 -2
- package/dist/js/Addresses.js +10 -8
- package/dist/js/Calendar.js +220 -0
- package/dist/js/Media.js +157 -0
- package/dist/redux/store/ConfigureStore.js +3 -9
- package/dist/redux/store/DashboardStore.js +42 -94
- package/dist/redux/store/SecurityStore.js +15 -50
- package/dist/view/Dashboard.js +256 -171
- package/dist/view/Views.js +30 -0
- package/dist/view/security/ChangePasswordBasic.js +29 -80
- package/dist/view/security/ForgotPassword.js +13 -46
- package/dist/view/security/ForgotPasswordBasic.js +12 -45
- package/dist/view/security/Login.js +15 -51
- package/dist/view/security/LoginBasic.js +13 -46
- package/dist/view/security/LoginBusinessPortal.js +12 -45
- package/dist/view/security/ResetPassword.js +13 -51
- package/dist/view/security/ResetPasswordBasic.js +27 -75
- package/dist/view/security/Security.js +1 -0
- package/package.json +31 -25
- package/README.md +0 -1623
- package/dist/components/dashboard/BasicApp.js +0 -140
- package/dist/components/navbars/NavbarLinks.js +0 -212
- package/dist/components/signatures/OLD.js +0 -1138
- package/gulpfile.js +0 -77
package/dist/DynamicJS.js
CHANGED
|
@@ -5,22 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.TEMPLATE_REGEX = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _ApplicationManager = _interopRequireWildcard(require("./ApplicationManager"));
|
|
9
9
|
|
|
10
10
|
var _Utils = _interopRequireDefault(require("./Utils"));
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function
|
|
14
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
|
|
17
17
|
|
|
18
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
19
|
-
|
|
20
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
-
|
|
22
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
23
|
-
|
|
24
18
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
19
|
|
|
26
20
|
const TEMPLATE_REGEX = new RegExp('[@]{1}([#@]{1}{)(([a-zA-Z0-9_.[\\]]*)+){1}}((\\(([^)]*)\\))*)', 'g');
|
|
@@ -28,36 +22,31 @@ exports.TEMPLATE_REGEX = TEMPLATE_REGEX;
|
|
|
28
22
|
|
|
29
23
|
class DynamicJS {
|
|
30
24
|
constructor() {
|
|
25
|
+
_defineProperty(this, "removeKey", (k = "", {
|
|
26
|
+
[k]: _,
|
|
27
|
+
...o
|
|
28
|
+
} = {}) => o);
|
|
29
|
+
|
|
30
|
+
_defineProperty(this, "removeKeys", (keys = [], o = {}) => o ? keys.reduce((r, k) => this.removeKey(k, r), o) : null);
|
|
31
|
+
|
|
31
32
|
_defineProperty(this, "evaluateExpression", expression => {
|
|
32
|
-
return
|
|
33
|
+
return _ApplicationManager.default.resolveExpressionValue(expression);
|
|
33
34
|
});
|
|
34
35
|
|
|
35
36
|
_defineProperty(this, "parseScript", (script, componentId, isScriptlet) => {
|
|
36
|
-
let parsedScript = script.replace(/#this/g, '#' + componentId).replace(/isNull/g, 'this.isNull').replace(/\$application/g,
|
|
37
|
+
let parsedScript = script.replace(/#this/g, '#' + componentId).replace(/isNull/g, 'this.isNull').replace(/removeKeys/g, 'this.removeKeys').replace(/\$application/g, '@#{' + _ApplicationManager.APP_VARIABLE + "}").replace(/isEmpty/g, 'this.isEmpty');
|
|
37
38
|
let matches = parsedScript.match(TEMPLATE_REGEX);
|
|
38
39
|
|
|
39
40
|
if (!_Utils.default.isNull(matches)) {
|
|
40
41
|
let expressions = [];
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
47
|
-
const match = _step.value;
|
|
48
|
-
|
|
49
|
-
if (!expressions.includes(match.trim())) {
|
|
50
|
-
expressions.push(match.trim());
|
|
51
|
-
}
|
|
43
|
+
for (const match of matches) {
|
|
44
|
+
if (!expressions.includes(match.trim())) {
|
|
45
|
+
expressions.push(match.trim());
|
|
52
46
|
}
|
|
53
|
-
} catch (err) {
|
|
54
|
-
_iterator.e(err);
|
|
55
|
-
} finally {
|
|
56
|
-
_iterator.f();
|
|
57
47
|
}
|
|
58
48
|
|
|
59
|
-
for (
|
|
60
|
-
const expression = _expressions[_i];
|
|
49
|
+
for (const expression of expressions) {
|
|
61
50
|
var replaceRegex = new RegExp("".concat(expression), 'g');
|
|
62
51
|
parsedScript = parsedScript.replace(replaceRegex, "this.evaluateExpression(\"".concat(expression, "\")"));
|
|
63
52
|
}
|
|
@@ -85,9 +74,8 @@ class DynamicJS {
|
|
|
85
74
|
return result;
|
|
86
75
|
}
|
|
87
76
|
} catch (e) {
|
|
88
|
-
console.error("Error Executing script : " + name + " - " + parsedScript);
|
|
89
77
|
console.error(e);
|
|
90
|
-
throw e;
|
|
78
|
+
throw new Error("Error Executing script : " + parsedScript + " - " + e.message);
|
|
91
79
|
}
|
|
92
80
|
|
|
93
81
|
return null;
|
|
@@ -96,18 +84,12 @@ class DynamicJS {
|
|
|
96
84
|
_defineProperty(this, "executeScriptObject", (name, script, componentId = null, valuesMap = {}, event = null) => {
|
|
97
85
|
let scriptBody = '';
|
|
98
86
|
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
for (const line of script.lines) {
|
|
88
|
+
scriptBody += this.parseScriptLine(line, valuesMap);
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const line = _step2.value;
|
|
105
|
-
scriptBody += this.parseScriptLine(line, valuesMap);
|
|
90
|
+
if (!line.endsWith(";")) {
|
|
91
|
+
scriptBody += ";";
|
|
106
92
|
}
|
|
107
|
-
} catch (err) {
|
|
108
|
-
_iterator2.e(err);
|
|
109
|
-
} finally {
|
|
110
|
-
_iterator2.f();
|
|
111
93
|
}
|
|
112
94
|
|
|
113
95
|
return this.executeScript(name, scriptBody, componentId, false, event);
|
|
@@ -138,20 +120,10 @@ class DynamicJS {
|
|
|
138
120
|
if (!_Utils.default.isNull(valuesMap)) {
|
|
139
121
|
const properties = Object.getOwnPropertyNames(valuesMap);
|
|
140
122
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
146
|
-
const property = _step3.value;
|
|
147
|
-
var replaceRegex = new RegExp("@{".concat(property, "}"), 'g');
|
|
148
|
-
let propertyValue = valuesMap[property];
|
|
149
|
-
parsedLine = parsedLine.replace(replaceRegex, propertyValue);
|
|
150
|
-
}
|
|
151
|
-
} catch (err) {
|
|
152
|
-
_iterator3.e(err);
|
|
153
|
-
} finally {
|
|
154
|
-
_iterator3.f();
|
|
123
|
+
for (const property of properties) {
|
|
124
|
+
var replaceRegex = new RegExp("@{".concat(property, "}"), 'g');
|
|
125
|
+
let propertyValue = valuesMap[property];
|
|
126
|
+
parsedLine = parsedLine.replace(replaceRegex, propertyValue);
|
|
155
127
|
}
|
|
156
128
|
}
|
|
157
129
|
|
package/dist/RestUtils.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.invokeRest = exports.invokeRpc = exports.download = exports.sendRequest = exports.postData = void 0;
|
|
6
|
+
exports.invokeRest = exports.invokeRpc = exports.download = exports.sendRequest = exports.postData = exports.location = void 0;
|
|
7
7
|
|
|
8
8
|
var _Utils = _interopRequireDefault(require("./Utils"));
|
|
9
9
|
|
|
10
10
|
var _reactPromiseTracker = require("react-promise-tracker");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _ApplicationManager = _interopRequireDefault(require("./ApplicationManager"));
|
|
13
13
|
|
|
14
14
|
var _Event = _interopRequireDefault(require("./event/Event"));
|
|
15
15
|
|
|
@@ -19,13 +19,8 @@ var _EventType = _interopRequireDefault(require("./event/EventType"));
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
-
|
|
26
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
27
|
-
|
|
28
|
-
const location = window.location.protocol + "//" + window.location.hostname;
|
|
22
|
+
const location = window.location.protocol + '//' + window.location.hostname;
|
|
23
|
+
exports.location = location;
|
|
29
24
|
|
|
30
25
|
const status = response => {
|
|
31
26
|
if (response.ok) {
|
|
@@ -51,85 +46,75 @@ class RestUtils {
|
|
|
51
46
|
}
|
|
52
47
|
|
|
53
48
|
invokeRest(service, component, viewId, successCallback, errorCallback, invalidParamCallback, returnValueBinding, successMessage, event = null) {
|
|
54
|
-
let url = service.url.startsWith('http://') || service.url.startsWith('https://') ? service.url : location + "".concat(
|
|
49
|
+
let url = service.url.startsWith('http://') || service.url.startsWith('https://') ? service.url : location + "".concat(_ApplicationManager.default.getContextRoot() + service.url);
|
|
55
50
|
let requestBody = null;
|
|
56
51
|
|
|
57
52
|
if (!_Utils.default.isNull(service.parameters)) {
|
|
58
|
-
let queryString =
|
|
59
|
-
let pathParameters =
|
|
53
|
+
let queryString = '';
|
|
54
|
+
let pathParameters = '';
|
|
60
55
|
let requestBodyParamFound = false;
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
67
|
-
const parameter = _step.value;
|
|
68
|
-
|
|
69
|
-
let parameterValue = _ApplicationContext.default.resolveParameterValue(parameter, event ? event.data : null);
|
|
57
|
+
for (const parameter of service.parameters) {
|
|
58
|
+
let parameterValue = _ApplicationManager.default.resolveParameterValue(parameter, event ? event.data : null);
|
|
70
59
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return;
|
|
60
|
+
if (!_Utils.default.isNull(parameter.validator) && !_Utils.default.evaluateBooleanExpression(parameter.validator.nullable, parameter.name) && this.isParamValueNull(parameterValue)) {
|
|
61
|
+
if (!_Utils.default.isNull(invalidParamCallback)) {
|
|
62
|
+
console.error('INVALID PARAMETER : ', parameter);
|
|
63
|
+
invalidParamCallback(parameter);
|
|
77
64
|
}
|
|
78
65
|
|
|
79
|
-
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
80
68
|
|
|
81
|
-
|
|
82
|
-
httpParameterType = 'REQUEST_PARAMETER';
|
|
83
|
-
}
|
|
69
|
+
let httpParameterType = parameter.httpParameterType;
|
|
84
70
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
queryString += '&';
|
|
89
|
-
}
|
|
71
|
+
if (_Utils.default.isNull(httpParameterType)) {
|
|
72
|
+
httpParameterType = 'QUERY_PARAMETER';
|
|
73
|
+
}
|
|
90
74
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
75
|
+
if (httpParameterType === 'QUERY_PARAMETER') {
|
|
76
|
+
if (!_Utils.default.isNull(parameterValue)) {
|
|
77
|
+
if (queryString.length > 0) {
|
|
78
|
+
queryString += '&';
|
|
79
|
+
}
|
|
94
80
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
if (!_Utils.default.isNull(service.includeParameterTypes) && service.includeParameterTypes === true) {
|
|
82
|
+
queryString += parameterValue.type + ':';
|
|
83
|
+
}
|
|
98
84
|
|
|
99
|
-
|
|
100
|
-
|
|
85
|
+
if (parameterValue.type === 'MapObject') {
|
|
86
|
+
parameterValue.value.type = 'MapEntityDto';
|
|
101
87
|
}
|
|
88
|
+
|
|
89
|
+
queryString += parameter.name + '=';
|
|
90
|
+
queryString += typeof parameterValue.value === 'string' || typeof parameterValue.value === 'number' ? parameterValue.value : JSON.stringify(parameterValue.value);
|
|
102
91
|
}
|
|
92
|
+
}
|
|
103
93
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
94
|
+
if (httpParameterType === 'PATH_VARIABLE') {
|
|
95
|
+
if (!_Utils.default.isNull(parameterValue)) {
|
|
96
|
+
pathParameters += '/' + (typeof parameterValue.value === 'object' ? JSON.stringify(parameterValue.value) : parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue);
|
|
108
97
|
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (httpParameterType === 'REQUEST_BODY') {
|
|
101
|
+
if (requestBodyParamFound) {
|
|
102
|
+
console.error('Only one request body is permitted');
|
|
103
|
+
return;
|
|
104
|
+
} else {
|
|
105
|
+
if (!this.isParamValueNull(parameterValue)) {
|
|
106
|
+
requestBody = parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue;
|
|
109
107
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (!this.isParamValueNull(parameterValue)) {
|
|
116
|
-
requestBody = parameterValue.instanceType === 'TypedValue' ? parameterValue.value : parameterValue;
|
|
117
|
-
|
|
118
|
-
if (parameterValue.type === 'MapObject') {
|
|
119
|
-
requestBody.type = 'MapEntityDto';
|
|
120
|
-
} else {
|
|
121
|
-
if (typeof requestBody === 'object') {
|
|
122
|
-
requestBody.type = parameterValue.type;
|
|
123
|
-
}
|
|
108
|
+
if (parameterValue.type === 'MapObject') {
|
|
109
|
+
requestBody.type = 'MapEntityDto';
|
|
110
|
+
} else {
|
|
111
|
+
if (typeof requestBody === 'object') {
|
|
112
|
+
requestBody.type = parameterValue.type;
|
|
124
113
|
}
|
|
125
114
|
}
|
|
126
115
|
}
|
|
127
116
|
}
|
|
128
117
|
}
|
|
129
|
-
} catch (err) {
|
|
130
|
-
_iterator.e(err);
|
|
131
|
-
} finally {
|
|
132
|
-
_iterator.f();
|
|
133
118
|
}
|
|
134
119
|
|
|
135
120
|
if (pathParameters.length > 0) {
|
|
@@ -150,15 +135,13 @@ class RestUtils {
|
|
|
150
135
|
}
|
|
151
136
|
|
|
152
137
|
if (requestBody !== null && service.method === 'GET') {
|
|
153
|
-
|
|
154
|
-
return;
|
|
138
|
+
throw new Error('A request body parameter cannot be specified for a GET request');
|
|
155
139
|
}
|
|
156
140
|
|
|
157
141
|
if (requestBody !== null || service.method === 'POST') {
|
|
142
|
+
console.log("POSTING REST REQUEST BODY : ", requestBody);
|
|
158
143
|
postData(url, response => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (!_Utils.default.isNull(responseData) && response.dataType === 'message' && responseData.messageType === "ERROR") {
|
|
144
|
+
if (!_Utils.default.isNull(response) && response.dataType === 'message' && response.messageType === 'ERROR') {
|
|
162
145
|
this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_FAILURE);
|
|
163
146
|
} else {
|
|
164
147
|
if (!_Utils.default.isNull(successCallback)) {
|
|
@@ -179,8 +162,8 @@ class RestUtils {
|
|
|
179
162
|
}
|
|
180
163
|
|
|
181
164
|
this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_FAILURE);
|
|
182
|
-
}, !service.url.startsWith(
|
|
183
|
-
} else if (contentType ===
|
|
165
|
+
}, !service.url.startsWith('http://'), requestBody);
|
|
166
|
+
} else if (contentType === 'application/pdf' || contentType === 'application/vnd.ms-excel') {
|
|
184
167
|
download(url, data => {}, e => {
|
|
185
168
|
if (!_Utils.default.isNull(errorCallback)) {
|
|
186
169
|
errorCallback(e);
|
|
@@ -205,15 +188,17 @@ class RestUtils {
|
|
|
205
188
|
if (!_Utils.default.isNull(errorCallback)) {
|
|
206
189
|
errorCallback(e);
|
|
207
190
|
}
|
|
208
|
-
}, !service.url.startsWith(
|
|
191
|
+
}, !service.url.startsWith('http://'));
|
|
209
192
|
}
|
|
210
193
|
}
|
|
211
194
|
|
|
212
195
|
invokeRpc(rpcDetails, component, viewId, successCallback, errorCallback, invalidParamCallback, returnValueBinding, successMessage, event = null) {
|
|
213
196
|
let request = {};
|
|
214
197
|
request.id = viewId;
|
|
215
|
-
|
|
198
|
+
let split = rpcDetails.serviceId.split('.');
|
|
199
|
+
request.service = split[1];
|
|
216
200
|
request.method = rpcDetails.procedureName;
|
|
201
|
+
let module = split[0].toLowerCase();
|
|
217
202
|
|
|
218
203
|
if (!_Utils.default.isNull(rpcDetails.parameters) && rpcDetails.parameters.length > 0) {
|
|
219
204
|
request.parameters = [];
|
|
@@ -224,7 +209,7 @@ class RestUtils {
|
|
|
224
209
|
parameter.name = parameterConfig.name;
|
|
225
210
|
parameter.index = parameterConfig.index;
|
|
226
211
|
|
|
227
|
-
let val =
|
|
212
|
+
let val = _ApplicationManager.default.resolveParameterValue(parameterConfig, event ? event.data : null);
|
|
228
213
|
|
|
229
214
|
if (!_Utils.default.isNull(val)) {
|
|
230
215
|
parameter.value = val.value; // TODO : Make the default object type a library setting
|
|
@@ -236,7 +221,7 @@ class RestUtils {
|
|
|
236
221
|
}
|
|
237
222
|
}
|
|
238
223
|
|
|
239
|
-
if (typeof parameter.value ===
|
|
224
|
+
if (typeof parameter.value === 'undefined') {
|
|
240
225
|
parameter.value = null;
|
|
241
226
|
}
|
|
242
227
|
|
|
@@ -246,6 +231,7 @@ class RestUtils {
|
|
|
246
231
|
|
|
247
232
|
if (!_Utils.default.isNull(parameterConfig.validator) && _Utils.default.evaluateBooleanExpression(parameterConfig.validator.nullable, parameterConfig.name) === false && this.isParamValueNull(parameter)) {
|
|
248
233
|
if (!_Utils.default.isNull(invalidParamCallback)) {
|
|
234
|
+
console.error('INVALID PARAMETER : ', parameter);
|
|
249
235
|
invalidParamCallback(parameter);
|
|
250
236
|
}
|
|
251
237
|
|
|
@@ -256,11 +242,7 @@ class RestUtils {
|
|
|
256
242
|
}
|
|
257
243
|
}
|
|
258
244
|
|
|
259
|
-
this.doFetch(location +
|
|
260
|
-
if (successCallback !== null) {
|
|
261
|
-
successCallback(response);
|
|
262
|
-
}
|
|
263
|
-
|
|
245
|
+
this.doFetch(location + _ApplicationManager.default.getContextRoot() + '/' + module + '/api/v1/rpc/invoke', response => {
|
|
264
246
|
if (!_Utils.default.isNull(viewId) && !_Utils.default.isNull(component)) {
|
|
265
247
|
let path = _Utils.default.getPropertyChainPath(returnValueBinding);
|
|
266
248
|
|
|
@@ -270,10 +252,18 @@ class RestUtils {
|
|
|
270
252
|
|
|
271
253
|
let responseData = !_Utils.default.isNull(response) ? response.data : null;
|
|
272
254
|
|
|
273
|
-
if (!_Utils.default.isNull(responseData) && response.dataType === 'message' && responseData.messageType ===
|
|
274
|
-
this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_FAILURE);
|
|
255
|
+
if (!_Utils.default.isNull(responseData) && response.dataType === 'message' && responseData.messageType === 'ERROR') {
|
|
256
|
+
this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_FAILURE, responseData);
|
|
257
|
+
|
|
258
|
+
if (errorCallback !== null) {
|
|
259
|
+
errorCallback(response);
|
|
260
|
+
}
|
|
275
261
|
} else {
|
|
276
262
|
this.fireEvent(viewId, component, _EventType.default.SERVICE_CALL_SUCCESS, response.data);
|
|
263
|
+
|
|
264
|
+
if (successCallback !== null) {
|
|
265
|
+
successCallback(response);
|
|
266
|
+
}
|
|
277
267
|
}
|
|
278
268
|
}
|
|
279
269
|
}, e => {
|
|
@@ -296,28 +286,8 @@ class RestUtils {
|
|
|
296
286
|
}
|
|
297
287
|
|
|
298
288
|
fetchWithCustomConfig(url, successCallback, errorCallback, secure, config, method, download, body, serviceType, viewId, successMessage, track) {
|
|
299
|
-
const accessToken = sessionStorage.getItem(
|
|
300
|
-
const idToken = sessionStorage.getItem(
|
|
301
|
-
/*let data = null;
|
|
302
|
-
if(serviceType === 'rest') {
|
|
303
|
-
data = JSON.stringify(body);
|
|
304
|
-
} else {
|
|
305
|
-
if (!Utils.isNull(body)) {
|
|
306
|
-
data = new FormData();
|
|
307
|
-
const json = JSON.stringify(body);
|
|
308
|
-
data.append("requestDto", json);
|
|
309
|
-
let currentView = applicationContext.getCurrentView();
|
|
310
|
-
if (!Utils.isNull(currentView)) {
|
|
311
|
-
let domainCache = applicationContext.getFileDomainCache(currentView.config.id);
|
|
312
|
-
if (!Utils.isNull(domainCache)) {
|
|
313
|
-
for (const file of domainCache.files) {
|
|
314
|
-
data.append(file.correlationId, file.content);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}*/
|
|
320
|
-
|
|
289
|
+
const accessToken = sessionStorage.getItem('accessToken');
|
|
290
|
+
const idToken = sessionStorage.getItem('idToken');
|
|
321
291
|
let data = body ? JSON.stringify(body) : null;
|
|
322
292
|
let fetchConfig = config;
|
|
323
293
|
|
|
@@ -351,13 +321,15 @@ class RestUtils {
|
|
|
351
321
|
|
|
352
322
|
if (download) {
|
|
353
323
|
if (url.indexOf('?') < 0) {
|
|
354
|
-
url +=
|
|
324
|
+
url += '?';
|
|
355
325
|
} else {
|
|
356
|
-
url +=
|
|
326
|
+
url += '&';
|
|
357
327
|
}
|
|
358
328
|
|
|
359
329
|
url += 'access_token=' + accessToken;
|
|
360
330
|
url += '&idToken=' + idToken;
|
|
331
|
+
url += '&themePrimaryColor=' + encodeURIComponent(_ApplicationManager.default.getApplicationPrimaryColor());
|
|
332
|
+
url += '&themeSecondaryColor=' + encodeURIComponent(_ApplicationManager.default.getApplicationSecondaryColor());
|
|
361
333
|
window.open(encodeURI(url), '_blank');
|
|
362
334
|
} else {
|
|
363
335
|
if (_Utils.default.isNull(track) || track === true) {
|
|
@@ -374,12 +346,12 @@ class RestUtils {
|
|
|
374
346
|
}).catch(e => {
|
|
375
347
|
console.error(e);
|
|
376
348
|
|
|
377
|
-
if (e.code === 401 && !url.endsWith(
|
|
349
|
+
if (e.code === 401 && !url.endsWith('/logout')) {
|
|
378
350
|
errorCallback(e);
|
|
379
351
|
|
|
380
|
-
|
|
352
|
+
_ApplicationManager.default.clear();
|
|
381
353
|
|
|
382
|
-
|
|
354
|
+
_ApplicationManager.default.navigate('/login');
|
|
383
355
|
}
|
|
384
356
|
|
|
385
357
|
if (errorCallback !== null) {
|
|
@@ -391,7 +363,9 @@ class RestUtils {
|
|
|
391
363
|
processSuccessfulResponseData(component, data, successCallback, viewId, successMessage) {
|
|
392
364
|
let response;
|
|
393
365
|
|
|
394
|
-
if (
|
|
366
|
+
if (!_Utils.default.isNull(data) && data.toString().trim().length === 0) {
|
|
367
|
+
response = null;
|
|
368
|
+
} else if (typeof data === 'object' || _Utils.default.isNull(data) || data.toString().trim().length === 0) {
|
|
395
369
|
response = data;
|
|
396
370
|
} else {
|
|
397
371
|
try {
|
|
@@ -402,10 +376,10 @@ class RestUtils {
|
|
|
402
376
|
}
|
|
403
377
|
|
|
404
378
|
if (successCallback !== null) {
|
|
405
|
-
let responseData =
|
|
379
|
+
let responseData = response ? response.data : null;
|
|
406
380
|
|
|
407
|
-
if (
|
|
408
|
-
let event = new _Event.default(
|
|
381
|
+
if (response && responseData && response.dataType === 'message') {
|
|
382
|
+
let event = new _Event.default(_ApplicationManager.default, viewId, responseData);
|
|
409
383
|
|
|
410
384
|
_Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
|
|
411
385
|
|
|
@@ -417,9 +391,9 @@ class RestUtils {
|
|
|
417
391
|
} else if (!_Utils.default.isNull(successMessage)) {
|
|
418
392
|
let message = {
|
|
419
393
|
messageType: 'SUCCESS',
|
|
420
|
-
message:
|
|
394
|
+
message: _ApplicationManager.default.populateTemplate(successMessage, response ? response.data : null)
|
|
421
395
|
};
|
|
422
|
-
let event = new _Event.default(
|
|
396
|
+
let event = new _Event.default(_ApplicationManager.default, viewId, message);
|
|
423
397
|
|
|
424
398
|
_Observable.default.fireEvent(_EventType.default.MESSAGE_ARRIVED, event);
|
|
425
399
|
|