@beinformed/ui 1.18.3 → 1.18.6
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/CHANGELOG.md +17 -0
- package/esm/constants/Constants.js +1 -0
- package/esm/constants/Constants.js.map +1 -1
- package/esm/constants/Settings.js +10 -3
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useAuthentication.js +7 -50
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/i18n/Locales.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/form/FormModel.js +3 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/modularui/Authenticate.js +100 -21
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/redux/actions/Preferences.js +2 -2
- package/esm/redux/actions/Preferences.js.map +1 -1
- package/esm/redux/actions/SignOut.js +6 -2
- package/esm/redux/actions/SignOut.js.map +1 -1
- package/esm/redux/connectors/SignIn.js +3 -2
- package/esm/redux/connectors/SignIn.js.map +1 -1
- package/esm/redux/connectors/SignOut.js +4 -1
- package/esm/redux/connectors/SignOut.js.map +1 -1
- package/esm/redux/reducers/AuthReducer.js +0 -10
- package/esm/redux/reducers/AuthReducer.js.map +1 -1
- package/esm/redux/types.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +2 -0
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/lib/constants/Constants.js +3 -1
- package/lib/constants/Constants.js.flow +1 -0
- package/lib/constants/Constants.js.map +1 -1
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js +13 -3
- package/lib/constants/Settings.js.flow +8 -3
- package/lib/constants/Settings.js.map +1 -1
- package/lib/exceptions/FetchException.js.map +1 -1
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +15 -1
- package/lib/hooks/useAllFormsOnModel.js.map +1 -1
- package/lib/hooks/useAuthentication.js +7 -55
- package/lib/hooks/useAuthentication.js.flow +4 -37
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useContent.js.map +1 -1
- package/lib/hooks/useDeepCompareEffect.js.map +1 -1
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModal.js.map +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModels.js.map +1 -1
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/hooks/useModularUIRequest.js.map +1 -1
- package/lib/hooks/useNotification.js.map +1 -1
- package/lib/hooks/usePreference.js.map +1 -1
- package/lib/hooks/useProgressIndicator.js.map +1 -1
- package/lib/hooks/useRouter.js.map +1 -1
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/i18n/Locales.js.map +1 -1
- package/lib/i18n/Message.js.map +1 -1
- package/lib/i18n/withMessage.js.map +1 -1
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
- package/lib/models/attributes/MemoAttributeModel.js.map +1 -1
- package/lib/models/attributes/MoneyAttributeModel.js.map +1 -1
- package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
- package/lib/models/attributes/StringAttributeModel.js.map +1 -1
- package/lib/models/attributes/XMLAttributeModel.js.map +1 -1
- package/lib/models/attributes/_createAttribute.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/form/FormModel.js +3 -1
- package/lib/models/form/FormModel.js.flow +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListHeaderModel.js.map +1 -1
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/paging/PagingModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/parameter/Parameter.js.map +1 -1
- package/lib/models/process/ProcessStatusSettingsModel.js.map +1 -1
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/sorting/SortingModel.js.map +1 -1
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +102 -21
- package/lib/modularui/Authenticate.js.flow +75 -20
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/react/ErrorBoundaryFallback.js.map +1 -1
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/rehydrate.js.map +1 -1
- package/lib/react-server/__tests__/serverUtil.spec.js.flow +6 -4
- package/lib/react-server/createSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/react-server/serverSSR.js.map +1 -1
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/react-theme/ThemeProvider.js.map +1 -1
- package/lib/react-theme/createTheme.js.map +1 -1
- package/lib/react-theme/useTheme.js.map +1 -1
- package/lib/react-theme/utils/background.js.map +1 -1
- package/lib/react-theme/utils/colors.js.map +1 -1
- package/lib/react-theme/utils/contrast.js.map +1 -1
- package/lib/react-theme/utils/corners.js.map +1 -1
- package/lib/react-theme/utils/spacers.js.map +1 -1
- package/lib/react-theme/utils/themeProps.js.map +1 -1
- package/lib/redux/_i18n/actions.js.map +1 -1
- package/lib/redux/_i18n/reducer.js.map +1 -1
- package/lib/redux/_modularui/actions.js.map +1 -1
- package/lib/redux/_modularui/connector.js.map +1 -1
- package/lib/redux/_modularui/middleware.js.map +1 -1
- package/lib/redux/_modularui/modularuiUtils.js.map +1 -1
- package/lib/redux/_modularui/reducer.js.map +1 -1
- package/lib/redux/_modularui/selectors.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/_router/connectors.js.map +1 -1
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js.map +1 -1
- package/lib/redux/actions/Form.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/Notification.js.map +1 -1
- package/lib/redux/actions/Preferences.js +1 -1
- package/lib/redux/actions/Preferences.js.flow +7 -3
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/SignOut.js +6 -1
- package/lib/redux/actions/SignOut.js.flow +9 -5
- package/lib/redux/actions/SignOut.js.map +1 -1
- package/lib/redux/connectors/Application.js.map +1 -1
- package/lib/redux/connectors/Breadcrumb.js.map +1 -1
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/Modal.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/Notification.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/Preferences.js.map +1 -1
- package/lib/redux/connectors/Progress.js.map +1 -1
- package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/SignIn.js +3 -5
- package/lib/redux/connectors/SignIn.js.flow +1 -6
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js +5 -1
- package/lib/redux/connectors/SignOut.js.flow +2 -1
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js +0 -11
- package/lib/redux/reducers/AuthReducer.js.flow +0 -11
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/__tests__/AuthReducer.spec.js.flow +0 -9
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/redux/types.js.flow +0 -1
- package/lib/redux/types.js.map +1 -1
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/checkResource.js +2 -0
- package/lib/utils/helpers/checkResource.js.flow +3 -0
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/lib/utils/helpers/objects.js.map +1 -1
- package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
- package/lib/utils/helpers/text.js.map +1 -1
- package/lib/utils/number/formatValue.js.map +1 -1
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +22 -22
- package/src/constants/Constants.js +1 -0
- package/src/constants/Settings.js +8 -3
- package/src/hooks/__tests__/useAuthentication.spec.js +15 -1
- package/src/hooks/useAuthentication.js +4 -37
- package/src/models/form/FormModel.js +1 -1
- package/src/modularui/Authenticate.js +75 -20
- package/src/react-server/__tests__/serverUtil.spec.js +6 -4
- package/src/redux/actions/Preferences.js +7 -3
- package/src/redux/actions/SignOut.js +9 -5
- package/src/redux/connectors/SignIn.js +1 -6
- package/src/redux/connectors/SignOut.js +2 -1
- package/src/redux/reducers/AuthReducer.js +0 -11
- package/src/redux/reducers/__tests__/AuthReducer.spec.js +0 -9
- package/src/redux/types.js +0 -1
- package/src/utils/helpers/checkResource.js +3 -0
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
11
|
+
|
|
10
12
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
11
13
|
|
|
12
14
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
@@ -42,9 +44,29 @@ var Authenticate = /*#__PURE__*/function () {
|
|
|
42
44
|
|
|
43
45
|
|
|
44
46
|
(0, _createClass2.default)(Authenticate, [{
|
|
47
|
+
key: "authenticationType",
|
|
48
|
+
get: function get() {
|
|
49
|
+
var type = (0, _constants.loginType)();
|
|
50
|
+
|
|
51
|
+
if (!type || type === "JAAS") {
|
|
52
|
+
return "JAAS";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if ((0, _includes.default)(type).call(type, "FormClient")) {
|
|
56
|
+
return "PAC4J_FORM";
|
|
57
|
+
} else if ((0, _includes.default)(type).call(type, "BasicClient")) {
|
|
58
|
+
return "PAC4J_BASIC";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
throw new Error("Unsupported login type found: ".concat(type));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
}, {
|
|
45
67
|
key: "isBasicAuthentication",
|
|
46
68
|
get: function get() {
|
|
47
|
-
return this._isBasic;
|
|
69
|
+
return this._isBasic || this.authenticationType === "PAC4J_BASIC";
|
|
48
70
|
}
|
|
49
71
|
/**
|
|
50
72
|
*/
|
|
@@ -86,43 +108,98 @@ var Authenticate = /*#__PURE__*/function () {
|
|
|
86
108
|
*/
|
|
87
109
|
|
|
88
110
|
}, {
|
|
89
|
-
key: "
|
|
90
|
-
value: function
|
|
91
|
-
|
|
111
|
+
key: "login",
|
|
112
|
+
value: function login(username, password) {
|
|
113
|
+
switch (this.authenticationType) {
|
|
114
|
+
case "PAC4J_FORM":
|
|
115
|
+
return this.doFormLogin(username, password);
|
|
116
|
+
|
|
117
|
+
case "PAC4J_BASIC":
|
|
118
|
+
return this.doBasicAuthentication(username, password);
|
|
119
|
+
|
|
120
|
+
default:
|
|
121
|
+
return this.doJaasAuthentication(username, password);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
}, {
|
|
128
|
+
key: "getFormLoginUrl",
|
|
129
|
+
value: function getFormLoginUrl() {
|
|
130
|
+
var _context;
|
|
131
|
+
|
|
132
|
+
switch (this.authenticationType) {
|
|
133
|
+
case "PAC4J_BASIC":
|
|
134
|
+
case "PAC4J_FORM":
|
|
135
|
+
return (0, _concat.default)(_context = "".concat(_Constants.BASE)).call(_context, (0, _constants.loginPath)());
|
|
136
|
+
|
|
137
|
+
default:
|
|
138
|
+
return "".concat(_Constants.BASE, "/j_security_check");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
}, {
|
|
145
|
+
key: "getFormLoginData",
|
|
146
|
+
value: function getFormLoginData(username, password) {
|
|
147
|
+
var _context2, _context3, _context4, _context5;
|
|
92
148
|
|
|
93
|
-
var LOGIN_PATH = (0, _constants.loginPath)();
|
|
94
|
-
var usernameField = (0, _constants.loginUsernameField)();
|
|
95
|
-
var passwordField = (0, _constants.loginPasswordField)();
|
|
96
149
|
var encodedUsername = encodeURIComponent(username);
|
|
97
150
|
var encodedPassword = encodeURIComponent(password);
|
|
98
|
-
|
|
99
|
-
|
|
151
|
+
|
|
152
|
+
switch (this.authenticationType) {
|
|
153
|
+
case "PAC4J_BASIC":
|
|
154
|
+
case "PAC4J_FORM":
|
|
155
|
+
return (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat((0, _constants.loginUsernameField)(), "=")).call(_context4, encodedUsername, "&")).call(_context3, (0, _constants.loginPasswordField)(), "=")).call(_context2, encodedPassword);
|
|
156
|
+
|
|
157
|
+
default:
|
|
158
|
+
return (0, _concat.default)(_context5 = "j_username=".concat(encodedUsername, "&j_password=")).call(_context5, encodedPassword);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
}, {
|
|
165
|
+
key: "doFormLogin",
|
|
166
|
+
value: function doFormLogin(username, password) {
|
|
167
|
+
return (0, _universalFetch.default)({
|
|
168
|
+
url: this.getFormLoginUrl(),
|
|
100
169
|
method: _Constants.HTTP_METHODS.POST,
|
|
101
170
|
headers: {
|
|
102
171
|
Accept: "application/json",
|
|
103
172
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
104
173
|
},
|
|
105
|
-
data:
|
|
106
|
-
};
|
|
174
|
+
data: this.getFormLoginData(username, password)
|
|
175
|
+
});
|
|
107
176
|
}
|
|
108
177
|
/**
|
|
109
178
|
*/
|
|
110
179
|
|
|
111
180
|
}, {
|
|
112
|
-
key: "
|
|
113
|
-
value: function
|
|
181
|
+
key: "doBasicAuthentication",
|
|
182
|
+
value: function doBasicAuthentication(username, password) {
|
|
183
|
+
var _context6;
|
|
184
|
+
|
|
185
|
+
_Cache.default.addItem("basic", btoa((0, _concat.default)(_context6 = "".concat(username, ":")).call(_context6, password)));
|
|
186
|
+
|
|
187
|
+
return _promise.default.resolve();
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
}, {
|
|
193
|
+
key: "doJaasAuthentication",
|
|
194
|
+
value: function doJaasAuthentication(username, password) {
|
|
114
195
|
var _this2 = this;
|
|
115
196
|
|
|
116
197
|
return this.initLogin(true).then(function () {
|
|
117
198
|
if (_this2.isBasicAuthentication) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
_Cache.default.addItem("basic", btoa((0, _concat.default)(_context4 = "".concat(username, ":")).call(_context4, password)));
|
|
121
|
-
|
|
122
|
-
return _promise.default.resolve();
|
|
199
|
+
return _this2.doBasicAuthentication(username, password);
|
|
123
200
|
}
|
|
124
201
|
|
|
125
|
-
return
|
|
202
|
+
return _this2.doFormLogin(username, password);
|
|
126
203
|
});
|
|
127
204
|
}
|
|
128
205
|
/**
|
|
@@ -131,11 +208,15 @@ var Authenticate = /*#__PURE__*/function () {
|
|
|
131
208
|
}, {
|
|
132
209
|
key: "logout",
|
|
133
210
|
value: function logout() {
|
|
211
|
+
var _context7;
|
|
212
|
+
|
|
134
213
|
return (0, _universalFetch.default)({
|
|
135
|
-
url: (0, _constants.logoutPath)()
|
|
136
|
-
}).then(function () {
|
|
214
|
+
url: (0, _concat.default)(_context7 = "".concat(_Constants.BASE)).call(_context7, (0, _constants.logoutPath)())
|
|
215
|
+
}).then(function (response) {
|
|
137
216
|
// clear cache because of cached contributions
|
|
138
217
|
_Cache.default.clear();
|
|
218
|
+
|
|
219
|
+
return response;
|
|
139
220
|
});
|
|
140
221
|
}
|
|
141
222
|
}]);
|
|
@@ -5,10 +5,10 @@ import universalFetch from "../utils/fetch/universalFetch";
|
|
|
5
5
|
import Cache from "../utils/browser/Cache";
|
|
6
6
|
|
|
7
7
|
import { UnauthorizedException } from "../exceptions";
|
|
8
|
-
import type { RequestOptions } from "../utils/fetch/types";
|
|
9
8
|
import {
|
|
10
|
-
|
|
9
|
+
loginType,
|
|
11
10
|
loginPath,
|
|
11
|
+
loginPasswordField,
|
|
12
12
|
loginUsernameField,
|
|
13
13
|
logoutPath,
|
|
14
14
|
} from "../constants";
|
|
@@ -24,10 +24,27 @@ class Authenticate {
|
|
|
24
24
|
this._isBasic = false;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
*/
|
|
29
|
+
get authenticationType(): "JAAS" | "PAC4J_FORM" | "PAC4J_BASIC" {
|
|
30
|
+
const type = loginType();
|
|
31
|
+
|
|
32
|
+
if (!type || type === "JAAS") {
|
|
33
|
+
return "JAAS";
|
|
34
|
+
}
|
|
35
|
+
if (type.includes("FormClient")) {
|
|
36
|
+
return "PAC4J_FORM";
|
|
37
|
+
} else if (type.includes("BasicClient")) {
|
|
38
|
+
return "PAC4J_BASIC";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
throw new Error(`Unsupported login type found: ${type}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
27
44
|
/**
|
|
28
45
|
*/
|
|
29
46
|
get isBasicAuthentication(): boolean {
|
|
30
|
-
return this._isBasic;
|
|
47
|
+
return this._isBasic || this.authenticationType === "PAC4J_BASIC";
|
|
31
48
|
}
|
|
32
49
|
|
|
33
50
|
/**
|
|
@@ -64,47 +81,85 @@ class Authenticate {
|
|
|
64
81
|
|
|
65
82
|
/**
|
|
66
83
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
84
|
+
login(username: string, password: string): Promise<any> {
|
|
85
|
+
switch (this.authenticationType) {
|
|
86
|
+
case "PAC4J_FORM":
|
|
87
|
+
return this.doFormLogin(username, password);
|
|
88
|
+
case "PAC4J_BASIC":
|
|
89
|
+
return this.doBasicAuthentication(username, password);
|
|
90
|
+
default:
|
|
91
|
+
return this.doJaasAuthentication(username, password);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
*/
|
|
97
|
+
getFormLoginUrl(): string {
|
|
98
|
+
switch (this.authenticationType) {
|
|
99
|
+
case "PAC4J_BASIC":
|
|
100
|
+
case "PAC4J_FORM":
|
|
101
|
+
return `${BASE}${loginPath()}`;
|
|
102
|
+
default:
|
|
103
|
+
return `${BASE}/j_security_check`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
71
106
|
|
|
107
|
+
/**
|
|
108
|
+
*/
|
|
109
|
+
getFormLoginData(username: string, password: string): string {
|
|
72
110
|
const encodedUsername = encodeURIComponent(username);
|
|
73
111
|
const encodedPassword = encodeURIComponent(password);
|
|
74
112
|
|
|
75
|
-
|
|
76
|
-
|
|
113
|
+
switch (this.authenticationType) {
|
|
114
|
+
case "PAC4J_BASIC":
|
|
115
|
+
case "PAC4J_FORM":
|
|
116
|
+
return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;
|
|
117
|
+
default:
|
|
118
|
+
return `j_username=${encodedUsername}&j_password=${encodedPassword}`;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
*/
|
|
124
|
+
doFormLogin(username: string, password: string): Promise<any> {
|
|
125
|
+
return universalFetch({
|
|
126
|
+
url: this.getFormLoginUrl(),
|
|
77
127
|
method: HTTP_METHODS.POST,
|
|
78
128
|
headers: {
|
|
79
129
|
Accept: "application/json",
|
|
80
130
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
81
131
|
},
|
|
82
|
-
data:
|
|
83
|
-
};
|
|
132
|
+
data: this.getFormLoginData(username, password),
|
|
133
|
+
});
|
|
84
134
|
}
|
|
85
135
|
|
|
86
136
|
/**
|
|
87
137
|
*/
|
|
88
|
-
|
|
138
|
+
doBasicAuthentication(username: string, password: string): Promise<any> {
|
|
139
|
+
Cache.addItem("basic", btoa(`${username}:${password}`));
|
|
140
|
+
return Promise.resolve();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
*/
|
|
145
|
+
doJaasAuthentication(username: string, password: string): Promise<any> {
|
|
89
146
|
return this.initLogin(true).then(() => {
|
|
90
147
|
if (this.isBasicAuthentication) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return Promise.resolve();
|
|
148
|
+
return this.doBasicAuthentication(username, password);
|
|
94
149
|
}
|
|
95
|
-
|
|
96
|
-
return universalFetch(this.createLogin(username, password));
|
|
150
|
+
return this.doFormLogin(username, password);
|
|
97
151
|
});
|
|
98
152
|
}
|
|
99
153
|
|
|
100
154
|
/**
|
|
101
155
|
*/
|
|
102
|
-
logout(): Promise<
|
|
156
|
+
logout(): Promise<any> {
|
|
103
157
|
return universalFetch({
|
|
104
|
-
url: logoutPath()
|
|
105
|
-
}).then(() => {
|
|
158
|
+
url: `${BASE}${logoutPath()}`,
|
|
159
|
+
}).then((response) => {
|
|
106
160
|
// clear cache because of cached contributions
|
|
107
161
|
Cache.clear();
|
|
162
|
+
return response;
|
|
108
163
|
});
|
|
109
164
|
}
|
|
110
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authenticate.js","names":["Authenticate","_isBasic","isBasicAuthentication","initLogin","resolve","url","BASE","method","HTTP_METHODS","GET","headers","Accept","catch","error","UnauthorizedException","username","password","
|
|
1
|
+
{"version":3,"file":"Authenticate.js","names":["Authenticate","_isBasic","type","loginType","Error","authenticationType","isBasicAuthentication","initLogin","resolve","universalFetch","url","BASE","method","HTTP_METHODS","GET","headers","Accept","catch","error","UnauthorizedException","username","password","doFormLogin","doBasicAuthentication","doJaasAuthentication","loginPath","encodedUsername","encodeURIComponent","encodedPassword","loginUsernameField","loginPasswordField","getFormLoginUrl","POST","data","getFormLoginData","Cache","addItem","btoa","then","logoutPath","response","clear"],"sources":["../../src/modularui/Authenticate.js"],"sourcesContent":["// @flow\nimport { BASE, HTTP_METHODS } from \"../constants/Constants\";\n\nimport universalFetch from \"../utils/fetch/universalFetch\";\nimport Cache from \"../utils/browser/Cache\";\n\nimport { UnauthorizedException } from \"../exceptions\";\nimport {\n loginType,\n loginPath,\n loginPasswordField,\n loginUsernameField,\n logoutPath,\n} from \"../constants\";\n\n/**\n */\nclass Authenticate {\n _isBasic: boolean;\n\n /**\n */\n constructor() {\n this._isBasic = false;\n }\n\n /**\n */\n get authenticationType(): \"JAAS\" | \"PAC4J_FORM\" | \"PAC4J_BASIC\" {\n const type = loginType();\n\n if (!type || type === \"JAAS\") {\n return \"JAAS\";\n }\n if (type.includes(\"FormClient\")) {\n return \"PAC4J_FORM\";\n } else if (type.includes(\"BasicClient\")) {\n return \"PAC4J_BASIC\";\n }\n\n throw new Error(`Unsupported login type found: ${type}`);\n }\n\n /**\n */\n get isBasicAuthentication(): boolean {\n return this._isBasic || this.authenticationType === \"PAC4J_BASIC\";\n }\n\n /**\n */\n set isBasicAuthentication(isBasicAuthentication: boolean) {\n this._isBasic = isBasicAuthentication;\n }\n\n /**\n */\n initLogin(initLogin: boolean): Promise<any> {\n if (this.isBasicAuthentication || !initLogin) {\n return Promise.resolve(true);\n }\n\n return universalFetch({\n url: `${BASE}/login`,\n method: HTTP_METHODS.GET,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n }).catch((error) => {\n // when an unauthorizedexception is received on a request to the login service,\n // this indicates a basic authorization scenario\n // in case of form based authentication other exceptions are thrown\n if (error instanceof UnauthorizedException) {\n this.isBasicAuthentication = true;\n }\n\n return Promise.resolve({});\n });\n }\n\n /**\n */\n login(username: string, password: string): Promise<any> {\n switch (this.authenticationType) {\n case \"PAC4J_FORM\":\n return this.doFormLogin(username, password);\n case \"PAC4J_BASIC\":\n return this.doBasicAuthentication(username, password);\n default:\n return this.doJaasAuthentication(username, password);\n }\n }\n\n /**\n */\n getFormLoginUrl(): string {\n switch (this.authenticationType) {\n case \"PAC4J_BASIC\":\n case \"PAC4J_FORM\":\n return `${BASE}${loginPath()}`;\n default:\n return `${BASE}/j_security_check`;\n }\n }\n\n /**\n */\n getFormLoginData(username: string, password: string): string {\n const encodedUsername = encodeURIComponent(username);\n const encodedPassword = encodeURIComponent(password);\n\n switch (this.authenticationType) {\n case \"PAC4J_BASIC\":\n case \"PAC4J_FORM\":\n return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;\n default:\n return `j_username=${encodedUsername}&j_password=${encodedPassword}`;\n }\n }\n\n /**\n */\n doFormLogin(username: string, password: string): Promise<any> {\n return universalFetch({\n url: this.getFormLoginUrl(),\n method: HTTP_METHODS.POST,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n data: this.getFormLoginData(username, password),\n });\n }\n\n /**\n */\n doBasicAuthentication(username: string, password: string): Promise<any> {\n Cache.addItem(\"basic\", btoa(`${username}:${password}`));\n return Promise.resolve();\n }\n\n /**\n */\n doJaasAuthentication(username: string, password: string): Promise<any> {\n return this.initLogin(true).then(() => {\n if (this.isBasicAuthentication) {\n return this.doBasicAuthentication(username, password);\n }\n return this.doFormLogin(username, password);\n });\n }\n\n /**\n */\n logout(): Promise<any> {\n return universalFetch({\n url: `${BASE}${logoutPath()}`,\n }).then((response) => {\n // clear cache because of cached contributions\n Cache.clear();\n return response;\n });\n }\n}\n\nexport default Authenticate;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AAQA;AACA;IACMA,Y;EAGJ;AACF;EACE,wBAAc;IAAA;IAAA;IACZ,KAAKC,QAAL,GAAgB,KAAhB;EACD;EAED;AACF;;;;;SACE,eAAgE;MAC9D,IAAMC,IAAI,GAAG,IAAAC,oBAAA,GAAb;;MAEA,IAAI,CAACD,IAAD,IAASA,IAAI,KAAK,MAAtB,EAA8B;QAC5B,OAAO,MAAP;MACD;;MACD,IAAI,uBAAAA,IAAI,MAAJ,CAAAA,IAAI,EAAU,YAAV,CAAR,EAAiC;QAC/B,OAAO,YAAP;MACD,CAFD,MAEO,IAAI,uBAAAA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I,CAACiB,qBAAL,CAA2BH,QAA3B,EAAqCC,QAArC,CAAP;QACD;;QACD,OAAO,MAAI,CAACC,WAAL,CAAiBF,QAAjB,EAA2BC,QAA3B,CAAP;MACD,CALM,CAAP;IAMD;IAED;AACF;;;;WACE,kBAAuB;MAAA;;MACrB,OAAO,IAAAZ,uBAAA,EAAe;QACpBC,GAAG,6CAAKC,eAAL,mBAAY,IAAA4B,qBAAA,GAAZ;MADiB,CAAf,EAEJD,IAFI,CAEC,UAACE,QAAD,EAAc;QACpB;QACAL,cAAA,CAAMM,KAAN;;QACA,OAAOD,QAAP;MACD,CANM,CAAP;IAOD;;;;;eAGYxC,Y"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIRequest.js","names":["ModularUIRequest","href","options","HTTP_METHODS","GET","IllegalArgumentException","_response","ModularUIResponse","Href","locale","parameters","targetModel","method","_contributionsHref","contributionsHref","_locale","_href","_method","_options","childmodels","_targetModel","Model","response","isApplicableModel","IllegalStateException","contributionsData","contributionsKey","error","handleContributionsError","key","contributions","errorMessage","properties","message","ModularUIError","path","toString","data","links","_links","Array","isArray","handleDataError","handleData","url","BASE","cache","params","getQuerystringForModularUI","onProgress","processApplicationLinks","processTabLinks","processPanelLinks","resolve","contributionLinks","dataLinks","tab","contributionTabLink","dataTabLinks","dataLink","name","processLinks","components","then","newLinks","replaceApplicationLinks","tabName","tabLink","component","panel","linksPerName","dataLinksPerName","hideWhenEmptyLinks","contributionLink","layouthint","HIDE_WHEN_EMPTY","isHiddenListChecks","push","isHiddenList","all","hiddenLinks","newDataLinks","dataLinkKey","_embedded","actions","isHidden","catch","_progressEvent","progressEvent","model","prevData","JSON","parse","FormModel","newData","validationData","isValidationRequest","currentFormObject","hasDynamicValidations","validationHref","setParameter","getDynamicValidationData","updateValidations","fetchDataService","Error","processDataService","fetchContributionsService","processContributionsService","processAsyncLayoutHints","createModel","loadDynamicValidations","withChildModels","fetchChildModels","fetch","childModelLinks","getInitialChildModelLinks","childModelRequests","childModelLink","request","isCacheable","fetchFromCache","allSettled","childModels","resolvedChildModels","forEach","childModel","status","reason","console","value","addChildModels","withChildSections","ContentModel","childSectionLinks","length","fetchContentChildSections","contentModel","newContentModel","clone","childSectionLink","contentHrefWithEntryDate","selfhref","addParameter","TIMEVERSION_FILTER_NAME","entryDate","fetchContent","sectionModels","childSections"],"sources":["../../src/modularui/ModularUIRequest.js"],"sourcesContent":["// @flow\nimport deepmerge from \"deepmerge\";\n\nimport {\n BASE,\n HTTP_METHODS,\n TIMEVERSION_FILTER_NAME,\n} from \"../constants/Constants\";\n\nimport { HIDE_WHEN_EMPTY } from \"../constants/LayoutHints\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport Href from \"../models/href/Href\";\n\nimport universalFetch from \"../utils/fetch/universalFetch\";\nimport resolveModel from \"../models/resolveModel\";\nimport FormModel from \"../models/form/FormModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport ModularUIResponse from \"./ModularUIResponse\";\n\nimport ModularUIError from \"./ModularUIError\";\nimport { IllegalArgumentException, IllegalStateException } from \"../exceptions\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport type { RequestBaseOptions } from \"../utils/fetch/types\";\nimport type { ModularUIModel } from \"../models/types\";\n\n/**\n * Helper for fetching data and contributions from the Be Informed modular ui\n * and merge it into a target or resolvable model.\n */\nclass ModularUIRequest {\n _response: ModularUIResponse;\n\n _href: Href;\n _options: RequestBaseOptions;\n _targetModel: ?Class<ModularUIModel>;\n _contributionsHref: string;\n _locale: string;\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n\n _progressEvent: ProgressEventHandler;\n\n /**\n */\n constructor(href: Href | string, options: $Shape<RequestBaseOptions> = {}) {\n if (!href) {\n throw new IllegalArgumentException(\n \"You must pass a href to the resource that is requested\"\n );\n }\n\n this.options = options;\n\n this._response = new ModularUIResponse();\n\n this.href = typeof href === \"string\" ? new Href(href) : href;\n this.locale = options.locale ?? \"en\";\n\n // copy request parameters to response, to be able to use them in the models\n // self links are missing the request parameters\n this._response.parameters = this.href.parameters;\n\n if (options.targetModel) {\n this.targetModel = options.targetModel;\n }\n\n if (options.method) {\n this.method = options.method;\n } else {\n this.method = this.href.method;\n }\n }\n\n /**\n */\n get contributionsHref(): string {\n return this._contributionsHref;\n }\n\n /**\n */\n set contributionsHref(contributionsHref: string) {\n this._contributionsHref = contributionsHref;\n }\n\n /**\n */\n set locale(locale: string) {\n this._locale = locale;\n this._response.locale = locale;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n */\n get response(): ModularUIResponse {\n return this._response;\n }\n\n /**\n */\n set href(href: Href) {\n this._href = href;\n }\n\n /**\n */\n get href(): Href {\n return this._href;\n }\n\n /**\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method;\n }\n\n /**\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n */\n get options(): RequestBaseOptions {\n return {\n ...this._options,\n locale: this.locale,\n method: this.method,\n };\n }\n\n /**\n */\n set options(options: RequestBaseOptions) {\n this._options = options;\n }\n\n /**\n */\n get withChildModels(): boolean {\n return (\n !(\"childmodels\" in this.options) || this.options.childmodels === true\n );\n }\n\n /**\n */\n set targetModel(targetModel: ?Class<ModularUIModel>) {\n this._targetModel = targetModel;\n }\n\n /**\n */\n get targetModel(): ?Class<ModularUIModel> {\n return this._targetModel;\n }\n\n /**\n */\n createModel(): ModularUIModel {\n const Model = this.targetModel || resolveModel(this.response);\n\n // check for ResourceModel\n if (Model && Model.isApplicableModel) {\n return new Model(this.response);\n }\n\n throw new IllegalStateException(\n `No model available for data: ${JSON.stringify(this.response)}`\n );\n }\n\n /**\n */\n processContributionsService(contributionsData: Object) {\n if (!isPlainObject(contributionsData)) {\n throw new IllegalArgumentException(\n \"Missing contributions data or contributions is not JSON\"\n );\n }\n\n const [contributionsKey] = Object.keys(contributionsData);\n\n if (contributionsData.error && contributionsKey === \"error\") {\n this.handleContributionsError(contributionsData.error);\n }\n\n // The key of the data service is different from the contributions service for forms\n if (!(this.response.key in contributionsData)) {\n this.response.key = contributionsKey;\n }\n\n this.response.contributions = contributionsData[this.response.key];\n }\n\n /**\n */\n handleContributionsError(error: Object) {\n const errorMessage = error.properties?.message ?? \"Error in contribution\";\n throw new ModularUIError(errorMessage, error, this.contributionsHref);\n }\n\n /**\n */\n handleDataError(error: Object) {\n if (error.properties) {\n const errorMessage = error.properties?.message ?? \"Error in data\";\n throw new ModularUIError(errorMessage, error, this.href.path.toString());\n }\n\n throw new IllegalArgumentException(error);\n }\n\n /**\n */\n handleData(key: string, data: Object) {\n this.response.key = key;\n this.response.data = data;\n\n const links = data._links;\n\n if (links && links.contributions) {\n this.contributionsHref = links.contributions.href;\n } else if (Array.isArray(links) && links[0].contributions) {\n this.contributionsHref = links[0].contributions.href;\n } else {\n throw new IllegalArgumentException(\n `Contributions link not found for data with key ${key}`\n );\n }\n }\n\n /**\n */\n processDataService(data: Object) {\n if (!isPlainObject(data)) {\n throw new IllegalArgumentException(\"Missing data or data is not JSON\");\n }\n\n if (data.error) {\n this.handleDataError(data.error);\n } else {\n const [key] = Object.keys(data);\n this.handleData(key, data[key]);\n }\n }\n\n /**\n */\n fetchContributionsService(): Promise<any> {\n if (!this.contributionsHref) {\n throw new IllegalStateException(\"Missing a contributions href\");\n }\n\n return universalFetch({\n url: `${BASE}${this.contributionsHref}`,\n cache: true,\n locale: this.options.locale,\n });\n }\n\n /**\n */\n fetchDataService(): Promise<any> {\n return universalFetch({\n ...this.options,\n url: `${BASE}${this.href.path}`,\n params: this.href.getQuerystringForModularUI(),\n locale: this.options.locale,\n onProgress: this.onProgress,\n });\n }\n\n /**\n * Check if links contain a 'hide-when-empty' layout hint and remove the link from\n * the component when it exists and no results are available\n */\n async processAsyncLayoutHints(): Promise<void> {\n if (getSetting(\"ALLOW_HIDE_WHEN_EMPTY_ON_TABS\")) {\n await this.processApplicationLinks();\n await this.processTabLinks();\n }\n await this.processPanelLinks();\n\n return Promise.resolve();\n }\n\n /**\n * hide application links<br>\n * _links on application data contains an extra level of tab links\n */\n processApplicationLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n const dataLinks = this.response.data._links;\n if (!contributionLinks || !dataLinks) {\n return Promise.resolve();\n }\n\n if (\"tab\" in contributionLinks && \"tab\" in dataLinks) {\n for (const contributionTabLink of contributionLinks.tab) {\n if (\"components\" in contributionTabLink) {\n const dataTabLinks = dataLinks.tab.find(\n (dataLink) => dataLink.name === contributionTabLink.name\n );\n\n if (dataTabLinks && \"components\" in dataTabLinks) {\n return this.processLinks(\n dataTabLinks.components,\n contributionTabLink.components\n ).then((newLinks) =>\n this.replaceApplicationLinks(contributionTabLink.name, newLinks)\n );\n }\n }\n }\n }\n\n return Promise.resolve();\n }\n\n /**\n * Replace hidden link in application link tree\n */\n replaceApplicationLinks(tabName: string, newLinks: Array<Object>): void {\n this.response.data._links.tab = this.response.data._links.tab.map(\n (tabLink) => {\n const key = tabLink.name;\n if (tabName === key) {\n tabLink.components = newLinks;\n }\n return tabLink;\n }\n );\n }\n\n /**\n */\n processTabLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n\n if (!contributionLinks) {\n return Promise.resolve();\n }\n\n if (\"component\" in contributionLinks) {\n return this.processLinks(\n this.response.data._links.component,\n contributionLinks.component\n ).then((newLinks) => {\n this.response.data._links.component = newLinks;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n */\n processPanelLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n\n if (!contributionLinks) {\n return Promise.resolve();\n }\n\n if (\"panel\" in contributionLinks) {\n return this.processLinks(\n this.response.data._links,\n contributionLinks.panel\n ).then((newLinks) => {\n this.response.data._links = newLinks;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n * Retrieve an object of key: link\n */\n dataLinksPerName(dataLinks: any): { [linkName: string]: any } {\n if (Array.isArray(dataLinks)) {\n const links = {};\n for (const dataLink of dataLinks) {\n links[dataLink.name] = dataLink;\n }\n return links;\n }\n return dataLinks;\n }\n\n /**\n * Check if links are empty and hide them when hide-when-empty hint exists\n */\n processLinks(\n dataLinks: any,\n contributionLinks: any\n ): Promise<Object | Array<Object>> {\n const linksPerName = this.dataLinksPerName(dataLinks);\n const hideWhenEmptyLinks = contributionLinks.filter((contributionLink) =>\n contributionLink.layouthint?.includes(HIDE_WHEN_EMPTY)\n );\n\n const isHiddenListChecks = [];\n\n for (const contributionLink of hideWhenEmptyLinks) {\n const dataLink = linksPerName[contributionLink.name];\n if (dataLink?.href) {\n isHiddenListChecks.push(\n this.isHiddenList(contributionLink.name, dataLink.href)\n );\n }\n }\n\n return Promise.all(isHiddenListChecks).then(\n (hiddenLinks: Array<string>) => {\n if (Array.isArray(dataLinks)) {\n return dataLinks.filter(\n (dataLink) => !hiddenLinks.includes(dataLink.name)\n );\n }\n\n const newDataLinks = {};\n for (const dataLinkKey in dataLinks) {\n if (!hiddenLinks.includes(dataLinkKey)) {\n newDataLinks[dataLinkKey] = dataLinks[dataLinkKey];\n }\n }\n return newDataLinks;\n }\n );\n }\n\n /**\n */\n isHiddenList(name: string, href: string): Promise<string> {\n return universalFetch({\n ...this.options,\n url: `${BASE}${href}`,\n })\n .then((response: Object) => {\n if (isPlainObject(response)) {\n const [key] = Object.keys(response);\n const { _embedded, actions } = response[key];\n\n const isHidden = _embedded == null && actions == null;\n if (isHidden) {\n return name;\n }\n }\n return \"\";\n })\n .catch(() => {\n return \"\";\n });\n }\n\n /**\n */\n set onProgress(progressEvent: ProgressEventHandler) {\n this._progressEvent = progressEvent;\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n return this._progressEvent || null;\n }\n\n /**\n * Combine previous send request data with new validation data to create a complete request object\n * The received model is new FormModel containing ONLY the current question, not the previously entered questions\n * to create a complete request we append the originally send form objects\n */\n getDynamicValidationData(model: ModularUIModel): string {\n const prevData =\n typeof this.options.data === \"string\"\n ? JSON.parse(this.options.data)\n : this.options.data;\n\n if (model instanceof FormModel) {\n const newData = JSON.parse(model.validationData);\n // $FlowFixMe incompatible-call\n return JSON.stringify(deepmerge(prevData || {}, newData));\n }\n\n return JSON.stringify(prevData) ?? \"{}\";\n }\n\n /**\n * First load of dynamic values when a form is loaded\n */\n loadDynamicValidations(model: ModularUIModel): Promise<ModularUIModel> {\n if (\n !this.options.isValidationRequest &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\") &&\n model instanceof FormModel &&\n model.currentFormObject &&\n model.currentFormObject.hasDynamicValidations\n ) {\n const validationHref = this.href.setParameter(\"commit\", \"false\");\n return universalFetch({\n ...this.options,\n url: `${BASE}${this.href.path}`,\n params: validationHref.getQuerystringForModularUI(),\n childmodels: false,\n data: this.getDynamicValidationData(model),\n }).then((data) => {\n if (data == null || typeof data !== \"object\") {\n return model;\n }\n\n const [key] = Object.keys(data);\n return model.updateValidations(data[key]);\n });\n }\n\n return Promise.resolve(model);\n }\n\n /**\n */\n fetch(): Promise<ModularUIModel> {\n return this.fetchDataService()\n .then((data) => {\n if (data == null) {\n throw new Error(`No data received for ${this.href.toString()}`);\n }\n\n this.processDataService(data);\n return this.fetchContributionsService();\n })\n .then((contributionsData) => {\n if (contributionsData == null) {\n throw new Error(\n `No contributions data received for ${this.contributionsHref}`\n );\n }\n\n this.processContributionsService(contributionsData);\n return this.processAsyncLayoutHints();\n })\n .then(() => Promise.resolve(this.createModel()))\n .then((model) => this.loadDynamicValidations(model))\n .then((model) => {\n if (this.withChildModels) {\n return this.fetchChildModels(model);\n }\n\n return Promise.resolve(model);\n });\n }\n\n /**\n */\n fetchFromCache(): Promise<ModularUIModel> {\n this.options = {\n ...this.options,\n cache: true,\n };\n\n return this.fetch();\n }\n\n /**\n */\n fetchChildModels(model: ModularUIModel): Promise<ModularUIModel> {\n const childModelLinks = model.getInitialChildModelLinks();\n\n const childModelRequests = childModelLinks.map((childModelLink) => {\n const request = new ModularUIRequest(childModelLink.href, {\n locale: this.locale,\n });\n\n if (childModelLink.targetModel) {\n request.targetModel = childModelLink.targetModel;\n }\n\n if (childModelLink.isCacheable) {\n return request.fetchFromCache();\n }\n\n return request.fetch();\n });\n\n return Promise.allSettled(childModelRequests).then((childModels) => {\n const resolvedChildModels = [];\n\n childModels.forEach((childModel) => {\n if (childModel.status === \"rejected\") {\n const { reason } = childModel;\n if (reason.name !== \"Error.ChangePasswordRequired\") {\n console.error(\n \"Unexpected error when retrieving child model:\",\n reason\n );\n }\n } else {\n resolvedChildModels.push(childModel.value);\n }\n });\n\n model.addChildModels(resolvedChildModels);\n\n return model;\n });\n }\n\n /**\n */\n fetchContent(withChildSections: boolean): Promise<mixed> {\n return this.fetchFromCache().then((model) => {\n if (\n withChildSections &&\n model instanceof ContentModel &&\n model.childSectionLinks.length > 0\n ) {\n return this.fetchContentChildSections(model);\n }\n\n return Promise.resolve(model);\n });\n }\n\n /**\n * Recursively return child sections defined on the content model\n */\n fetchContentChildSections(contentModel: ContentModel): Promise<mixed> {\n const newContentModel = contentModel.clone();\n\n return Promise.all(\n contentModel.childSectionLinks.map((childSectionLink) => {\n const contentHrefWithEntryDate = childSectionLink.selfhref.addParameter(\n TIMEVERSION_FILTER_NAME,\n contentModel.entryDate\n );\n\n const request = new ModularUIRequest(contentHrefWithEntryDate, {\n locale: this.locale,\n });\n\n return request.fetchContent(true);\n })\n ).then((sectionModels) => {\n newContentModel.childSections = sectionModels;\n\n return newContentModel;\n });\n }\n}\n\nexport default ModularUIRequest;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AAMA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;;;;;;;;;;;AAKA;AACA;AACA;AACA;IACMA,gB;EAYJ;AACF;EACE,0BAAYC,IAAZ,EAA2E;IAAA;;IAAA,IAA1CC,OAA0C,uEAAJ,EAAI;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IA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equest.js","names":["ModularUIRequest","href","options","HTTP_METHODS","GET","IllegalArgumentException","_response","ModularUIResponse","Href","locale","parameters","targetModel","method","_contributionsHref","contributionsHref","_locale","_href","_method","_options","childmodels","_targetModel","Model","resolveModel","response","isApplicableModel","IllegalStateException","contributionsData","isPlainObject","contributionsKey","error","handleContributionsError","key","contributions","errorMessage","properties","message","ModularUIError","path","toString","data","links","_links","Array","isArray","handleDataError","handleData","universalFetch","url","BASE","cache","params","getQuerystringForModularUI","onProgress","getSetting","processApplicationLinks","processTabLinks","processPanelLinks","resolve","contributionLinks","dataLinks","tab","contributionTabLink","dataTabLinks","dataLink","name","processLinks","components","then","newLinks","replaceApplicationLinks","tabName","tabLink","component","panel","linksPerName","dataLinksPerName","hideWhenEmptyLinks","contributionLink","layouthint","HIDE_WHEN_EMPTY","isHiddenListChecks","push","isHiddenList","all","hiddenLinks","newDataLinks","dataLinkKey","_embedded","actions","isHidden","catch","_progressEvent","progressEvent","model","prevData","JSON","parse","FormModel","newData","validationData","deepmerge","isValidationRequest","currentFormObject","hasDynamicValidations","validationHref","setParameter","getDynamicValidationData","updateValidations","fetchDataService","Error","processDataService","fetchContributionsService","processContributionsService","processAsyncLayoutHints","createModel","loadDynamicValidations","withChildModels","fetchChildModels","fetch","childModelLinks","getInitialChildModelLinks","childModelRequests","childModelLink","request","isCacheable","fetchFromCache","allSettled","childModels","resolvedChildModels","forEach","childModel","status","reason","console","value","addChildModels","withChildSections","ContentModel","childSectionLinks","length","fetchContentChildSections","contentModel","newContentModel","clone","childSectionLink","contentHrefWithEntryDate","selfhref","addParameter","TIMEVERSION_FILTER_NAME","entryDate","fetchContent","sectionModels","childSections"],"sources":["../../src/modularui/ModularUIRequest.js"],"sourcesContent":["// @flow\nimport deepmerge from \"deepmerge\";\n\nimport {\n BASE,\n HTTP_METHODS,\n TIMEVERSION_FILTER_NAME,\n} from \"../constants/Constants\";\n\nimport { HIDE_WHEN_EMPTY } from \"../constants/LayoutHints\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport Href from \"../models/href/Href\";\n\nimport universalFetch from \"../utils/fetch/universalFetch\";\nimport resolveModel from \"../models/resolveModel\";\nimport FormModel from \"../models/form/FormModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport ModularUIResponse from \"./ModularUIResponse\";\n\nimport ModularUIError from \"./ModularUIError\";\nimport { IllegalArgumentException, IllegalStateException } from \"../exceptions\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport type { RequestBaseOptions } from \"../utils/fetch/types\";\nimport type { ModularUIModel } from \"../models/types\";\n\n/**\n * Helper for fetching data and contributions from the Be Informed modular ui\n * and merge it into a target or resolvable model.\n */\nclass ModularUIRequest {\n _response: ModularUIResponse;\n\n _href: Href;\n _options: RequestBaseOptions;\n _targetModel: ?Class<ModularUIModel>;\n _contributionsHref: string;\n _locale: string;\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n\n _progressEvent: ProgressEventHandler;\n\n /**\n */\n constructor(href: Href | string, options: $Shape<RequestBaseOptions> = {}) {\n if (!href) {\n throw new IllegalArgumentException(\n \"You must pass a href to the resource that is requested\"\n );\n }\n\n this.options = options;\n\n this._response = new ModularUIResponse();\n\n this.href = typeof href === \"string\" ? new Href(href) : href;\n this.locale = options.locale ?? \"en\";\n\n // copy request parameters to response, to be able to use them in the models\n // self links are missing the request parameters\n this._response.parameters = this.href.parameters;\n\n if (options.targetModel) {\n this.targetModel = options.targetModel;\n }\n\n if (options.method) {\n this.method = options.method;\n } else {\n this.method = this.href.method;\n }\n }\n\n /**\n */\n get contributionsHref(): string {\n return this._contributionsHref;\n }\n\n /**\n */\n set contributionsHref(contributionsHref: string) {\n this._contributionsHref = contributionsHref;\n }\n\n /**\n */\n set locale(locale: string) {\n this._locale = locale;\n this._response.locale = locale;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n */\n get response(): ModularUIResponse {\n return this._response;\n }\n\n /**\n */\n set href(href: Href) {\n this._href = href;\n }\n\n /**\n */\n get href(): Href {\n return this._href;\n }\n\n /**\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method;\n }\n\n /**\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n */\n get options(): RequestBaseOptions {\n return {\n ...this._options,\n locale: this.locale,\n method: this.method,\n };\n }\n\n /**\n */\n set options(options: RequestBaseOptions) {\n this._options = options;\n }\n\n /**\n */\n get withChildModels(): boolean {\n return (\n !(\"childmodels\" in this.options) || this.options.childmodels === true\n );\n }\n\n /**\n */\n set targetModel(targetModel: ?Class<ModularUIModel>) {\n this._targetModel = targetModel;\n }\n\n /**\n */\n get targetModel(): ?Class<ModularUIModel> {\n return this._targetModel;\n }\n\n /**\n */\n createModel(): ModularUIModel {\n const Model = this.targetModel || resolveModel(this.response);\n\n // check for ResourceModel\n if (Model && Model.isApplicableModel) {\n return new Model(this.response);\n }\n\n throw new IllegalStateException(\n `No model available for data: ${JSON.stringify(this.response)}`\n );\n }\n\n /**\n */\n processContributionsService(contributionsData: Object) {\n if (!isPlainObject(contributionsData)) {\n throw new IllegalArgumentException(\n \"Missing contributions data or contributions is not JSON\"\n );\n }\n\n const [contributionsKey] = Object.keys(contributionsData);\n\n if (contributionsData.error && contributionsKey === \"error\") {\n this.handleContributionsError(contributionsData.error);\n }\n\n // The key of the data service is different from the contributions service for forms\n if (!(this.response.key in contributionsData)) {\n this.response.key = contributionsKey;\n }\n\n this.response.contributions = contributionsData[this.response.key];\n }\n\n /**\n */\n handleContributionsError(error: Object) {\n const errorMessage = error.properties?.message ?? \"Error in contribution\";\n throw new ModularUIError(errorMessage, error, this.contributionsHref);\n }\n\n /**\n */\n handleDataError(error: Object) {\n if (error.properties) {\n const errorMessage = error.properties?.message ?? \"Error in data\";\n throw new ModularUIError(errorMessage, error, this.href.path.toString());\n }\n\n throw new IllegalArgumentException(error);\n }\n\n /**\n */\n handleData(key: string, data: Object) {\n this.response.key = key;\n this.response.data = data;\n\n const links = data._links;\n\n if (links && links.contributions) {\n this.contributionsHref = links.contributions.href;\n } else if (Array.isArray(links) && links[0].contributions) {\n this.contributionsHref = links[0].contributions.href;\n } else {\n throw new IllegalArgumentException(\n `Contributions link not found for data with key ${key}`\n );\n }\n }\n\n /**\n */\n processDataService(data: Object) {\n if (!isPlainObject(data)) {\n throw new IllegalArgumentException(\"Missing data or data is not JSON\");\n }\n\n if (data.error) {\n this.handleDataError(data.error);\n } else {\n const [key] = Object.keys(data);\n this.handleData(key, data[key]);\n }\n }\n\n /**\n */\n fetchContributionsService(): Promise<any> {\n if (!this.contributionsHref) {\n throw new IllegalStateException(\"Missing a contributions href\");\n }\n\n return universalFetch({\n url: `${BASE}${this.contributionsHref}`,\n cache: true,\n locale: this.options.locale,\n });\n }\n\n /**\n */\n fetchDataService(): Promise<any> {\n return universalFetch({\n ...this.options,\n url: `${BASE}${this.href.path}`,\n params: this.href.getQuerystringForModularUI(),\n locale: this.options.locale,\n onProgress: this.onProgress,\n });\n }\n\n /**\n * Check if links contain a 'hide-when-empty' layout hint and remove the link from\n * the component when it exists and no results are available\n */\n async processAsyncLayoutHints(): Promise<void> {\n if (getSetting(\"ALLOW_HIDE_WHEN_EMPTY_ON_TABS\")) {\n await this.processApplicationLinks();\n await this.processTabLinks();\n }\n await this.processPanelLinks();\n\n return Promise.resolve();\n }\n\n /**\n * hide application links<br>\n * _links on application data contains an extra level of tab links\n */\n processApplicationLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n const dataLinks = this.response.data._links;\n if (!contributionLinks || !dataLinks) {\n return Promise.resolve();\n }\n\n if (\"tab\" in contributionLinks && \"tab\" in dataLinks) {\n for (const contributionTabLink of contributionLinks.tab) {\n if (\"components\" in contributionTabLink) {\n const dataTabLinks = dataLinks.tab.find(\n (dataLink) => dataLink.name === contributionTabLink.name\n );\n\n if (dataTabLinks && \"components\" in dataTabLinks) {\n return this.processLinks(\n dataTabLinks.components,\n contributionTabLink.components\n ).then((newLinks) =>\n this.replaceApplicationLinks(contributionTabLink.name, newLinks)\n );\n }\n }\n }\n }\n\n return Promise.resolve();\n }\n\n /**\n * Replace hidden link in application link tree\n */\n replaceApplicationLinks(tabName: string, newLinks: Array<Object>): void {\n this.response.data._links.tab = this.response.data._links.tab.map(\n (tabLink) => {\n const key = tabLink.name;\n if (tabName === key) {\n tabLink.components = newLinks;\n }\n return tabLink;\n }\n );\n }\n\n /**\n */\n processTabLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n\n if (!contributionLinks) {\n return Promise.resolve();\n }\n\n if (\"component\" in contributionLinks) {\n return this.processLinks(\n this.response.data._links.component,\n contributionLinks.component\n ).then((newLinks) => {\n this.response.data._links.component = newLinks;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n */\n processPanelLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n\n if (!contributionLinks) {\n return Promise.resolve();\n }\n\n if (\"panel\" in contributionLinks) {\n return this.processLinks(\n this.response.data._links,\n contributionLinks.panel\n ).then((newLinks) => {\n this.response.data._links = newLinks;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n * Retrieve an object of key: link\n */\n dataLinksPerName(dataLinks: any): { [linkName: string]: any } {\n if (Array.isArray(dataLinks)) {\n const links = {};\n for (const dataLink of dataLinks) {\n links[dataLink.name] = dataLink;\n }\n return links;\n }\n return dataLinks;\n }\n\n /**\n * Check if links are empty and hide them when hide-when-empty hint exists\n */\n processLinks(\n dataLinks: any,\n contributionLinks: any\n ): Promise<Object | Array<Object>> {\n const linksPerName = this.dataLinksPerName(dataLinks);\n const hideWhenEmptyLinks = contributionLinks.filter((contributionLink) =>\n contributionLink.layouthint?.includes(HIDE_WHEN_EMPTY)\n );\n\n const isHiddenListChecks = [];\n\n for (const contributionLink of hideWhenEmptyLinks) {\n const dataLink = linksPerName[contributionLink.name];\n if (dataLink?.href) {\n isHiddenListChecks.push(\n this.isHiddenList(contributionLink.name, dataLink.href)\n );\n }\n }\n\n return Promise.all(isHiddenListChecks).then(\n (hiddenLinks: Array<string>) => {\n if (Array.isArray(dataLinks)) {\n return dataLinks.filter(\n (dataLink) => !hiddenLinks.includes(dataLink.name)\n );\n }\n\n const newDataLinks = {};\n for (const dataLinkKey in dataLinks) {\n if (!hiddenLinks.includes(dataLinkKey)) {\n newDataLinks[dataLinkKey] = dataLinks[dataLinkKey];\n }\n }\n return newDataLinks;\n }\n );\n }\n\n /**\n */\n isHiddenList(name: string, href: string): Promise<string> {\n return universalFetch({\n ...this.options,\n url: `${BASE}${href}`,\n })\n .then((response: Object) => {\n if (isPlainObject(response)) {\n const [key] = Object.keys(response);\n const { _embedded, actions } = response[key];\n\n const isHidden = _embedded == null && actions == null;\n if (isHidden) {\n return name;\n }\n }\n return \"\";\n })\n .catch(() => {\n return \"\";\n });\n }\n\n /**\n */\n set onProgress(progressEvent: ProgressEventHandler) {\n this._progressEvent = progressEvent;\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n return this._progressEvent || null;\n }\n\n /**\n * Combine previous send request data with new validation data to create a complete request object\n * The received model is new FormModel containing ONLY the current question, not the previously entered questions\n * to create a complete request we append the originally send form objects\n */\n getDynamicValidationData(model: ModularUIModel): string {\n const prevData =\n typeof this.options.data === \"string\"\n ? JSON.parse(this.options.data)\n : this.options.data;\n\n if (model instanceof FormModel) {\n const newData = JSON.parse(model.validationData);\n // $FlowFixMe incompatible-call\n return JSON.stringify(deepmerge(prevData || {}, newData));\n }\n\n return JSON.stringify(prevData) ?? \"{}\";\n }\n\n /**\n * First load of dynamic values when a form is loaded\n */\n loadDynamicValidations(model: ModularUIModel): Promise<ModularUIModel> {\n if (\n !this.options.isValidationRequest &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\") &&\n model instanceof FormModel &&\n model.currentFormObject &&\n model.currentFormObject.hasDynamicValidations\n ) {\n const validationHref = this.href.setParameter(\"commit\", \"false\");\n return universalFetch({\n ...this.options,\n url: `${BASE}${this.href.path}`,\n params: validationHref.getQuerystringForModularUI(),\n childmodels: false,\n data: this.getDynamicValidationData(model),\n }).then((data) => {\n if (data == null || typeof data !== \"object\") {\n return model;\n }\n\n const [key] = Object.keys(data);\n return model.updateValidations(data[key]);\n });\n }\n\n return Promise.resolve(model);\n }\n\n /**\n */\n fetch(): Promise<ModularUIModel> {\n return this.fetchDataService()\n .then((data) => {\n if (data == null) {\n throw new Error(`No data received for ${this.href.toString()}`);\n }\n\n this.processDataService(data);\n return this.fetchContributionsService();\n })\n .then((contributionsData) => {\n if (contributionsData == null) {\n throw new Error(\n `No contributions data received for ${this.contributionsHref}`\n );\n }\n\n this.processContributionsService(contributionsData);\n return this.processAsyncLayoutHints();\n })\n .then(() => Promise.resolve(this.createModel()))\n .then((model) => this.loadDynamicValidations(model))\n .then((model) => {\n if (this.withChildModels) {\n return this.fetchChildModels(model);\n }\n\n return Promise.resolve(model);\n });\n }\n\n /**\n */\n fetchFromCache(): Promise<ModularUIModel> {\n this.options = {\n ...this.options,\n cache: true,\n };\n\n return this.fetch();\n }\n\n /**\n */\n fetchChildModels(model: ModularUIModel): Promise<ModularUIModel> {\n const childModelLinks = model.getInitialChildModelLinks();\n\n const childModelRequests = childModelLinks.map((childModelLink) => {\n const request = new ModularUIRequest(childModelLink.href, {\n locale: this.locale,\n });\n\n if (childModelLink.targetModel) {\n request.targetModel = childModelLink.targetModel;\n }\n\n if (childModelLink.isCacheable) {\n return request.fetchFromCache();\n }\n\n return request.fetch();\n });\n\n return Promise.allSettled(childModelRequests).then((childModels) => {\n const resolvedChildModels = [];\n\n childModels.forEach((childModel) => {\n if (childModel.status === \"rejected\") {\n const { reason } = childModel;\n if (reason.name !== \"Error.ChangePasswordRequired\") {\n console.error(\n \"Unexpected error when retrieving child model:\",\n reason\n );\n }\n } else {\n resolvedChildModels.push(childModel.value);\n }\n });\n\n model.addChildModels(resolvedChildModels);\n\n return model;\n });\n }\n\n /**\n */\n fetchContent(withChildSections: boolean): Promise<mixed> {\n return this.fetchFromCache().then((model) => {\n if (\n withChildSections &&\n model instanceof ContentModel &&\n model.childSectionLinks.length > 0\n ) {\n return this.fetchContentChildSections(model);\n }\n\n return Promise.resolve(model);\n });\n }\n\n /**\n * Recursively return child sections defined on the content model\n */\n fetchContentChildSections(contentModel: ContentModel): Promise<mixed> {\n const newContentModel = contentModel.clone();\n\n return Promise.all(\n contentModel.childSectionLinks.map((childSectionLink) => {\n const contentHrefWithEntryDate = childSectionLink.selfhref.addParameter(\n TIMEVERSION_FILTER_NAME,\n contentModel.entryDate\n );\n\n const request = new ModularUIRequest(contentHrefWithEntryDate, {\n locale: this.locale,\n });\n\n return request.fetchContent(true);\n })\n ).then((sectionModels) => {\n newContentModel.childSections = sectionModels;\n\n return newContentModel;\n });\n }\n}\n\nexport default ModularUIRequest;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AAMA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;;;;;;;;;;;AAKA;AACA;AACA;AACA;IACMA,gB;EAYJ;AACF;EACE,0BAAYC,IAAZ,EAA2E;IAAA;;IAAA,IAA1CC,OAA0C,uEAAJ,EAAI;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA,+CANrCC,uBAAA,CAAaC,GAMwB;IAAA;;IACzE,IAAI,CAACH,IAAL,EAAW;MACT,MAAM,IAAII,oCAAJ,CACJ,wDADI,CAAN;IAGD;;IAED,KAAKH,OAAL,GAAeA,OAAf;IAEA,KAAKI,SAAL,GAAiB,IAAIC,0BAAJ,EAAjB;IAEA,KAAKN,IAAL,GAAY,OAAOA,IAAP,KAAgB,QAAhB,GAA2B,IAAIO,aAAJ,CAASP,IAAT,CAA3B,GAA4CA,IAAxD;IACA,KAAKQ,MAAL,sBAAcP,OAAO,CAACO,MAAtB,6DAAgC,IAAhC,CAZyE,CAczE;IACA;;IACA,KAAKH,SAAL,CAAeI,UAAf,GAA4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AAO,KAAKX,cAAL,GAAsB1D,IAAtB,CAA2B,UAAC0B,KAAD,EAAW;QAC3C,IACE2C,iBAAiB,IACjB3C,KAAK,YAAY4C,qBADjB,IAEA5C,KAAK,CAAC6C,iBAAN,CAAwBC,MAAxB,GAAiC,CAHnC,EAIE;UACA,OAAO,MAAI,CAACC,yBAAL,CAA+B/C,KAA/B,CAAP;QACD;;QAED,OAAO,iBAAQpC,OAAR,CAAgBoC,KAAhB,CAAP;MACD,CAVM,CAAP;IAWD;IAED;AACF;AACA;;;;WACE,mCAA0BgD,YAA1B,EAAsE;MAAA;MAAA;;MACpE,IAAMC,eAAe,GAAGD,YAAY,CAACE,KAAb,EAAxB;MAEA,OAAO,iBAAQ5D,GAAR,CACL,8BAAA0D,YAAY,CAACH,iBAAb,kBAAmC,UAACM,gBAAD,EAAsB;QACvD,IAAMC,wBAAwB,GAAGD,gBAAgB,CAACE,QAAjB,CAA0BC,YAA1B,CAC/BC,kCAD+B,EAE/BP,YAAY,CAACQ,SAFkB,CAAjC;QAKA,IAAM1B,OAAO,GAAG,IAAI3H,gBAAJ,CAAqBiJ,wBAArB,EAA+C;UAC7DxI,MAAM,EAAE,MAAI,CAACA;QADgD,CAA/C,CAAhB;QAIA,OAAOkH,OAAO,CAAC2B,YAAR,CAAqB,IAArB,CAAP;MACD,CAXD,CADK,EAaLnF,IAbK,CAaA,UAACoF,aAAD,EAAmB;QACxBT,eAAe,CAACU,aAAhB,GAAgCD,aAAhC;QAEA,OAAOT,eAAP;MACD,CAjBM,CAAP;IAkBD;;;;;eAGY9I,gB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIResponse.js","names":["ModularUIResponse","_locale","locale","_key","key","_data","data","_contributions","contributions","_parameters","parameters","input","response","dataKey","contributionsKey","modelData"],"sources":["../../src/modularui/ModularUIResponse.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\n\nimport type Parameter from \"../models/parameter/Parameter\";\n\n/**\n */\nclass ModularUIResponse {\n _key: string = \"unknown\";\n _data: Object;\n _contributions: Object;\n _locale: string = \"en\";\n _parameters: Array<Parameter> = [];\n\n /**\n */\n static create(input: {\n key: string,\n data: Object,\n contributions: Object,\n }): ModularUIResponse {\n const response = new ModularUIResponse();\n\n if (has(input, \"data\") && has(input, \"contributions\")) {\n const [dataKey] = Object.keys(input.data);\n const [contributionsKey] = Object.keys(input.contributions);\n\n response.key = input.key ?? contributionsKey;\n response.data = input.data?.[dataKey];\n response.contributions = input.contributions?.[contributionsKey];\n }\n\n return response;\n }\n\n /**\n */\n set locale(locale: string) {\n this._locale = locale;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set data(data: Object) {\n this._data = data;\n }\n\n /**\n */\n get data(): Object {\n return this._data;\n }\n\n /**\n */\n set contributions(contributions: Object) {\n this._contributions = contributions;\n }\n\n /**\n */\n get contributions(): Object {\n return this._contributions;\n }\n\n /**\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n */\n static rehydrate(data: {\n key: string,\n locale: string,\n data: Object,\n contributions: Object,\n }): ModularUIResponse {\n const modelData = new ModularUIResponse();\n\n modelData.locale = data.locale;\n modelData.key = data.key;\n modelData.data = data.data;\n modelData.contributions = data.contributions;\n\n return modelData;\n }\n}\n\nexport default ModularUIResponse;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AAIA;AACA;IACMA,iB;;;gDACW,S;;;mDAGG,I;uDACc,E;;;;;;IA6BhC;AACF;IACE,eAAqB;MACnB,OAAO,KAAKC,OAAZ;IACD;IAED;AACF;;;IAbE;AACF;IACE,aAAWC,MAAX,EAA2B;MACzB,KAAKD,OAAL,GAAeC,MAAf;IACD;;;;IAcD;AACF;IACE,eAAkB;MAChB,OAAO,KAAKC,IAAZ;IACD;IAED;AACF;;SAXE,aAAQC,GAAR,EAAqB;MACnB,KAAKD,IAAL,GAAYC,GAAZ;IACD;;;;IAcD;AACF;IACE,eAAmB;MACjB,OAAO,KAAKC,KAAZ;IACD;IAED;AACF;;SAXE,aAASC,IAAT,EAAuB;MACrB,KAAKD,KAAL,GAAaC,IAAb;IACD;;;;IAcD;AACF;IACE,eAA4B;MAC1B,OAAO,KAAKC,cAAZ;IACD;IAED;AACF;;SAXE,aAAkBC,aAAlB,EAAyC;MACvC,KAAKD,cAAL,GAAsBC,aAAtB;IACD;;;;IAcD;AACF;IACE,eAAmC;MACjC,OAAO,KAAKC,WAAZ;IACD;IAED;AACF;;SAXE,aAAeC,UAAf,EAA6C;MAC3C,KAAKD,WAAL,GAAmBC,UAAnB;IACD;;;;IAzED;AACF;IACE,gBAAcC,KAAd,EAIsB;MACpB,IAAMC,QAAQ,GAAG,IAAIZ,iBAAJ,EAAjB;;MAEA,IAAI,
|
|
1
|
+
{"version":3,"file":"ModularUIResponse.js","names":["ModularUIResponse","_locale","locale","_key","key","_data","data","_contributions","contributions","_parameters","parameters","input","response","has","dataKey","contributionsKey","modelData"],"sources":["../../src/modularui/ModularUIResponse.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\n\nimport type Parameter from \"../models/parameter/Parameter\";\n\n/**\n */\nclass ModularUIResponse {\n _key: string = \"unknown\";\n _data: Object;\n _contributions: Object;\n _locale: string = \"en\";\n _parameters: Array<Parameter> = [];\n\n /**\n */\n static create(input: {\n key: string,\n data: Object,\n contributions: Object,\n }): ModularUIResponse {\n const response = new ModularUIResponse();\n\n if (has(input, \"data\") && has(input, \"contributions\")) {\n const [dataKey] = Object.keys(input.data);\n const [contributionsKey] = Object.keys(input.contributions);\n\n response.key = input.key ?? contributionsKey;\n response.data = input.data?.[dataKey];\n response.contributions = input.contributions?.[contributionsKey];\n }\n\n return response;\n }\n\n /**\n */\n set locale(locale: string) {\n this._locale = locale;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n */\n set key(key: string) {\n this._key = key;\n }\n\n /**\n */\n get key(): string {\n return this._key;\n }\n\n /**\n */\n set data(data: Object) {\n this._data = data;\n }\n\n /**\n */\n get data(): Object {\n return this._data;\n }\n\n /**\n */\n set contributions(contributions: Object) {\n this._contributions = contributions;\n }\n\n /**\n */\n get contributions(): Object {\n return this._contributions;\n }\n\n /**\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n */\n static rehydrate(data: {\n key: string,\n locale: string,\n data: Object,\n contributions: Object,\n }): ModularUIResponse {\n const modelData = new ModularUIResponse();\n\n modelData.locale = data.locale;\n modelData.key = data.key;\n modelData.data = data.data;\n modelData.contributions = data.contributions;\n\n return modelData;\n }\n}\n\nexport default ModularUIResponse;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AAIA;AACA;IACMA,iB;;;gDACW,S;;;mDAGG,I;uDACc,E;;;;;;IA6BhC;AACF;IACE,eAAqB;MACnB,OAAO,KAAKC,OAAZ;IACD;IAED;AACF;;;IAbE;AACF;IACE,aAAWC,MAAX,EAA2B;MACzB,KAAKD,OAAL,GAAeC,MAAf;IACD;;;;IAcD;AACF;IACE,eAAkB;MAChB,OAAO,KAAKC,IAAZ;IACD;IAED;AACF;;SAXE,aAAQC,GAAR,EAAqB;MACnB,KAAKD,IAAL,GAAYC,GAAZ;IACD;;;;IAcD;AACF;IACE,eAAmB;MACjB,OAAO,KAAKC,KAAZ;IACD;IAED;AACF;;SAXE,aAASC,IAAT,EAAuB;MACrB,KAAKD,KAAL,GAAaC,IAAb;IACD;;;;IAcD;AACF;IACE,eAA4B;MAC1B,OAAO,KAAKC,cAAZ;IACD;IAED;AACF;;SAXE,aAAkBC,aAAlB,EAAyC;MACvC,KAAKD,cAAL,GAAsBC,aAAtB;IACD;;;;IAcD;AACF;IACE,eAAmC;MACjC,OAAO,KAAKC,WAAZ;IACD;IAED;AACF;;SAXE,aAAeC,UAAf,EAA6C;MAC3C,KAAKD,WAAL,GAAmBC,UAAnB;IACD;;;;IAzED;AACF;IACE,gBAAcC,KAAd,EAIsB;MACpB,IAAMC,QAAQ,GAAG,IAAIZ,iBAAJ,EAAjB;;MAEA,IAAI,IAAAa,YAAA,EAAIF,KAAJ,EAAW,MAAX,KAAsB,IAAAE,YAAA,EAAIF,KAAJ,EAAW,eAAX,CAA1B,EAAuD;QAAA;;QACrD,mBAAkB,mBAAYA,KAAK,CAACL,IAAlB,CAAlB;QAAA;QAAA,IAAOQ,OAAP;;QACA,oBAA2B,mBAAYH,KAAK,CAACH,aAAlB,CAA3B;QAAA;QAAA,IAAOO,gBAAP;;QAEAH,QAAQ,CAACR,GAAT,iBAAeO,KAAK,CAACP,GAArB,mDAA4BW,gBAA5B;QACAH,QAAQ,CAACN,IAAT,kBAAgBK,KAAK,CAACL,IAAtB,gDAAgB,YAAaQ,OAAb,CAAhB;QACAF,QAAQ,CAACJ,aAAT,2BAAyBG,KAAK,CAACH,aAA/B,yDAAyB,qBAAsBO,gBAAtB,CAAzB;MACD;;MAED,OAAOH,QAAP;IACD;;;WAgED,mBAAiBN,IAAjB,EAKsB;MACpB,IAAMU,SAAS,GAAG,IAAIhB,iBAAJ,EAAlB;MAEAgB,SAAS,CAACd,MAAV,GAAmBI,IAAI,CAACJ,MAAxB;MACAc,SAAS,CAACZ,GAAV,GAAgBE,IAAI,CAACF,GAArB;MACAY,SAAS,CAACV,IAAV,GAAiBA,IAAI,CAACA,IAAtB;MACAU,SAAS,CAACR,aAAV,GAA0BF,IAAI,CAACE,aAA/B;MAEA,OAAOQ,SAAP;IACD;;;;;eAGYhB,iB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundaryFallback.js","names":["StyledBoundary","styled","div","StyledStack","pre","ErrorBoundaryFallback","className","componentStack","error","toString","displayName"],"sources":["../../src/react/ErrorBoundaryFallback.js"],"sourcesContent":["// @flow\nimport styled from \"styled-components\";\nimport { spacers, spacer } from \"../react-theme/utils/spacers\";\n\nimport type { StyledComponent } from \"styled-components\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { Node } from \"react\";\n\nexport type Props = {\n +className?: string,\n +componentStack: string,\n +error: Error,\n};\n\nconst StyledBoundary: StyledComponent<{}, Theme, *> = styled.div`\n padding: ${spacers(2, 1)};\n margin-bottom: ${spacer(2)};\n background-color: #e9ecef;\n border-radius: 0.3em;\n`;\n\nconst StyledStack = styled.pre`\n display: block;\n font-size: 87.5%;\n color: #212529;\n font-style: italic;\n`;\n\n/**\n */\nconst ErrorBoundaryFallback = ({\n className,\n componentStack,\n error,\n}: Props): Node => (\n <StyledBoundary className={className}>\n <h2>{error.toString()}</h2>\n <StyledStack className=\"debug\">{componentStack}</StyledStack>\n </StyledBoundary>\n);\n\nErrorBoundaryFallback.displayName = \"BI.ErrorBoundaryFallback\";\n\nexport default ErrorBoundaryFallback;\n"],"mappings":";;;;;;;;;AACA;;AACA;;;;AAYA,IAAMA,cAA6C,gBAAGC,
|
|
1
|
+
{"version":3,"file":"ErrorBoundaryFallback.js","names":["StyledBoundary","styled","div","spacers","spacer","StyledStack","pre","ErrorBoundaryFallback","className","componentStack","error","toString","displayName"],"sources":["../../src/react/ErrorBoundaryFallback.js"],"sourcesContent":["// @flow\nimport styled from \"styled-components\";\nimport { spacers, spacer } from \"../react-theme/utils/spacers\";\n\nimport type { StyledComponent } from \"styled-components\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { Node } from \"react\";\n\nexport type Props = {\n +className?: string,\n +componentStack: string,\n +error: Error,\n};\n\nconst StyledBoundary: StyledComponent<{}, Theme, *> = styled.div`\n padding: ${spacers(2, 1)};\n margin-bottom: ${spacer(2)};\n background-color: #e9ecef;\n border-radius: 0.3em;\n`;\n\nconst StyledStack = styled.pre`\n display: block;\n font-size: 87.5%;\n color: #212529;\n font-style: italic;\n`;\n\n/**\n */\nconst ErrorBoundaryFallback = ({\n className,\n componentStack,\n error,\n}: Props): Node => (\n <StyledBoundary className={className}>\n <h2>{error.toString()}</h2>\n <StyledStack className=\"debug\">{componentStack}</StyledStack>\n </StyledBoundary>\n);\n\nErrorBoundaryFallback.displayName = \"BI.ErrorBoundaryFallback\";\n\nexport default ErrorBoundaryFallback;\n"],"mappings":";;;;;;;;;AACA;;AACA;;;;AAYA,IAAMA,cAA6C,gBAAGC,yBAAA,CAAOC,GAAV;EAAA;AAAA,sFACtC,IAAAC,gBAAA,EAAQ,CAAR,EAAW,CAAX,CADsC,EAEhC,IAAAC,eAAA,EAAO,CAAP,CAFgC,CAAnD;;AAOA,IAAMC,WAAW,gBAAGJ,yBAAA,CAAOK,GAAV;EAAA;AAAA,sEAAjB;AAOA;AACA;;;AACA,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAwB;EAAA,IAC5BC,SAD4B,QAC5BA,SAD4B;EAAA,IAE5BC,cAF4B,QAE5BA,cAF4B;EAAA,IAG5BC,KAH4B,QAG5BA,KAH4B;EAAA,oBAK5B,sBAAC,cAAD;IAAgB,SAAS,EAAEF,SAA3B;IAAA,wBACE;MAAA,UAAKE,KAAK,CAACC,QAAN;IAAL,EADF,eAEE,qBAAC,WAAD;MAAa,SAAS,EAAC,OAAvB;MAAA,UAAgCF;IAAhC,EAFF;EAAA,EAL4B;AAAA,CAA9B;;AAWAF,qBAAqB,CAACK,WAAtB,GAAoC,0BAApC;eAEeL,qB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["window","parseDataToJSON","data","JSON","parse","error","JsonParseException","client","customReducers","theme","render","beforeRenderHooks","ErrorFallbackComponent","contextPath","Error","dataElement","document","querySelector","textContent","Cache","clear","browserHistory","basename","BASE","history","store","getState","loadOtherBrowserTabs","getItem","dispatch","FetchException","response","listen","location","action","onunhandledrejection","event","detail","errorMessage","reason","message","toString","body","className","addContentLoadedEvent","addEventListener","applicationNode","isSSR","mount","hydrate","reactRender"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n/* polyfills needed for ie11 */\nimport elementClosest from \"element-closest\";\nelementClosest(window);\n\n/* polyfill for focus-visible */\nimport \"focus-visible\";\n\nimport { hydrate, render as reactRender } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { BASE } from \"../constants/Constants\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange } from \"../redux/_router/actions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport Init from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type { ComponentType } from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\nexport type Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\n/**\n */\nconst parseDataToJSON = (data) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, used client side when JavaScript is enabled.\n */\nconst client = ({\n customReducers = {},\n theme = {},\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n}: Props = {}) => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]'\n );\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return;\n }\n\n const data = parseDataToJSON(dataElement.textContent);\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: BASE,\n });\n const { history, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data)\n );\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data.error.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n history.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n /**\n */\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n\n addContentLoadedEvent(store, history, theme, render, ErrorFallbackComponent);\n};\n\n/**\n */\nconst addContentLoadedEvent = (\n store,\n history,\n theme,\n render,\n ErrorFallbackComponent\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (applicationNode) {\n const isSSR = applicationNode.querySelector(\".application\");\n const mount = isSSR ? hydrate : reactRender;\n mount(\n <Init\n store={store}\n history={history}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n applicationNode\n );\n } else {\n throw new Error(\n \"No DOM element with id application found to attach client to\"\n );\n }\n });\n};\n\nexport default client;\n"],"mappings":";;;;;;;;;;;AAEA;;AAIA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;AAEA;;AAIA;;AAEA;;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;;AAnCA;AAEA,
|
|
1
|
+
{"version":3,"file":"client.js","names":["elementClosest","window","parseDataToJSON","data","JSON","parse","error","JsonParseException","client","customReducers","theme","render","beforeRenderHooks","ErrorFallbackComponent","contextPath","Error","dataElement","document","querySelector","textContent","Cache","clear","browserHistory","createBrowserHistory","basename","BASE","configureStore","rehydrate","history","store","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","getItem","dispatch","loginSuccess","has","FetchException","response","handleError","listen","location","action","locationChange","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","showXHRErrorNotification","body","className","handleBeforeRenderHooks","addContentLoadedEvent","addEventListener","applicationNode","isSSR","mount","hydrate","reactRender"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n/* polyfills needed for ie11 */\nimport elementClosest from \"element-closest\";\nelementClosest(window);\n\n/* polyfill for focus-visible */\nimport \"focus-visible\";\n\nimport { hydrate, render as reactRender } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { BASE } from \"../constants/Constants\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange } from \"../redux/_router/actions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport Init from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type { ComponentType } from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\nexport type Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\n/**\n */\nconst parseDataToJSON = (data) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, used client side when JavaScript is enabled.\n */\nconst client = ({\n customReducers = {},\n theme = {},\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n}: Props = {}) => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]'\n );\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return;\n }\n\n const data = parseDataToJSON(dataElement.textContent);\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: BASE,\n });\n const { history, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data)\n );\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data.error.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n history.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n /**\n */\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n\n addContentLoadedEvent(store, history, theme, render, ErrorFallbackComponent);\n};\n\n/**\n */\nconst addContentLoadedEvent = (\n store,\n history,\n theme,\n render,\n ErrorFallbackComponent\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (applicationNode) {\n const isSSR = applicationNode.querySelector(\".application\");\n const mount = isSSR ? hydrate : reactRender;\n mount(\n <Init\n store={store}\n history={history}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n applicationNode\n );\n } else {\n throw new Error(\n \"No DOM element with id application found to attach client to\"\n );\n }\n });\n};\n\nexport default client;\n"],"mappings":";;;;;;;;;;;AAEA;;AAIA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;AAEA;;AAIA;;AAEA;;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;;AAnCA;AAEA,IAAAA,uBAAA,EAAeC,MAAf;AAEA;;AA+CA;AACA;AACA;;AACA;AACA;AACA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,IAAD,EAAU;EAChC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAL,CAAWF,IAAX,CAAP;EACD,CAFD,CAEE,OAAOG,KAAP,EAAc;IACd,MAAM,IAAIC,8BAAJ,iCAAgDJ,IAAhD,EAAN;EACD;AACF,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