@beinformed/ui 1.34.0 → 1.34.2
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 +14 -0
- package/esm/builder/mergeLayoutHintConfigurations.js +29 -28
- package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/esm/react-client/client.js +1 -2
- package/esm/react-client/client.js.map +1 -1
- package/lib/builder/__tests__/mergeLayoutHintConfigurations.spec.js.flow +23 -16
- package/lib/builder/mergeLayoutHintConfigurations.js +29 -28
- package/lib/builder/mergeLayoutHintConfigurations.js.flow +33 -37
- package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/lib/constants/Constants.js +33 -66
- package/lib/constants/Constants.js.map +1 -1
- package/lib/constants/LayoutHintConfig.js +1 -2
- package/lib/constants/LayoutHintConfig.js.map +1 -1
- package/lib/constants/LayoutHints.js +18 -36
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js +3 -6
- package/lib/constants/Settings.js.map +1 -1
- package/lib/exceptions/ConfigurationException.js +1 -2
- package/lib/exceptions/ConfigurationException.js.map +1 -1
- package/lib/exceptions/IllegalArgumentException.js +1 -2
- package/lib/exceptions/IllegalArgumentException.js.map +1 -1
- package/lib/exceptions/IllegalReturnException.js +1 -2
- package/lib/exceptions/IllegalReturnException.js.map +1 -1
- package/lib/exceptions/IllegalStateException.js +1 -2
- package/lib/exceptions/IllegalStateException.js.map +1 -1
- package/lib/exceptions/JsonParseException.js +1 -2
- package/lib/exceptions/JsonParseException.js.map +1 -1
- package/lib/exceptions/MissingPropertyException.js +1 -2
- package/lib/exceptions/MissingPropertyException.js.map +1 -1
- package/lib/exceptions/NetworkException.js +1 -2
- package/lib/exceptions/NetworkException.js.map +1 -1
- package/lib/exceptions/NotAllowedUriException.js +1 -2
- package/lib/exceptions/NotAllowedUriException.js.map +1 -1
- package/lib/exceptions/NotFoundException.js +1 -2
- package/lib/exceptions/NotFoundException.js.map +1 -1
- package/lib/exceptions/ServerRequestException.js +1 -2
- package/lib/exceptions/ServerRequestException.js.map +1 -1
- package/lib/exceptions/ThemePropertyException.js +1 -2
- package/lib/exceptions/ThemePropertyException.js.map +1 -1
- package/lib/exceptions/TimeoutException.js +1 -2
- package/lib/exceptions/TimeoutException.js.map +1 -1
- package/lib/exceptions/UnauthorizedException.js +1 -2
- package/lib/exceptions/UnauthorizedException.js.map +1 -1
- package/lib/exceptions/UnsupportedOperationException.js +1 -2
- package/lib/exceptions/UnsupportedOperationException.js.map +1 -1
- package/lib/hooks/useDeepCompareEffect.js +1 -2
- package/lib/hooks/useDeepCompareEffect.js.map +1 -1
- package/lib/i18n/Locale.js +1 -2
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/i18n/Locales.js +2 -4
- package/lib/i18n/Locales.js.map +1 -1
- package/lib/i18n/Message.js +1 -2
- package/lib/i18n/Message.js.map +1 -1
- package/lib/i18n/languages.js +1 -2
- package/lib/i18n/languages.js.map +1 -1
- package/lib/i18n/translations/beinformed_error_messages_en.nl.js +1 -2
- package/lib/i18n/translations/beinformed_error_messages_en.nl.js.map +1 -1
- package/lib/i18n/translations/beinformed_error_messages_nl.nl.js +1 -2
- package/lib/i18n/translations/beinformed_error_messages_nl.nl.js.map +1 -1
- package/lib/i18n/withMessage.js +1 -2
- package/lib/i18n/withMessage.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js +1 -2
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js +1 -2
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js +1 -2
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js +1 -2
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +1 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js +1 -2
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js +1 -2
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +1 -2
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/_createAttribute.js +1 -2
- package/lib/models/attributes/_createAttribute.js.map +1 -1
- package/lib/models/attributes/input-constraints/BSNConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/BSNConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/FileExtensionConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/FileExtensionConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/FileSizeConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/IBANConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/MandatoryConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/MandatoryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/MandatoryRangeConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/MandatoryRangeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordConfirmConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/PasswordConfirmConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordLowerAndUpperCaseConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/PasswordLowerAndUpperCaseConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordMinNumericCharactersConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/PasswordMinNumericCharactersConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordMinSpecialCharactersConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/PasswordMinSpecialCharactersConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/RangeConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/RangeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/RegexConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/RegexConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/StringLengthConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/StringLengthConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/XMLConstraint.js +1 -2
- package/lib/models/attributes/input-constraints/XMLConstraint.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js +1 -2
- package/lib/models/attributes/layouthint-rules/BaseLayoutHintRule.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js +1 -2
- package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/LayoutHintRuleCollection.js +1 -2
- package/lib/models/attributes/layouthint-rules/LayoutHintRuleCollection.js.map +1 -1
- package/lib/models/attributes/layouthint-rules/RemainingTotalUploadSize.js +1 -2
- package/lib/models/attributes/layouthint-rules/RemainingTotalUploadSize.js.map +1 -1
- package/lib/models/base/BaseCollection.js +1 -2
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/BaseModel.js +1 -2
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/base/ResourceCollection.js +1 -2
- package/lib/models/base/ResourceCollection.js.map +1 -1
- package/lib/models/base/ResourceModel.js +1 -2
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +1 -2
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptTypeDetailModel.js +1 -2
- package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js +1 -2
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/SectionModel.js +1 -2
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationElements.js +1 -2
- package/lib/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationEndResults.js +1 -2
- package/lib/models/contentconfiguration/ContentConfigurationEndResults.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationQuestions.js +1 -2
- package/lib/models/contentconfiguration/ContentConfigurationQuestions.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationResults.js +1 -2
- package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
- package/lib/models/error/ErrorModel.js +1 -2
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/form/FormModel.js +1 -2
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/href/Href.js +1 -2
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/links/LinkModel.js +1 -2
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/links/normalizeLinkJSON.js +1 -2
- package/lib/models/links/normalizeLinkJSON.js.map +1 -1
- package/lib/models/list/ListItemCollection.js +1 -2
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/models/lookup/LookupOptionCollection.js +1 -2
- package/lib/models/lookup/LookupOptionCollection.js.map +1 -1
- package/lib/models/parameter/Parameter.js +1 -2
- package/lib/models/parameter/Parameter.js.map +1 -1
- package/lib/models/resolveModel.js +1 -2
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/sorting/SortOptionModel.js +1 -2
- package/lib/models/sorting/SortOptionModel.js.map +1 -1
- package/lib/models/sorting/SortingModel.js +1 -2
- package/lib/models/sorting/SortingModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js +1 -2
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +1 -2
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/CaptchaRequest.js +1 -2
- package/lib/modularui/CaptchaRequest.js.map +1 -1
- package/lib/modularui/ModularUIError.js +1 -2
- package/lib/modularui/ModularUIError.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +1 -2
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js +1 -2
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/modularui/UploadRequest.js +1 -2
- package/lib/modularui/UploadRequest.js.map +1 -1
- package/lib/react/ErrorBoundary.js +1 -2
- package/lib/react/ErrorBoundary.js.map +1 -1
- package/lib/react/ErrorBoundaryFallback.js +1 -2
- package/lib/react/ErrorBoundaryFallback.js.map +1 -1
- package/lib/react-client/client.js +1 -2
- package/lib/react-client/client.js.flow +6 -3
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/rehydrate.js +1 -2
- package/lib/react-client/rehydrate.js.map +1 -1
- package/lib/react-server/createSSRComplete.js +1 -2
- package/lib/react-server/createSSRComplete.js.map +1 -1
- package/lib/react-server/htmlpage.js +1 -2
- package/lib/react-server/htmlpage.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js +1 -2
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js +1 -2
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/serverNoSSR.js +1 -2
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/react-server/serverSSR.js +1 -2
- package/lib/react-server/serverSSR.js.map +1 -1
- package/lib/react-theme/ThemeProvider.js +1 -2
- package/lib/react-theme/ThemeProvider.js.map +1 -1
- package/lib/react-theme/createTheme.js +1 -2
- package/lib/react-theme/createTheme.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js +1 -2
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js +1 -2
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js +1 -2
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/_router/RouterConnectors.js +5 -10
- package/lib/redux/_router/RouterConnectors.js.map +1 -1
- package/lib/redux/connectors/Application.js +1 -2
- package/lib/redux/connectors/Application.js.map +1 -1
- package/lib/redux/connectors/Breadcrumb.js +1 -2
- package/lib/redux/connectors/Breadcrumb.js.map +1 -1
- package/lib/redux/connectors/CaseView.js +1 -2
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js +1 -2
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js +1 -2
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js +1 -2
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js +1 -2
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js +1 -2
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js +1 -2
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js +1 -2
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/Modal.js +1 -2
- package/lib/redux/connectors/Modal.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js +1 -2
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/Notification.js +1 -2
- package/lib/redux/connectors/Notification.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js +1 -2
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/Progress.js +1 -2
- package/lib/redux/connectors/Progress.js.map +1 -1
- package/lib/redux/connectors/ProgressIndicator.js +1 -2
- package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js +1 -2
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/SignIn.js +1 -2
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js +1 -2
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/connectors/Tab.js +1 -2
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js +1 -2
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/ErrorReducer.js +1 -2
- package/lib/redux/reducers/ErrorReducer.js.map +1 -1
- package/lib/redux/reducers/ModalsReducer.js +1 -2
- package/lib/redux/reducers/ModalsReducer.js.map +1 -1
- package/lib/redux/reducers/NotificationReducer.js +1 -2
- package/lib/redux/reducers/NotificationReducer.js.map +1 -1
- package/lib/redux/reducers/PreferencesReducer.js +1 -2
- package/lib/redux/reducers/PreferencesReducer.js.map +1 -1
- package/lib/redux/reducers/ProgressIndicatorReducer.js +1 -2
- package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
- package/lib/redux/store/configureStore.js +1 -2
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/utils/browser/Cache.js +1 -2
- package/lib/utils/browser/Cache.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js +4 -8
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js +1 -2
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js +1 -2
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/createUUID.js +1 -2
- package/lib/utils/helpers/createUUID.js.map +1 -1
- package/lib/utils/number/DecimalFormat.js +1 -2
- package/lib/utils/number/DecimalFormat.js.map +1 -1
- package/lib/utils/number/formatValue.js +1 -2
- package/lib/utils/number/formatValue.js.map +1 -1
- package/package.json +12 -13
- package/src/builder/__tests__/LayoutHintConfig.json +11 -0
- package/src/builder/__tests__/mergeLayoutHintConfigurations.spec.js +23 -16
- package/src/builder/__tests__/subdir/LayoutHintConfig.json +11 -0
- package/src/builder/mergeLayoutHintConfigurations.js +33 -37
- package/src/react-client/client.js +6 -3
- package/types/models/filters/StringFilterModel.d.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.34.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.34.1...v1.34.2) (2023-10-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **login:** redirect on all UnAuthorized errors ([bb371ec](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/bb371ec20d24e373e127ea276c854ff8f5175318))
|
|
11
|
+
|
|
12
|
+
## [1.34.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.34.0...v1.34.1) (2023-09-13)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **layout-hint-json:** replace glob with node packages ([c25b89f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/c25b89f811a934cf2ce57254e5d06a574b674561))
|
|
18
|
+
|
|
5
19
|
## [1.34.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.33.0...v1.34.0) (2023-09-13)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
2
|
-
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
3
2
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
4
3
|
import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
|
|
5
|
-
|
|
6
|
-
const fs = require("fs");
|
|
4
|
+
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
7
5
|
const path = require("path");
|
|
6
|
+
const {
|
|
7
|
+
readdirSync,
|
|
8
|
+
statSync,
|
|
9
|
+
readFileSync,
|
|
10
|
+
writeFileSync
|
|
11
|
+
} = require("fs");
|
|
8
12
|
const {
|
|
9
13
|
LayoutHintConfiguration
|
|
10
14
|
} = require("../constants/LayoutHintConfig");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const findFiles = dir => {
|
|
16
|
+
const matchedFiles = [];
|
|
17
|
+
const files = readdirSync(dir);
|
|
18
|
+
for (const file of files) {
|
|
19
|
+
const absolute = path.join(dir, file);
|
|
20
|
+
if (statSync(absolute).isDirectory()) {
|
|
21
|
+
const foundFiles = findFiles(absolute);
|
|
22
|
+
matchedFiles.push(...foundFiles);
|
|
23
|
+
} else {
|
|
24
|
+
const filename = path.basename(file);
|
|
25
|
+
if (filename === "LayoutHintConfig.json") {
|
|
26
|
+
matchedFiles.push(absolute);
|
|
18
27
|
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return matchedFiles;
|
|
22
31
|
};
|
|
23
32
|
|
|
24
33
|
/**
|
|
@@ -28,21 +37,13 @@ const readFiles = files => {
|
|
|
28
37
|
*/
|
|
29
38
|
exports.mergeLayoutHintConfigurations = async (srcFolder, outputFolder) => {
|
|
30
39
|
const escapedSrcFolder = srcFolder.replace(/\\/g, "/");
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
readFiles(files).then(jsons => {
|
|
37
|
-
const newConfig = _Object$assign(LayoutHintConfiguration, ...jsons);
|
|
38
|
-
fs.writeFile(path.join(outputFolder, "LayoutHintConfig.json"), _JSON$stringify(newConfig), writeErr => {
|
|
39
|
-
if (writeErr) {
|
|
40
|
-
return reject(writeErr);
|
|
41
|
-
}
|
|
42
|
-
return resolve();
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
40
|
+
const files = findFiles(escapedSrcFolder);
|
|
41
|
+
const jsons = _mapInstanceProperty(files).call(files, file => {
|
|
42
|
+
const content = readFileSync(file, "utf-8");
|
|
43
|
+
return JSON.parse(content);
|
|
46
44
|
});
|
|
45
|
+
const newConfig = _Object$assign(LayoutHintConfiguration, ...jsons);
|
|
46
|
+
writeFileSync(path.join(outputFolder, "LayoutHintConfig.json"), _JSON$stringify(newConfig));
|
|
47
|
+
return _Promise.resolve();
|
|
47
48
|
};
|
|
48
49
|
//# sourceMappingURL=mergeLayoutHintConfigurations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["
|
|
1
|
+
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["path","require","readdirSync","statSync","readFileSync","writeFileSync","LayoutHintConfiguration","findFiles","dir","matchedFiles","files","file","absolute","join","isDirectory","foundFiles","push","filename","basename","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","replace","jsons","_mapInstanceProperty","call","content","JSON","parse","newConfig","_Object$assign","_JSON$stringify","_Promise","resolve"],"sources":["../../src/builder/mergeLayoutHintConfigurations.js"],"sourcesContent":["// @flow\nconst path = require(\"path\");\nconst { readdirSync, statSync, readFileSync, writeFileSync } = require(\"fs\");\n\nconst { LayoutHintConfiguration } = require(\"../constants/LayoutHintConfig\");\n\nconst findFiles = (dir: string): Array<string> => {\n const matchedFiles = [];\n\n const files = readdirSync(dir);\n\n for (const file of files) {\n const absolute = path.join(dir, file);\n if (statSync(absolute).isDirectory()) {\n const foundFiles = findFiles(absolute);\n matchedFiles.push(...foundFiles);\n } else {\n const filename = path.basename(file);\n if (filename === \"LayoutHintConfig.json\") {\n matchedFiles.push(absolute);\n }\n }\n }\n\n return matchedFiles;\n};\n\n/**\n * Merge all LayoutHintConfig.json files from this library and in the srcFolder\n * together into one config file, and copies it to the outputFolder.<br/>\n * This file is consumed by Be Informed studio to give layout hint information\n */\nexports.mergeLayoutHintConfigurations = async (\n srcFolder: string,\n outputFolder: string,\n): Promise<void> => {\n const escapedSrcFolder = srcFolder.replace(/\\\\/g, \"/\");\n\n const files = findFiles(escapedSrcFolder);\n\n const jsons = files.map((file) => {\n const content = readFileSync(file, \"utf-8\");\n return JSON.parse(content);\n });\n\n const newConfig = Object.assign(LayoutHintConfiguration, ...jsons);\n\n writeFileSync(\n path.join(outputFolder, \"LayoutHintConfig.json\"),\n JSON.stringify(newConfig),\n );\n\n return Promise.resolve();\n};\n"],"mappings":";;;;AACA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAM;EAAEC,WAAW;EA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C;EAEF,MAAMG,SAAS,GAAGC,cAAA,CAAc1B,uBAAuB,EAAE,GAAGmB,KAAK,CAAC;EAElEpB,aAAa,CACXL,IAAI,CAACa,IAAI,CAACS,YAAY,EAAE,uBAAuB,CAAC,EAChDW,eAAA,CAAeF,SAAS,CAC1B,CAAC;EAED,OAAOG,QAAA,CAAQC,OAAO,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -18,7 +18,6 @@ import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
|
18
18
|
import { JsonParseException, FetchException } from "../exceptions";
|
|
19
19
|
import { Init } from "./Init";
|
|
20
20
|
import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
|
|
21
|
-
import UnauthorizedException from "../exceptions/UnauthorizedException";
|
|
22
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
22
|
/*
|
|
24
23
|
* deserialize serialized data from the server to provide a smooth dehydration.
|
|
@@ -67,7 +66,7 @@ const handleRedirectURI = store => {
|
|
|
67
66
|
xhr({
|
|
68
67
|
url: `${getBasePath()}${redirectURI}`
|
|
69
68
|
}).catch(e => {
|
|
70
|
-
if (e
|
|
69
|
+
if (e.id === "UnauthorizedException" || e.id === "Error.NotAuthorized" || e.id === "Error.Authentication.Required" || e.id === "Error.Authentication.InvalidCredentials") {
|
|
71
70
|
const LOGIN_PATH = getSetting("LOGIN_PATH", "/signin");
|
|
72
71
|
store.dispatch(replace(LOGIN_PATH, {
|
|
73
72
|
from: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["hydrate","render","has","setImmediate","Cache","xhr","createBrowserHistory","configureStore","rehydrate","getBasePath","getSetting","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","locationChange","replace","JsonParseException","FetchException","Init","handleBeforeRenderHooks","UnauthorizedException","jsx","_jsx","parseDataToJSON","data","JSON","parse","error","getDataFromServer","_context","dataElement","document","querySelector","Error","_trimInstanceProperty","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","handleRedirectURI","urlParams","_URLSearchParams","location","search","redirectURI","get","url","catch","e","LOGIN_PATH","from","pathname","modal","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","getState","loadOtherBrowserTabs","getItem","response","listen","action","body","className","addContentLoadedEvent","theme","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { getBasePath, getSetting } from \"../constants/Settings\";\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, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport UnauthorizedException from \"../exceptions/UnauthorizedException\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\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 return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\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\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePath()}${redirectURI}` }).catch((e) => {\n if (e instanceof UnauthorizedException) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePath(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\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 routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;AACA;AACA,SAASA,OAAO,EAAEC,MAAM,QAAQ,WAAW;AAE3C,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,YAAY,MAAM,cAAc;AAEvC,OAAOC,KAAK,MAAM,wBAAwB;AAE1C,OAAOC,GAAG,MAAM,oBAAoB;AAEpC,SAASC,oBAAoB,QAAQ,SAAS;AAC9C,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,WAAW,EAAEC,UAAU,QAAQ,uBAAuB;AAE/D,SACEC,0BAA0B,EAC1BC,mBAAmB,QACd,8BAA8B;AACrC,SAASC,wBAAwB,QAAQ,+BAA+B;AAExE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,YAAY,QAAQ,yBAAyB;AAEtD,SAASC,cAAc,EAAEC,OAAO,QAAQ,gCAAgC;AAExE,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,eAAe;AAElE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,uBAAuB,QAAQ,kCAAkC;AAE1E,OAAOC,qBAAqB,MAAM,qCAAqC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA2BxE;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,IAAY,IAAK;EACxC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC;EACzB,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,MAAM,IAAIX,kBAAkB,CAAE,yBAAwBQ,IAAK,EAAC,CAAC;EAC/D;AACF,CAAC;AAED,MAAMI,iBAAiB,G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AmD,KAAK,CACHE,eAAe,eACfhE,IAAA,CAACJ,IAAI;MACHoB,KAAK,EAAEA,KAAM;MACbkC,aAAa,EAAEA,aAAc;MAC7BJ,WAAW,EAAE7B,MAAM,CAAC6B,WAAY;MAChCc,KAAK,EAAEA,KAAM;MACbC,sBAAsB,EAAEA,sBAAuB;MAAAI,QAAA,EAE9CxF,MAAM,CAAC;IAAC,CACL,CACR,CAAC;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA,MAAMyF,WAAW,GAAGA,CAClBF,eAAwB,EACxBG,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGJ,eAAe,CAACtD,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAI0D,KAAK,EAAE;IACT5F,OAAO,CAAC2F,OAAO,EAAEH,eAAe,CAAC;EACnC,CAAC,MAAM;IACLvF,MAAM,CAAC0F,OAAO,EAAEH,eAAe,CAAC;EAClC;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB7B,cAAc;IACdmB,KAAK;IACLnF,MAAM;IACNoE,iBAAiB;IACjBgB,sBAAsB;IACtBC;EACK,CAAC,GAAAQ,IAAA;EACN,MAAM;IAAEtD,KAAK;IAAEkC;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAEDc,qBAAqB,CACnB3C,KAAK,EACLkC,aAAa,EACbU,KAAK,EACLnF,MAAM,EACNoF,sBAAsB,EACtBC,KAAK,IAAII,WACX,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["hydrate","render","has","setImmediate","Cache","xhr","createBrowserHistory","configureStore","rehydrate","getBasePath","getSetting","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","locationChange","replace","JsonParseException","FetchException","Init","handleBeforeRenderHooks","jsx","_jsx","parseDataToJSON","data","JSON","parse","error","getDataFromServer","_context","dataElement","document","querySelector","Error","_trimInstanceProperty","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","handleRedirectURI","urlParams","_URLSearchParams","location","search","redirectURI","get","url","catch","e","id","LOGIN_PATH","from","pathname","modal","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","getState","loadOtherBrowserTabs","getItem","response","listen","action","body","className","addContentLoadedEvent","theme","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { getBasePath, getSetting } from \"../constants/Settings\";\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, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\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 return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\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\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePath()}${redirectURI}` }).catch((e) => {\n if (\n e.id === \"UnauthorizedException\" ||\n e.id === \"Error.NotAuthorized\" ||\n e.id === \"Error.Authentication.Required\" ||\n e.id === \"Error.Authentication.InvalidCredentials\"\n ) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePath(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\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 routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;AACA;AACA,SAASA,OAAO,EAAEC,MAAM,QAAQ,WAAW;AAE3C,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,YAAY,MAAM,cAAc;AAEvC,OAAOC,KAAK,MAAM,wBAAwB;AAE1C,OAAOC,GAAG,MAAM,oBAAoB;AAEpC,SAASC,oBAAoB,QAAQ,SAAS;AAC9C,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,WAAW,EAAEC,UAAU,QAAQ,uBAAuB;AAE/D,SACEC,0BAA0B,EAC1BC,mBAAmB,QACd,8BAA8B;AACrC,SAASC,wBAAwB,QAAQ,+BAA+B;AAExE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,YAAY,QAAQ,yBAAyB;AAEtD,SAASC,cAAc,EAAEC,OAAO,QAAQ,gCAAgC;AAExE,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,eAAe;AAElE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,uBAAuB,QAAQ,kCAAkC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA2B3E;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,IAAY,IAAK;EACxC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC;EACzB,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,MAAM,IAAIV,kBAAkB,CAAE,yBAAwBO,IAAK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Configurations";
|
|
2
2
|
import { LayoutHintConfiguration } from "../../constants/LayoutHintConfig";
|
|
3
3
|
const fs = require("fs");
|
|
4
|
-
|
|
5
|
-
const
|
|
4
|
+
//
|
|
5
|
+
const projectJson1 = {
|
|
6
6
|
MOCK: {
|
|
7
7
|
hint: "mock",
|
|
8
8
|
description: {
|
|
@@ -14,31 +14,38 @@ const projectJson = {
|
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
const projectJson2 = {
|
|
18
|
+
MOCK2: {
|
|
19
|
+
hint: "mock2",
|
|
20
|
+
description: {
|
|
21
|
+
NL: "mock2 dutch description",
|
|
22
|
+
EN: "mock2 english description",
|
|
23
|
+
},
|
|
24
|
+
link: "",
|
|
25
|
+
component: ["attribute"],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
17
29
|
jest.mock("fs", () => ({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
),
|
|
21
|
-
writeFile: jest.fn((path, options, callback) => callback(null)),
|
|
30
|
+
...jest.requireActual("fs"),
|
|
31
|
+
writeFileSync: jest.fn(),
|
|
22
32
|
}));
|
|
23
33
|
|
|
24
|
-
jest.mock("glob", () =>
|
|
25
|
-
jest.fn((pattern, options, callback) =>
|
|
26
|
-
callback(null, ["/input/LayoutHintConfig.json"]),
|
|
27
|
-
),
|
|
28
|
-
);
|
|
29
|
-
|
|
30
34
|
describe("mergeLayoutHintConfigurations", () => {
|
|
31
35
|
it("generates layouthint.json", async () => {
|
|
32
36
|
expect.assertions(1);
|
|
33
37
|
|
|
34
|
-
const expectedJson = {
|
|
38
|
+
const expectedJson = {
|
|
39
|
+
...LayoutHintConfiguration,
|
|
40
|
+
...projectJson1,
|
|
41
|
+
...projectJson2,
|
|
42
|
+
};
|
|
35
43
|
|
|
36
|
-
await mergeLayoutHintConfigurations("
|
|
44
|
+
await mergeLayoutHintConfigurations("./src", "/output");
|
|
37
45
|
|
|
38
|
-
expect(fs.
|
|
46
|
+
expect(fs.writeFileSync).toHaveBeenCalledWith(
|
|
39
47
|
expect.stringContaining("LayoutHintConfig.json"),
|
|
40
48
|
JSON.stringify(expectedJson),
|
|
41
|
-
expect.anything(),
|
|
42
49
|
);
|
|
43
50
|
});
|
|
44
51
|
});
|
|
@@ -2,26 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
4
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
5
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
6
5
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
7
6
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
8
|
-
|
|
9
|
-
const fs = require("fs");
|
|
7
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
10
8
|
const path = require("path");
|
|
9
|
+
const {
|
|
10
|
+
readdirSync,
|
|
11
|
+
statSync,
|
|
12
|
+
readFileSync,
|
|
13
|
+
writeFileSync
|
|
14
|
+
} = require("fs");
|
|
11
15
|
const {
|
|
12
16
|
LayoutHintConfiguration
|
|
13
17
|
} = require("../constants/LayoutHintConfig");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const findFiles = dir => {
|
|
19
|
+
const matchedFiles = [];
|
|
20
|
+
const files = readdirSync(dir);
|
|
21
|
+
for (const file of files) {
|
|
22
|
+
const absolute = path.join(dir, file);
|
|
23
|
+
if (statSync(absolute).isDirectory()) {
|
|
24
|
+
const foundFiles = findFiles(absolute);
|
|
25
|
+
matchedFiles.push(...foundFiles);
|
|
26
|
+
} else {
|
|
27
|
+
const filename = path.basename(file);
|
|
28
|
+
if (filename === "LayoutHintConfig.json") {
|
|
29
|
+
matchedFiles.push(absolute);
|
|
21
30
|
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return matchedFiles;
|
|
25
34
|
};
|
|
26
35
|
|
|
27
36
|
/**
|
|
@@ -31,21 +40,13 @@ const readFiles = files => {
|
|
|
31
40
|
*/
|
|
32
41
|
exports.mergeLayoutHintConfigurations = async (srcFolder, outputFolder) => {
|
|
33
42
|
const escapedSrcFolder = srcFolder.replace(/\\/g, "/");
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
readFiles(files).then(jsons => {
|
|
40
|
-
const newConfig = (0, _assign.default)(LayoutHintConfiguration, ...jsons);
|
|
41
|
-
fs.writeFile(path.join(outputFolder, "LayoutHintConfig.json"), (0, _stringify.default)(newConfig), writeErr => {
|
|
42
|
-
if (writeErr) {
|
|
43
|
-
return reject(writeErr);
|
|
44
|
-
}
|
|
45
|
-
return resolve();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
43
|
+
const files = findFiles(escapedSrcFolder);
|
|
44
|
+
const jsons = (0, _map.default)(files).call(files, file => {
|
|
45
|
+
const content = readFileSync(file, "utf-8");
|
|
46
|
+
return JSON.parse(content);
|
|
49
47
|
});
|
|
48
|
+
const newConfig = (0, _assign.default)(LayoutHintConfiguration, ...jsons);
|
|
49
|
+
writeFileSync(path.join(outputFolder, "LayoutHintConfig.json"), (0, _stringify.default)(newConfig));
|
|
50
|
+
return _promise.default.resolve();
|
|
50
51
|
};
|
|
51
52
|
//# sourceMappingURL=mergeLayoutHintConfigurations.js.map
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
const glob = require("glob");
|
|
3
|
-
const fs = require("fs");
|
|
4
2
|
const path = require("path");
|
|
3
|
+
const { readdirSync, statSync, readFileSync, writeFileSync } = require("fs");
|
|
5
4
|
|
|
6
5
|
const { LayoutHintConfiguration } = require("../constants/LayoutHintConfig");
|
|
7
6
|
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
fs.readFile(file, "utf-8", (err, data) => {
|
|
13
|
-
if (err) {
|
|
14
|
-
return reject(err);
|
|
15
|
-
} else {
|
|
16
|
-
return resolve(JSON.parse(data));
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}),
|
|
20
|
-
);
|
|
7
|
+
const findFiles = (dir: string): Array<string> => {
|
|
8
|
+
const matchedFiles = [];
|
|
9
|
+
|
|
10
|
+
const files = readdirSync(dir);
|
|
21
11
|
|
|
22
|
-
|
|
12
|
+
for (const file of files) {
|
|
13
|
+
const absolute = path.join(dir, file);
|
|
14
|
+
if (statSync(absolute).isDirectory()) {
|
|
15
|
+
const foundFiles = findFiles(absolute);
|
|
16
|
+
matchedFiles.push(...foundFiles);
|
|
17
|
+
} else {
|
|
18
|
+
const filename = path.basename(file);
|
|
19
|
+
if (filename === "LayoutHintConfig.json") {
|
|
20
|
+
matchedFiles.push(absolute);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return matchedFiles;
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
/**
|
|
@@ -32,27 +35,20 @@ exports.mergeLayoutHintConfigurations = async (
|
|
|
32
35
|
outputFolder: string,
|
|
33
36
|
): Promise<void> => {
|
|
34
37
|
const escapedSrcFolder = srcFolder.replace(/\\/g, "/");
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
glob(escapedSrcFolder + "/**/LayoutHintConfig.json", {}, (err, files) => {
|
|
37
|
-
if (err) {
|
|
38
|
-
return reject(err);
|
|
39
|
-
}
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(writeErr) => {
|
|
48
|
-
if (writeErr) {
|
|
49
|
-
return reject(writeErr);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return resolve();
|
|
53
|
-
},
|
|
54
|
-
);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
39
|
+
const files = findFiles(escapedSrcFolder);
|
|
40
|
+
|
|
41
|
+
const jsons = files.map((file) => {
|
|
42
|
+
const content = readFileSync(file, "utf-8");
|
|
43
|
+
return JSON.parse(content);
|
|
57
44
|
});
|
|
45
|
+
|
|
46
|
+
const newConfig = Object.assign(LayoutHintConfiguration, ...jsons);
|
|
47
|
+
|
|
48
|
+
writeFileSync(
|
|
49
|
+
path.join(outputFolder, "LayoutHintConfig.json"),
|
|
50
|
+
JSON.stringify(newConfig),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return Promise.resolve();
|
|
58
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["
|
|
1
|
+
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["path","require","readdirSync","statSync","readFileSync","writeFileSync","LayoutHintConfiguration","findFiles","dir","matchedFiles","files","file","absolute","join","isDirectory","foundFiles","push","filename","basename","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","replace","jsons","_map","default","call","content","JSON","parse","newConfig","_assign","_stringify","_promise","resolve"],"sources":["../../src/builder/mergeLayoutHintConfigurations.js"],"sourcesContent":["// @flow\nconst path = require(\"path\");\nconst { readdirSync, statSync, readFileSync, writeFileSync } = require(\"fs\");\n\nconst { LayoutHintConfiguration } = require(\"../constants/LayoutHintConfig\");\n\nconst findFiles = (dir: string): Array<string> => {\n const matchedFiles = [];\n\n const files = readdirSync(dir);\n\n for (const file of files) {\n const absolute = path.join(dir, file);\n if (statSync(absolute).isDirectory()) {\n const foundFiles = findFiles(absolute);\n matchedFiles.push(...foundFiles);\n } else {\n const filename = path.basename(file);\n if (filename === \"LayoutHintConfig.json\") {\n matchedFiles.push(absolute);\n }\n }\n }\n\n return matchedFiles;\n};\n\n/**\n * Merge all LayoutHintConfig.json files from this library and in the srcFolder\n * together into one config file, and copies it to the outputFolder.<br/>\n * This file is consumed by Be Informed studio to give layout hint information\n */\nexports.mergeLayoutHintConfigurations = async (\n srcFolder: string,\n outputFolder: string,\n): Promise<void> => {\n const escapedSrcFolder = srcFolder.replace(/\\\\/g, \"/\");\n\n const files = findFiles(escapedSrcFolder);\n\n const jsons = files.map((file) => {\n const content = readFileSync(file, \"utf-8\");\n return JSON.parse(content);\n });\n\n const newConfig = Object.assign(LayoutHintConfiguration, ...jsons);\n\n writeFileSync(\n path.join(outputFolder, \"LayoutHintConfig.json\"),\n JSON.stringify(newConfig),\n );\n\n return Promise.resolve();\n};\n"],"mappings":";;;;;;;AACA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAM;EAAEC,WAAW;EAAEC,QAAQ;EAAEC,YAAY;EAAEC;AAAc,CAAC,GAAGJ,OAAO,CAAC,IAAI,CAAC;AAE5E,MAAM;EAAEK;AAAwB,CAAC,GAAGL,OAAO,CAAC,+BAA+B,CAAC;AAE5E,MAAMM,SAAS,GAAIC,GAAW,IAAoB;EAChD,MAAMC,YAAY,GAAG,EAAE;EAEvB,MAAMC,KAAK,GAAGR,WAAW,CAACM,GAAG,CAAC;EAE9B,KAAK,MAAMG,IAAI,IAAID,KAAK,EAAE;IACxB,MAAME,QAAQ,GAAGZ,IAAI,CAACa,IAAI,CAACL,GAAG,EAAEG,IAAI,CAAC;IACrC,IAAIR,QAAQ,CAACS,QAAQ,CAAC,CAACE,WAAW,CAAC,CAAC,EAAE;MACpC,MAAMC,UAAU,GAAGR,SAAS,CAACK,QAAQ,CAAC;MACtCH,YAAY,CAACO,IAAI,CAAC,GAAGD,UAAU,CAAC;IAClC,CAAC,MAAM;MACL,MAAME,QAAQ,GAAGjB,IAAI,CAACkB,QAAQ,CAACP,IAAI,CAAC;MACpC,IAAIM,QAAQ,KAAK,uBAAuB,EAAE;QACx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