@beinformed/ui 1.65.23 → 1.65.25
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 +18 -0
- package/esm/builder/mergeLayoutHintConfigurations.js +6 -5
- package/esm/builder/mergeLayoutHintConfigurations.js.flow +11 -5
- package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/esm/constants/Settings.js +4 -1
- package/esm/constants/Settings.js.flow +3 -3
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/__tests__/useAuthentication.spec.js.flow +100 -132
- package/esm/hooks/useAuthentication.js +21 -11
- package/esm/hooks/useAuthentication.js.flow +29 -26
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useModelCatalog.js +1 -1
- package/esm/hooks/useModelCatalog.js.flow +1 -1
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/hooks/useModularUI.js +1 -1
- package/esm/hooks/useModularUI.js.flow +1 -1
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/i18n/Locale.js +3 -1
- package/esm/i18n/Locale.js.flow +2 -2
- package/esm/i18n/Locale.js.map +1 -1
- package/esm/models/actions/ActionCollection.js +1 -1
- package/esm/models/actions/ActionCollection.js.flow +3 -3
- package/esm/models/actions/ActionCollection.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +6 -1
- package/esm/models/application/ApplicationModel.js.flow +7 -2
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +3 -5
- package/esm/models/attributes/ChoiceAttributeModel.js.flow +3 -5
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js.flow +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/NumberAttributeModel.js +3 -1
- package/esm/models/attributes/NumberAttributeModel.js.flow +2 -1
- package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
- package/esm/models/attributes/StringAttributeModel.js +5 -4
- package/esm/models/attributes/StringAttributeModel.js.flow +4 -4
- package/esm/models/attributes/StringAttributeModel.js.map +1 -1
- package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
- package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.flow +1 -1
- package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
- package/esm/models/base/BaseModel.js +6 -5
- package/esm/models/base/BaseModel.js.flow +7 -5
- package/esm/models/base/BaseModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +6 -7
- package/esm/models/base/ResourceModel.js.flow +4 -4
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +16 -16
- package/esm/models/concepts/ConceptDetailModel.js.flow +16 -19
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js.flow +1 -2
- package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +6 -6
- package/esm/models/content/ContentLinkModel.js.flow +6 -6
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/filters/BaseFilterModel.js +3 -5
- package/esm/models/filters/BaseFilterModel.js.flow +4 -5
- package/esm/models/filters/BaseFilterModel.js.map +1 -1
- package/esm/models/filters/StringFilterModel.js +3 -2
- package/esm/models/filters/StringFilterModel.js.flow +2 -2
- package/esm/models/filters/StringFilterModel.js.map +1 -1
- package/esm/models/form/FormModel.js +1 -1
- package/esm/models/form/FormModel.js.flow +1 -2
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +1 -1
- package/esm/models/form/FormObjectModel.js.flow +2 -3
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/href/Href.js +2 -2
- package/esm/models/href/Href.js.flow +2 -2
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/index.js +2 -2
- package/esm/models/index.js.flow +1 -2
- package/esm/models/index.js.map +1 -1
- package/esm/models/links/normalizeLinkJSON.js +1 -1
- package/esm/models/links/normalizeLinkJSON.js.flow +1 -1
- package/esm/models/links/normalizeLinkJSON.js.map +1 -1
- package/esm/modularui/Authenticate.js +7 -2
- package/esm/modularui/Authenticate.js.flow +4 -2
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +2 -5
- package/esm/modularui/ModularUIRequest.js.flow +2 -6
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/UploadRequest.js +3 -1
- package/esm/modularui/UploadRequest.js.flow +3 -1
- package/esm/modularui/UploadRequest.js.map +1 -1
- package/esm/react-client/client.js +22 -10
- package/esm/react-client/client.js.flow +17 -11
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-client/contextPath.js +3 -1
- package/esm/react-client/contextPath.js.flow +2 -1
- package/esm/react-client/contextPath.js.map +1 -1
- package/esm/redux/_i18n/I18nActions.js.flow +1 -1
- package/esm/redux/_i18n/I18nActions.js.map +1 -1
- package/esm/redux/_i18n/I18nReducer.js +1 -4
- package/esm/redux/_i18n/I18nReducer.js.flow +1 -4
- package/esm/redux/_i18n/I18nReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +1 -4
- package/esm/redux/_modularui/ModularUIActions.js.flow +3 -7
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIConnector.js +2 -5
- package/esm/redux/_modularui/ModularUIConnector.js.flow +2 -2
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js +6 -3
- package/esm/redux/_modularui/ModularUIReducer.js.flow +2 -2
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js +12 -18
- package/esm/redux/_modularui/ModularUISelectors.js.flow +13 -14
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js.flow +2 -2
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/redux/actions/Application.js +32 -4
- package/esm/redux/actions/Application.js.flow +34 -5
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/actions/Authorization.js +23 -26
- package/esm/redux/actions/Authorization.js.flow +30 -30
- package/esm/redux/actions/Authorization.js.map +1 -1
- package/esm/redux/actions/Error.js +2 -0
- package/esm/redux/actions/Error.js.flow +5 -4
- package/esm/redux/actions/Error.js.map +1 -1
- package/esm/redux/actions/Form.js.flow +1 -1
- package/esm/redux/actions/Form.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js.flow +1 -1
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/esm/redux/actions/FormAutosave.js.flow +1 -1
- package/esm/redux/actions/FormAutosave.js.map +1 -1
- package/esm/redux/actions/FormAutosubmit.js.flow +1 -1
- package/esm/redux/actions/FormAutosubmit.js.map +1 -1
- package/esm/redux/actions/FormAutoupdate.js.flow +1 -1
- package/esm/redux/actions/FormAutoupdate.js.map +1 -1
- package/esm/redux/actions/FormValidations.js.flow +1 -1
- package/esm/redux/actions/FormValidations.js.map +1 -1
- package/esm/redux/actions/Notification.js.flow +3 -3
- package/esm/redux/actions/Notification.js.map +1 -1
- package/esm/redux/actions/Preferences.js +4 -4
- package/esm/redux/actions/Preferences.js.flow +6 -10
- package/esm/redux/actions/Preferences.js.map +1 -1
- package/esm/redux/actions/SignIn.js +2 -4
- package/esm/redux/actions/SignIn.js.flow +4 -7
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/redux/actions/SignOut.js.flow +1 -1
- package/esm/redux/actions/SignOut.js.map +1 -1
- package/esm/redux/actions/__tests__/Application.spec.js.flow +67 -29
- package/esm/redux/actions/__tests__/Authorization.spec.js.flow +77 -83
- package/esm/redux/connectors/Form.js.flow +2 -2
- package/esm/redux/connectors/Form.js.map +1 -1
- package/esm/redux/connectors/FormAttributeSet.js.flow +2 -5
- package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
- package/esm/redux/connectors/Progress.js.flow +1 -1
- package/esm/redux/connectors/Progress.js.map +1 -1
- package/esm/redux/connectors/SignIn.js.flow +1 -1
- package/esm/redux/connectors/SignIn.js.map +1 -1
- package/esm/redux/connectors/SignOut.js.flow +1 -1
- package/esm/redux/connectors/SignOut.js.map +1 -1
- package/esm/redux/reducers/ModelCatalogReducer.js +7 -9
- package/esm/redux/reducers/ModelCatalogReducer.js.flow +8 -9
- package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/esm/redux/store/configureStore.js +9 -2
- package/esm/redux/store/configureStore.js.flow +13 -2
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/redux/types.js.flow +33 -5
- package/esm/redux/types.js.map +1 -1
- package/esm/utils/browser/Cache.js +3 -1
- package/esm/utils/browser/Cache.js.flow +2 -1
- package/esm/utils/browser/Cache.js.map +1 -1
- package/esm/utils/browser/__tests__/Cookies.spec.js.flow +2 -1
- package/esm/utils/datetime/DateTimeUtil.js +6 -5
- package/esm/utils/datetime/DateTimeUtil.js.flow +5 -11
- package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
- package/esm/utils/datetime/__tests__/DateTimeFormat.spec.js.flow +0 -6
- package/esm/utils/fetch/universalFetch.js +7 -8
- package/esm/utils/fetch/universalFetch.js.flow +13 -14
- package/esm/utils/fetch/universalFetch.js.map +1 -1
- package/esm/utils/fetch/xhr.js +2 -5
- package/esm/utils/fetch/xhr.js.flow +2 -6
- package/esm/utils/fetch/xhr.js.map +1 -1
- package/esm/utils/helpers/createHref.js +2 -1
- package/esm/utils/helpers/createHref.js.flow +1 -1
- package/esm/utils/helpers/createHref.js.map +1 -1
- package/esm/utils/helpers/createUUID.js +2 -1
- package/esm/utils/helpers/createUUID.js.flow +1 -1
- package/esm/utils/helpers/createUUID.js.map +1 -1
- package/esm/utils/number/parseNumbers.js +4 -3
- package/esm/utils/number/parseNumbers.js.flow +3 -3
- package/esm/utils/number/parseNumbers.js.map +1 -1
- package/lib/builder/mergeLayoutHintConfigurations.js +6 -5
- package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
- package/lib/constants/Settings.js +4 -1
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useAuthentication.js +21 -11
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useModelCatalog.js +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModularUI.js +1 -1
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/i18n/Locale.js +3 -1
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/models/actions/ActionCollection.js +1 -1
- package/lib/models/actions/ActionCollection.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +6 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +3 -5
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/NumberAttributeModel.js +3 -1
- package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
- package/lib/models/attributes/StringAttributeModel.js +5 -4
- package/lib/models/attributes/StringAttributeModel.js.map +1 -1
- package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
- package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
- package/lib/models/base/BaseModel.js +6 -5
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +6 -7
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +16 -16
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +6 -6
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js +3 -5
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/filters/StringFilterModel.js +3 -2
- package/lib/models/filters/StringFilterModel.js.map +1 -1
- package/lib/models/form/FormModel.js +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +1 -1
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/href/Href.js +2 -2
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/index.js.map +1 -1
- package/lib/models/links/normalizeLinkJSON.js +1 -1
- package/lib/models/links/normalizeLinkJSON.js.map +1 -1
- package/lib/modularui/Authenticate.js +7 -2
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +2 -5
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/UploadRequest.js +3 -1
- package/lib/modularui/UploadRequest.js.map +1 -1
- package/lib/react-client/client.js +22 -10
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/contextPath.js +4 -1
- package/lib/react-client/contextPath.js.map +1 -1
- package/lib/redux/_i18n/I18nActions.js.map +1 -1
- package/lib/redux/_i18n/I18nReducer.js +1 -4
- package/lib/redux/_i18n/I18nReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +1 -4
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIConnector.js +2 -5
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js +6 -3
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js +12 -18
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/actions/Application.js +33 -4
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/Authorization.js +23 -26
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js +2 -0
- 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/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/FormAutoupdate.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 +4 -4
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/actions/SignIn.js +2 -4
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/SignOut.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/Progress.js.map +1 -1
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/reducers/ModelCatalogReducer.js +7 -9
- package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
- package/lib/redux/store/configureStore.js +9 -2
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/redux/types.js.map +1 -1
- package/lib/utils/browser/Cache.js +3 -1
- package/lib/utils/browser/Cache.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js +6 -5
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js +7 -8
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js +2 -5
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/createHref.js +2 -1
- package/lib/utils/helpers/createHref.js.map +1 -1
- package/lib/utils/helpers/createUUID.js +3 -1
- package/lib/utils/helpers/createUUID.js.map +1 -1
- package/lib/utils/number/parseNumbers.js +4 -3
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +9 -9
|
@@ -3,6 +3,7 @@ import _URLSearchParams from "@babel/runtime-corejs3/core-js-stable/url-search-p
|
|
|
3
3
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
4
4
|
import _keysInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/keys";
|
|
5
5
|
import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
|
|
6
|
+
import _replaceAllInstanceProperty from "@babel/runtime-corejs3/core-js/instance/replace-all";
|
|
6
7
|
import Href from "../../models/href/Href";
|
|
7
8
|
/**
|
|
8
9
|
*/
|
|
@@ -71,7 +72,7 @@ export const createHref = (context, dynamicPart, entryDate, location, allowedPar
|
|
|
71
72
|
if (!_startsWithInstanceProperty(href).call(href, `/${context}/`)) {
|
|
72
73
|
href = `/${context}/${href}`;
|
|
73
74
|
}
|
|
74
|
-
href = href.
|
|
75
|
+
href = _replaceAllInstanceProperty(href).call(href, "//", "/");
|
|
75
76
|
if (location?.search && !_includesInstanceProperty(href).call(href, "?")) {
|
|
76
77
|
var _context;
|
|
77
78
|
const search = _startsWithInstanceProperty(_context = location.search).call(_context, "?") ? location.search.substring(1) : location.search;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHref.js","names":["Href","parseUrl","href","path","querystring","hash","_includesInstanceProperty","call","hashSplit","split","qsSplit","filterParameters","allowedParameters","Array","isArray","url","filteredUrl","searchParams","_URLSearchParams","params","_Array$from","_keysInstanceProperty","param","delete","toString","resourcetype","origin","contextPath","createHref","context","dynamicPart","entryDate","location","_startsWithInstanceProperty","
|
|
1
|
+
{"version":3,"file":"createHref.js","names":["Href","parseUrl","href","path","querystring","hash","_includesInstanceProperty","call","hashSplit","split","qsSplit","filterParameters","allowedParameters","Array","isArray","url","filteredUrl","searchParams","_URLSearchParams","params","_Array$from","_keysInstanceProperty","param","delete","toString","resourcetype","origin","contextPath","createHref","context","dynamicPart","entryDate","location","_startsWithInstanceProperty","_replaceAllInstanceProperty","search","_context","substring","finalHref","setParameter","removeParameter"],"sources":["../../../src/utils/helpers/createHref.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\nimport type { Location } from \"react-router\";\n\n/**\n */\nexport const parseUrl = (\n href: string | Href,\n): { path: string, querystring: null | string, hash: null | string } => {\n if (href instanceof Href) {\n return {\n path: href.path,\n querystring: href.querystring,\n hash: href.hash,\n };\n }\n\n let path = href;\n let hash = null;\n let querystring = null;\n if (href.includes(\"#\")) {\n const hashSplit = href.split(\"#\");\n path = hashSplit[0];\n hash = hashSplit[1];\n }\n if (href.includes(\"?\")) {\n const qsSplit = path.split(\"?\");\n path = qsSplit[0];\n querystring = qsSplit[1];\n }\n return {\n path,\n querystring,\n hash,\n };\n};\n\n/**\n */\nexport const filterParameters = (\n href: string | Href,\n allowedParameters?: Array<string>,\n): Href => {\n if (!Array.isArray(allowedParameters)) {\n return new Href(href);\n }\n\n const url = parseUrl(href);\n let filteredUrl = url.path;\n if (url.querystring) {\n const searchParams = new URLSearchParams(url.querystring);\n const params = Array.from(searchParams.keys());\n for (const param of params) {\n if (!allowedParameters.includes(param)) {\n searchParams.delete(param);\n }\n }\n filteredUrl = filteredUrl + \"?\" + searchParams.toString();\n }\n if (url.hash) {\n filteredUrl = filteredUrl + \"#\" + url.hash;\n }\n\n if (href instanceof Href) {\n return new Href(filteredUrl, href.resourcetype, {\n origin: href.origin,\n contextPath: href.contextPath,\n });\n }\n\n return new Href(filteredUrl);\n};\n\n/**\n */\nexport const createHref = (\n context: string,\n dynamicPart: string | Href,\n entryDate?: ?ISO_DATE,\n location?: ?Location,\n allowedParameters?: Array<string>,\n): Href => {\n let href = dynamicPart.toString();\n\n if (!href.startsWith(`/${context}/`)) {\n href = `/${context}/${href}`;\n }\n\n href = href.replaceAll(\"//\", \"/\");\n\n if (location?.search && !href.includes(\"?\")) {\n const search = location.search.startsWith(\"?\")\n ? location.search.substring(1)\n : location.search;\n href = `${href}?${search}`;\n }\n\n const finalHref =\n dynamicPart instanceof Href\n ? filterParameters(\n new Href(href, dynamicPart.resourcetype, {\n origin: dynamicPart.origin,\n contextPath: dynamicPart.contextPath,\n }),\n allowedParameters,\n )\n : filterParameters(href, allowedParameters);\n\n if (entryDate) {\n finalHref.setParameter(\"entryDate\", entryDate);\n } else {\n finalHref.removeParameter(\"entryDate\");\n }\n\n return finalHref;\n};\n"],"mappings":";;;;;;AACA,OAAOA,IAAI,MAAM,wBAAwB;AAIzC;AACA;AACA,OAAO,MAAMC,QAAQ,GACnBC,IAAmB,IACmD;EACtE,IAAIA,IAAI,YAAYF,IAAI,EAAE;IACxB,OAAO;MACLG,IAAI,EAAED,IAAI,CAACC,IAAI;MACfC,WAAW,EAAEF,IAAI,CAACE,WAAW;MAC7BC,IAAI,EAAEH,IAAI,CAACG;IACb,CAAC;EACH;EAEA,IAAIF,IAAI,GAAGD,IAAI;EACf,IAAIG,IAAI,GAAG,IAAI;EACf,IAAID,WAAW,GAAG,IAAI;EACtB,IAAIE,yBAAA,CAAAJ,IAAI,EAAAK,IAAA,CAAJL,IAAI,EAAU,GAAG,CAAC,EAAE;IACtB,MAAMM,SAAS,GAAGN,IAAI,CAACO,KAAK,CAAC,GAAG,CAAC;IACjCN,IAAI,GAAGK,SAAS,CAAC,CAAC,CAAC;IACnBH,IAAI,GAAGG,SAAS,CAAC,CAAC,CAAC;EACrB;EACA,IAAIF,yBAAA,CAAAJ,IAAI,EAAAK,IAAA,CAAJL,IAAI,EAAU,GAAG,CAAC,EAAE;IACtB,MAAMQ,OAAO,GAAGP,IAAI,CAACM,KAAK,CAAC,GAAG,CAAC;IAC/BN,IAAI,GAAGO,OAAO,CAAC,CAAC,CAAC;IACjBN,WAAW,GAAGM,OAAO,CAAC,CAAC,CAAC;EAC1B;EACA,OAAO;IACLP,IAAI;IACJC,WAAW;IACXC;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMM,gBAAgB,GAAGA,CAC9BT,IA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
|
|
1
|
+
import _Math$trunc from "@babel/runtime-corejs3/core-js-stable/math/trunc";
|
|
1
2
|
/**
|
|
2
3
|
*/
|
|
3
4
|
const createUUID = () => {
|
|
4
5
|
let d = new Date().getTime();
|
|
5
6
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
|
|
6
|
-
const r = (d + Math.random() * 16) % 16
|
|
7
|
+
const r = _Math$trunc((d + Math.random() * 16) % 16);
|
|
7
8
|
d = Math.floor(d / 16);
|
|
8
9
|
return (c === "x" ? r : r & 0x3 | 0x8).toString(16);
|
|
9
10
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const createUUID = (): string => {
|
|
5
5
|
let d = new Date().getTime();
|
|
6
6
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
7
|
-
const r = ((d + Math.random() * 16) % 16)
|
|
7
|
+
const r = Math.trunc((d + Math.random() * 16) % 16);
|
|
8
8
|
d = Math.floor(d / 16);
|
|
9
9
|
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
|
|
10
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createUUID.js","names":["createUUID","d","Date","getTime","replace","c","r","Math","random","floor","toString"],"sources":["../../../src/utils/helpers/createUUID.js"],"sourcesContent":["// @flow\n/**\n */\nconst createUUID = (): string => {\n let d = new Date().getTime();\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = ((d + Math.random() * 16) % 16)
|
|
1
|
+
{"version":3,"file":"createUUID.js","names":["createUUID","d","Date","getTime","replace","c","r","_Math$trunc","Math","random","floor","toString"],"sources":["../../../src/utils/helpers/createUUID.js"],"sourcesContent":["// @flow\n/**\n */\nconst createUUID = (): string => {\n let d = new Date().getTime();\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = Math.trunc((d + Math.random() * 16) % 16);\n d = Math.floor(d / 16);\n return (c === \"x\" ? r : (r & 0x3) | 0x8).toString(16);\n });\n};\n\nexport default createUUID;\n"],"mappings":";AACA;AACA;AACA,MAAMA,UAAU,GAAGA,CAAA,KAAc;EAC/B,IAAIC,CAAC,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;EAC5B,OAAO,sCAAsC,CAACC,OAAO,CAAC,OAAO,EAAGC,CAAC,IAAK;IACpE,MAAMC,CAAC,GAAGC,WAAA,CAAW,CAACN,CAAC,GAAGO,IAAI,CAACC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IACnDR,CAAC,GAAGO,IAAI,CAACE,KAAK,CAACT,CAAC,GAAG,EAAE,CAAC;IACtB,OAAO,CAACI,CAAC,KAAK,GAAG,GAAGC,CAAC,GAAIA,CAAC,GAAG,GAAG,GAAI,GAAG,EAAEK,QAAQ,CAAC,EAAE,CAAC;EACvD,CAAC,CAAC;AACJ,CAAC;AAED,eAAeX,UAAU","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _String$raw from "@babel/runtime-corejs3/core-js-stable/string/raw";
|
|
1
2
|
import big from "big.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -5,12 +6,12 @@ import big from "big.js";
|
|
|
5
6
|
*/
|
|
6
7
|
const removeGroupingSeparator = (input, groupingSeparator) => {
|
|
7
8
|
if (typeof input === "number") {
|
|
8
|
-
return input;
|
|
9
|
+
return input.toString();
|
|
9
10
|
}
|
|
10
11
|
if (groupingSeparator == null) {
|
|
11
12
|
return input;
|
|
12
13
|
}
|
|
13
|
-
const escapedGroupingSeparator = groupingSeparator.replace(/[$()*+.?[\\\]^{|}]/g,
|
|
14
|
+
const escapedGroupingSeparator = groupingSeparator.replace(/[$()*+.?[\\\]^{|}]/g, _String$raw`\$&`);
|
|
14
15
|
return input.replace(new RegExp(escapedGroupingSeparator, "g"), "");
|
|
15
16
|
};
|
|
16
17
|
|
|
@@ -19,7 +20,7 @@ const removeGroupingSeparator = (input, groupingSeparator) => {
|
|
|
19
20
|
*/
|
|
20
21
|
const updateDecimalSeparator = (input, decimalSeparator) => {
|
|
21
22
|
if (typeof input === "number") {
|
|
22
|
-
return input;
|
|
23
|
+
return input.toString();
|
|
23
24
|
}
|
|
24
25
|
if (decimalSeparator == null || decimalSeparator === "") {
|
|
25
26
|
return input;
|
|
@@ -9,7 +9,7 @@ const removeGroupingSeparator = (
|
|
|
9
9
|
groupingSeparator?: ?string,
|
|
10
10
|
) => {
|
|
11
11
|
if (typeof input === "number") {
|
|
12
|
-
return input;
|
|
12
|
+
return input.toString();
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
if (groupingSeparator == null) {
|
|
@@ -18,7 +18,7 @@ const removeGroupingSeparator = (
|
|
|
18
18
|
|
|
19
19
|
const escapedGroupingSeparator = groupingSeparator.replace(
|
|
20
20
|
/[$()*+.?[\\\]^{|}]/g,
|
|
21
|
-
|
|
21
|
+
String.raw`\$&`,
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
return input.replace(new RegExp(escapedGroupingSeparator, "g"), "");
|
|
@@ -32,7 +32,7 @@ const updateDecimalSeparator = (
|
|
|
32
32
|
decimalSeparator?: ?string,
|
|
33
33
|
) => {
|
|
34
34
|
if (typeof input === "number") {
|
|
35
|
-
return input;
|
|
35
|
+
return input.toString();
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (decimalSeparator == null || decimalSeparator === "") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseNumbers.js","names":["big","removeGroupingSeparator","input","groupingSeparator","escapedGroupingSeparator","replace","RegExp","updateDecimalSeparator","decimalSeparator","parseToNumber","NaN","inputNoGrouping","inputCorrectDecimalSeparator","Number","parseNumberToString","toFixed","error"],"sources":["../../../src/utils/number/parseNumbers.js"],"sourcesContent":["// @flow\nimport big from \"big.js\";\n\n/**\n * @private\n */\nconst removeGroupingSeparator = (\n input: string | number,\n groupingSeparator?: ?string,\n) => {\n if (typeof input === \"number\") {\n return input;\n }\n\n if (groupingSeparator == null) {\n return input;\n }\n\n const escapedGroupingSeparator = groupingSeparator.replace(\n /[$()*+.?[\\\\\\]^{|}]/g,\n
|
|
1
|
+
{"version":3,"file":"parseNumbers.js","names":["big","removeGroupingSeparator","input","groupingSeparator","toString","escapedGroupingSeparator","replace","_String$raw","RegExp","updateDecimalSeparator","decimalSeparator","parseToNumber","NaN","inputNoGrouping","inputCorrectDecimalSeparator","Number","parseNumberToString","toFixed","error"],"sources":["../../../src/utils/number/parseNumbers.js"],"sourcesContent":["// @flow\nimport big from \"big.js\";\n\n/**\n * @private\n */\nconst removeGroupingSeparator = (\n input: string | number,\n groupingSeparator?: ?string,\n) => {\n if (typeof input === \"number\") {\n return input.toString();\n }\n\n if (groupingSeparator == null) {\n return input;\n }\n\n const escapedGroupingSeparator = groupingSeparator.replace(\n /[$()*+.?[\\\\\\]^{|}]/g,\n String.raw`\\$&`,\n );\n\n return input.replace(new RegExp(escapedGroupingSeparator, \"g\"), \"\");\n};\n\n/**\n * @private\n */\nconst updateDecimalSeparator = (\n input: string | number,\n decimalSeparator?: ?string,\n) => {\n if (typeof input === \"number\") {\n return input.toString();\n }\n\n if (decimalSeparator == null || decimalSeparator === \"\") {\n return input;\n }\n\n return input.replace(decimalSeparator, \".\");\n};\n\n/**\n * Parses input into a number, removes the grouping separator from the input and\n * replaces the decimal separator with a dot to make it a JavaScript parseable number\n */\nconst parseToNumber = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\",\n): number => {\n if (input == null || input === \"\") {\n return NaN;\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator,\n );\n\n return Number(inputCorrectDecimalSeparator);\n};\n\n/**\n * parses Numbers To String\n */\nconst parseNumberToString = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\",\n): string => {\n if (input == null || input === \"\") {\n return \"NaN\";\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator,\n );\n\n try {\n return big(inputCorrectDecimalSeparator).toFixed();\n } catch (error) {\n return \"NaN\";\n }\n};\n\nexport { parseToNumber, parseNumberToString };\n"],"mappings":";AACA,OAAOA,GAAG,MAAM,QAAQ;;AAExB;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGA,CAC9BC,KAAsB,EACtBC,iBAA2B,KACxB;EACH,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK,CAACE,QAAQ,CAAC,CAAC;EACzB;EAEA,IAAID,iBAAiB,IAAI,IAAI,EAAE;IAC7B,OAAOD,KAAK;EACd;EAEA,MAAMG,wBAAwB,GAAGF,iBAAiB,CAACG,OAAO,CACxD,qBAAqB,EACrBC,WAAU,KACZ,CAAC;EAED,OAAOL,KAAK,CAACI,OAAO,CAAC,IAAIE,MAAM,CAACH,wBAAwB,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;AACrE,CAAC;;AAED;AACA;AACA;AACA,MAAMI,sBAAsB,GAAGA,CAC7BP,KAAsB,EACtBQ,gBAA0B,KACvB;EACH,IAAI,OAAOR,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK,CAACE,QAAQ,CAAC,CAAC;EACzB;EAEA,IAAIM,gBAAgB,IAAI,IAAI,IAAIA,gBAAgB,KAAK,EAAE,EAAE;IACvD,OAAOR,KAAK;EACd;EAEA,OAAOA,KAAK,CAACI,OAAO,CAACI,gBAAgB,EAAE,GAAG,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAGA,CACpBT,KAAwB,EACxBC,iBAA0B,GAAG,GAAG,EAChCO,gBAAyB,GAAG,GAAG,KACpB;EACX,IAAIR,KAAK,IAAI,IAAI,IAAIA,KAAK,KAAK,EAAE,EAAE;IACjC,OAAOU,GAAG;EACZ;EAEA,MAAMC,eAAe,GAAGZ,uBAAuB,CAACC,KAAK,EAAEC,iBAAiB,CAAC;EAEzE,MAAMW,4BAA4B,GAAGL,sBAAsB,CACzDI,eAAe,EACfH,gBACF,CAAC;EAED,OAAOK,MAAM,CAACD,4BAA4B,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA,MAAME,mBAAmB,GAAGA,CAC1Bd,KAAwB,EACxBC,iBAA0B,GAAG,GAAG,EAChCO,gBAAyB,GAAG,GAAG,KACpB;EACX,IAAIR,KAAK,IAAI,IAAI,IAAIA,KAAK,KAAK,EAAE,EAAE;IACjC,OAAO,KAAK;EACd;EAEA,MAAMW,eAAe,GAAGZ,uBAAuB,CAACC,KAAK,EAAEC,iBAAiB,CAAC;EAEzE,MAAMW,4BAA4B,GAAGL,sBAAsB,CACzDI,eAAe,EACfH,gBACF,CAAC;EAED,IAAI;IACF,OAAOV,GAAG,CAACc,4BAA4B,CAAC,CAACG,OAAO,CAAC,CAAC;EACpD,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,OAAO,KAAK;EACd;AACF,CAAC;AAED,SAASP,aAAa,EAAEK,mBAAmB","ignoreList":[]}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
var _replaceAll = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/replace-all"));
|
|
4
5
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
5
6
|
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
6
7
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
7
|
-
|
|
8
|
-
const path = require("path");
|
|
8
|
+
// $FlowIssue
|
|
9
|
+
const path = require("node:path");
|
|
9
10
|
const {
|
|
10
11
|
readdirSync,
|
|
11
12
|
statSync,
|
|
12
13
|
readFileSync,
|
|
13
14
|
writeFileSync
|
|
14
|
-
|
|
15
|
+
// $FlowIssue
|
|
16
|
+
} = require("node:fs");
|
|
15
17
|
const mergeWith = require("lodash/mergeWith");
|
|
16
18
|
const {
|
|
17
19
|
LayoutHintConfiguration
|
|
@@ -40,7 +42,7 @@ const findFiles = dir => {
|
|
|
40
42
|
* This file is consumed by Be Informed studio to give layout hint information
|
|
41
43
|
*/
|
|
42
44
|
exports.mergeLayoutHintConfigurations = async (srcFolder, outputFolder) => {
|
|
43
|
-
const escapedSrcFolder = srcFolder.
|
|
45
|
+
const escapedSrcFolder = (0, _replaceAll.default)(srcFolder).call(srcFolder, "\\", "/");
|
|
44
46
|
const files = findFiles(escapedSrcFolder);
|
|
45
47
|
const jsons = (0, _map.default)(files).call(files, file => {
|
|
46
48
|
const content = readFileSync(file, "utf-8");
|
|
@@ -55,6 +57,5 @@ exports.mergeLayoutHintConfigurations = async (srcFolder, outputFolder) => {
|
|
|
55
57
|
};
|
|
56
58
|
const newConfig = mergeWith(LayoutHintConfiguration, ...jsons, customizer);
|
|
57
59
|
writeFileSync(path.join(outputFolder, "LayoutHintConfig.json"), (0, _stringify.default)(newConfig));
|
|
58
|
-
return _promise.default.resolve();
|
|
59
60
|
};
|
|
60
61
|
//# sourceMappingURL=mergeLayoutHintConfigurations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["path","require","readdirSync","statSync","readFileSync","writeFileSync","mergeWith","LayoutHintConfiguration","findFiles","dir","matchedFiles","files","file","absolute","join","isDirectory","foundFiles","push","filename","basename","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","
|
|
1
|
+
{"version":3,"file":"mergeLayoutHintConfigurations.js","names":["path","require","readdirSync","statSync","readFileSync","writeFileSync","mergeWith","LayoutHintConfiguration","findFiles","dir","matchedFiles","files","file","absolute","join","isDirectory","foundFiles","push","filename","basename","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","_replaceAll","default","call","jsons","_map","content","JSON","parse","customizer","objValue","srcValue","Array","isArray","_set","newConfig","_stringify"],"sources":["../../src/builder/mergeLayoutHintConfigurations.js"],"sourcesContent":["// @flow\n\n// $FlowIssue\nconst path = require(\"node:path\");\nconst {\n readdirSync,\n statSync,\n readFileSync,\n writeFileSync,\n // $FlowIssue\n} = require(\"node:fs\");\n\nconst mergeWith = require(\"lodash/mergeWith\");\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.replaceAll(\"\\\\\", \"/\");\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 // Function to merge arrays during merging\n const customizer = (objValue: Object, srcValue: Object): Object => {\n if (Array.isArray(objValue)) {\n return [...new Set([...objValue, ...srcValue])];\n }\n };\n\n const newConfig = mergeWith(LayoutHintConfiguration, ...jsons, customizer);\n\n writeFileSync(\n path.join(outputFolder, \"LayoutHintConf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AC;EAEzC,MAAMI,KAAK,GAAG,IAAAC,IAAA,CAAAH,OAAA,EAAAf,KAAK,EAAAgB,IAAA,CAALhB,KAAK,EAAMC,IAAI,IAAK;IAChC,MAAMkB,OAAO,GAAG1B,YAAY,CAACQ,IAAI,EAAE,OAAO,CAAC;IAC3C,OAAOmB,IAAI,CAACC,KAAK,CAACF,OAAO,CAAC;EAC5B,CAAC,CAAC;;EAEF;EACA,MAAMG,UAAU,GAAGA,CAACC,QAAgB,EAAEC,QAAgB,KAAa;IACjE,IAAIC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,EAAE;MAC3B,OAAO,CAAC,GAAG,IAAAI,IAAA,CAAAZ,OAAA,CAAQ,CAAC,GAAGQ,QAAQ,EAAE,GAAGC,QAAQ,CAAC,CAAC,CAAC;IACjD;EACF,CAAC;EAED,MAAMI,SAAS,GAAGjC,SAAS,CAACC,uBAAuB,EAAE,GAAGqB,KAAK,EAAEK,UAAU,CAAC;EAE1E5B,aAAa,CACXL,IAAI,CAACc,IAAI,CAACS,YAAY,EAAE,uBAAuB,CAAC,EAChD,IAAAiB,UAAA,CAAAd,OAAA,EAAea,SAAS,CAC1B,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.setSettings = exports.setSetting = exports.setContextPath = exports.logoutPath = exports.loginUsernameField = exports.loginType = exports.loginPath = exports.loginPasswordField = exports.isIncludeTimeOffsetInDateTimes = exports.hasAllContentInData = exports.getUploadPath = exports.getSwimLaneDiagramConfiguration = exports.getSetting = exports.getEnabledLocales = exports.getCaptchaPath = exports.getBasePathServer = exports.getBasePathModularUI = exports.getBasePath = exports.cacheContributions = exports.allSettings = exports.LOGOUT_PATH = exports.LOGIN_PATH = exports.BASE = void 0;
|
|
8
|
+
var _globalThis2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/global-this"));
|
|
8
9
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
9
10
|
var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
|
|
10
11
|
var _objects = require("../utils/helpers/objects");
|
|
@@ -13,7 +14,9 @@ var _Constants = require("./Constants");
|
|
|
13
14
|
const serverBase = typeof __CONTEXT_PATH__ === "undefined" ? null : __CONTEXT_PATH__;
|
|
14
15
|
const defaultSettings = {
|
|
15
16
|
// This uses contextPath set from property from server
|
|
16
|
-
CONTEXT_PATH: serverBase ??
|
|
17
|
+
CONTEXT_PATH: serverBase ??
|
|
18
|
+
// $FlowIssue
|
|
19
|
+
_globalThis2.default?.contextPath ?? "/BeInformed",
|
|
17
20
|
// Indicates if contributions should be cached
|
|
18
21
|
CACHE_CONTRIBUTIONS: true,
|
|
19
22
|
// Debug missing i18n messages in layout
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","names":["_objects","require","_repositoryResource","_Constants","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","isPlainObject","_assign","default","exports","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","UPLOAD_PATH","getCaptchaPath","CAPTCHA_PATH","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","isIncludeTimeOffsetInDateTimes","INCLUDE_TIME_OFFSET","getEnabledLocales","loginType","LOGIN_TYPE","INTERNAL_LOGIN_TYPE","JAAS","loginPath","clientName","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING","getSwimLaneDiagramConfiguration","configLocation","_startsWith","call","getRepositoryResourceUrl","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually overriden by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type\n */\nexport const loginType = (): string | Array<string> =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAeA,MAAMG,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;EAEpB;EACAC,mBAAmB,EAAE,IAAI;EAEzB;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK;EAEzB;EACAC,sBAAsB,EAAE,IAAI;EAE5B;EACAC,qCAAqC,EAAE,IAAI;EAE3C;EACAC,oCAAoC,EAAE,KAAK;EAE3C;EACAC,oBAAoB,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;EAE/C;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,6BAA6B,EAAE,IAAI;EAEnC;EACAC,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;EAE7B;EACAC,wBAAwB,EAAE,KAAK;EAE/B;EACAC,yBAAyB,EAAE,KAA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AS,CAAC;AAACpC,OAAA,CAAAmC,UAAA,GAAAA,UAAA;AAEtC,MAAM7D,UAAkB,GAAA0B,OAAA,CAAA1B,UAAA,GAAGsD,SAAS,CAAC,CAAC;AACtC,MAAMpD,WAAmB,GAAAwB,OAAA,CAAAxB,WAAA,GAAG2D,UAAU,CAAC,CAAC;;AAE/C;AACA;AACA;AACO,MAAME,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAGrC,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC,IAAAsC,WAAA,CAAAxC,OAAA,EAAAuC,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAO,IAAAG,4CAAwB,EAACH,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AAFAtC,OAAA,CAAAqC,+BAAA,GAAAA,+BAAA;AAGO,MAAMK,cAAc,GAAInF,WAAmB,IAAK;EACrDgD,UAAU,CAAC,cAAc,EAAEhD,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFAyC,OAAA,CAAA0C,cAAA,GAAAA,cAAA;AAGO,MAAMC,IAAY,GAAA3C,OAAA,CAAA2C,IAAA,GAAGhC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Settings.js","names":["_objects","require","_repositoryResource","_Constants","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","_globalThis2","default","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","isPlainObject","_assign","exports","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","UPLOAD_PATH","getCaptchaPath","CAPTCHA_PATH","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","isIncludeTimeOffsetInDateTimes","INCLUDE_TIME_OFFSET","getEnabledLocales","loginType","LOGIN_TYPE","INTERNAL_LOGIN_TYPE","JAAS","loginPath","clientName","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING","getSwimLaneDiagramConfiguration","configLocation","_startsWith","call","getRepositoryResourceUrl","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n // $FlowIssue\n globalThis?.contextPath ??\n \"/BeInformed\",\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually overriden by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type\n */\nexport const loginType = (): string | Array<string> =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAeA,MAAMG,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU;EACV;EACAI,YAAA,CAAAC,OAAA,EAAYC,WAAW,IACvB,aAAa;EAEf;EACAC,mBAAmB,EAAE,IAAI;EAEzB;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK;EAEzB;EACAC,sBAAsB,EAAE,IAAI;EAE5B;EACAC,qCAAqC,EAAE,IAAI;EAE3C;EACAC,oCAAoC,EAAE,KAAK;EAE3C;EACAC,oBAAoB,EAA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AAAA,kBAAA;AAEO,MAAME,kBAAkB,GAAGA,CAAA,KAChChC,UAAU,CAACiC,iCAAsB,EAAE,YAAY,CAAC;AAClD;AACA;AADAlC,OAAA,CAAAiC,kBAAA,GAAAA,kBAAA;AAEO,MAAME,UAAU,GAAGA,CAAA,KACxBlC,UAAU,CAACmC,8BAAmB,EAAE,SAAS,CAAC;AAACpC,OAAA,CAAAmC,UAAA,GAAAA,UAAA;AAEtC,MAAM5D,UAAkB,GAAAyB,OAAA,CAAAzB,UAAA,GAAGqD,SAAS,CAAC,CAAC;AACtC,MAAMnD,WAAmB,GAAAuB,OAAA,CAAAvB,WAAA,GAAG0D,UAAU,CAAC,CAAC;;AAE/C;AACA;AACA;AACO,MAAME,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAGrC,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC,IAAAsC,WAAA,CAAAhF,OAAA,EAAA+E,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAO,IAAAG,4CAAwB,EAACH,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AAFAtC,OAAA,CAAAqC,+BAAA,GAAAA,+BAAA;AAGO,MAAMK,cAAc,GAAIlF,WAAmB,IAAK;EACrD+C,UAAU,CAAC,cAAc,EAAE/C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFAwC,OAAA,CAAA0C,cAAA,GAAAA,cAAA;AAGO,MAAMC,IAAY,GAAA3C,OAAA,CAAA2C,IAAA,GAAGhC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useLogout = exports.useLogin = void 0;
|
|
8
|
+
var _globalThis2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/global-this"));
|
|
8
9
|
var _reactRedux = require("react-redux");
|
|
9
10
|
var _actions = require("../redux/actions");
|
|
10
11
|
var _Cache = _interopRequireDefault(require("../utils/browser/Cache"));
|
|
@@ -13,6 +14,7 @@ var _exceptions = require("../exceptions");
|
|
|
13
14
|
var _modularui = require("../modularui");
|
|
14
15
|
var _useModularUIModel = require("./useModularUIModel");
|
|
15
16
|
/**
|
|
17
|
+
* Hook for handling login logic
|
|
16
18
|
*/
|
|
17
19
|
const useLogin = () => {
|
|
18
20
|
_Cache.default.setItem("isRedirectLogin", false);
|
|
@@ -20,28 +22,30 @@ const useLogin = () => {
|
|
|
20
22
|
const application = (0, _useModularUIModel.useApplication)();
|
|
21
23
|
const auth = (0, _reactRedux.useSelector)(state => state.auth);
|
|
22
24
|
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
23
|
-
const
|
|
25
|
+
const cachedType = _Cache.default.getItem("primaryAuthenticationType");
|
|
24
26
|
return {
|
|
25
27
|
isAuthenticated,
|
|
26
|
-
|
|
28
|
+
// Safely fallback to the first available type if nothing is cached
|
|
29
|
+
primaryAuthenticationType: cachedType ?? application?.authenticationTypes?.[0],
|
|
27
30
|
authenticationTypes: application?.authenticationTypes ?? [],
|
|
28
31
|
errorMessage: auth.error,
|
|
29
32
|
resetErrors: () => dispatch((0, _actions.resetAuthErrors)()),
|
|
30
33
|
login: (username, password) => dispatch((0, _actions.login)(username, password)),
|
|
31
34
|
redirectLogin: authenticationType => {
|
|
32
35
|
if (_Cache.default.getItem("isRedirectLogin")) {
|
|
33
|
-
// prevent endless loop in redirects when authentication type can't be redirected
|
|
34
36
|
throw new _exceptions.IllegalStateException(`Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri ?? ""}'`);
|
|
35
37
|
}
|
|
36
38
|
if (!isAuthenticated) {
|
|
37
39
|
_Cache.default.setItem("isRedirectLogin", true);
|
|
38
|
-
|
|
40
|
+
// $FlowIssue
|
|
41
|
+
_globalThis2.default.location.assign(`${(0, _constants.getBasePathServer)()}${authenticationType.redirectUri ?? ""}`);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
};
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
/**
|
|
48
|
+
* Hook for handling logout logic
|
|
45
49
|
*/
|
|
46
50
|
exports.useLogin = useLogin;
|
|
47
51
|
const useLogout = () => {
|
|
@@ -49,24 +53,30 @@ const useLogout = () => {
|
|
|
49
53
|
const application = (0, _useModularUIModel.useApplication)();
|
|
50
54
|
const BASE_PATH = (0, _constants.getBasePath)();
|
|
51
55
|
const authenticate = new _modularui.Authenticate();
|
|
52
|
-
const primaryAuthenticationType = _Cache.default.getItem("primaryAuthenticationType");
|
|
53
56
|
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
57
|
+
const cachedType = _Cache.default.getItem("primaryAuthenticationType");
|
|
54
58
|
return {
|
|
55
59
|
isAuthenticated,
|
|
56
|
-
primaryAuthenticationType:
|
|
60
|
+
primaryAuthenticationType: cachedType ?? application?.authenticationTypes?.[0],
|
|
57
61
|
authenticationTypes: application?.authenticationTypes ?? [],
|
|
58
62
|
logout: () => {
|
|
59
63
|
const type = authenticate.authenticationType;
|
|
60
64
|
if (type === _constants.INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT) {
|
|
61
65
|
authenticate.redirectToLogout();
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
return; // Redirects stop execution
|
|
67
|
+
}
|
|
68
|
+
if (_Cache.default.getItem("isRedirectLogin")) {
|
|
69
|
+
// $FlowIssue
|
|
70
|
+
const origin = _globalThis2.default.location.origin;
|
|
64
71
|
const url = `${authenticate.getLogoutUrl()}?url=${origin}${BASE_PATH}`;
|
|
65
72
|
_Cache.default.setItem("isRedirectLogin", false);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return
|
|
73
|
+
// $FlowIssue
|
|
74
|
+
_globalThis2.default.location.assign(url);
|
|
75
|
+
return;
|
|
69
76
|
}
|
|
77
|
+
|
|
78
|
+
// Returns the Promise from the logout thunk
|
|
79
|
+
return dispatch((0, _actions.logout)());
|
|
70
80
|
},
|
|
71
81
|
logoutUrl: authenticate.getLogoutUrl()
|
|
72
82
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthentication.js","names":["_reactRedux","require","_actions","_Cache","_interopRequireDefault","_constants","_exceptions","_modularui","_useModularUIModel","useLogin","Cache","setItem","dispatch","useDispatch","application","useApplication","auth","useSelector","state","isAuthenticated","isLoggedIn","
|
|
1
|
+
{"version":3,"file":"useAuthentication.js","names":["_reactRedux","require","_actions","_Cache","_interopRequireDefault","_constants","_exceptions","_modularui","_useModularUIModel","useLogin","Cache","setItem","dispatch","useDispatch","application","useApplication","auth","useSelector","state","isAuthenticated","isLoggedIn","cachedType","getItem","primaryAuthenticationType","authenticationTypes","errorMessage","error","resetErrors","resetAuthErrors","login","username","password","redirectLogin","authenticationType","IllegalStateException","authentication","redirectUri","_globalThis2","default","location","assign","getBasePathServer","exports","useLogout","BASE_PATH","getBasePath","authenticate","Authenticate","logout","type","INTERNAL_LOGIN_TYPE","PAC4J_INDIRECT","redirectToLogout","origin","url","getLogoutUrl","logoutUrl"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\nimport Cache from \"../utils/browser/Cache\";\nimport {\n getBasePath,\n getBasePathServer,\n INTERNAL_LOGIN_TYPE,\n} from \"../constants\";\nimport { IllegalStateException } from \"../exceptions\";\nimport { Authenticate } from \"../modularui\";\nimport { useApplication } from \"./useModularUIModel\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\n\ntype LoginHook = {\n isAuthenticated: boolean,\n primaryAuthenticationType: ?AuthenticationType,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => any, // Changed to any for Promise support\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\n\ntype LogoutHook = {\n isAuthenticated: boolean,\n primaryAuthenticationType: ?AuthenticationType,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => any, // Changed to any for Promise support\n logoutUrl: string,\n};\n\n/**\n * Hook for handling login logic\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n const application = useApplication();\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n const cachedType = Cache.getItem(\"primaryAuthenticationType\");\n\n return {\n isAuthenticated,\n // Safely fallback to the first available type if nothing is cached\n primaryAuthenticationType:\n cachedType ?? application?.authenticationTypes?.[0],\n authenticationTypes: application?.authenticationTypes ?? [],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n throw new IllegalStateException(\n `Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n // $FlowIssue\n globalThis.location.assign(\n `${getBasePathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n * Hook for handling logout logic\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useApplication();\n const BASE_PATH = getBasePath();\n const authenticate = new Authenticate();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n const cachedType = Cache.getItem(\"primaryAuthenticationType\");\n\n return {\n isAuthenticated,\n primaryAuthenticationType:\n cachedType ?? application?.authenticationTypes?.[0],\n authenticationTypes: application?.authenticationTypes ?? [],\n logout: () => {\n const type = authenticate.authenticationType;\n\n if (type === INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT) {\n authenticate.redirectToLogout();\n return; // Redirects stop execution\n }\n\n if (Cache.getItem(\"isRedirectLogin\")) {\n // $FlowIssue\n const origin = globalThis.location.origin;\n const url = `${authenticate.getLogoutUrl()}?url=${origin}${BASE_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n // $FlowIssue\n globalThis.location.assign(url);\n return;\n }\n\n // Returns the Promise from the logout thunk\n return dispatch(logout());\n },\n logoutUrl: authenticate.getLogoutUrl(),\n };\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AAuBA;AACA;AACA;AACO,MAAMQ,QAAQ,GAAGA,CAAA,KAAiB;EACvCC,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAMC,WAAW,GAAG,IAAAC,iCAAc,EAAC,CAAC;EACpC,MAAMC,IAAI,GAAG,IAAAC,uBAAW,EAAEC,KAAK,IAAKA,KAAK,CAACF,IAAI,CAAC;EAE/C,MAAMG,eAAe,GAAGL,WAAW,EAAEM,UAAU,IAAI,KAAK;EACxD,MAAMC,UAAU,GAAGX,cAAK,CAACY,OAAO,CAAC,2BAA2B,CAAC;EAE7D,OAAO;IACLH,eAAe;IACf;IACAI,yBAAyB,EACvBF,UAAU,IAAIP,WAAW,EAAEU,mBAAmB,GAAG,CAAC,CAAC;IACrDA,mBAAmB,EAAEV,WAAW,EAAEU,mBAAmB,IAAI,EAAE;IAC3DC,YAAY,EAAET,IAAI,CAACU,KAAK;IACxBC,WAAW,EAAEA,CAAA,KAAMf,QAAQ,CAAC,IAAAgB,wBAAe,E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,MAAM,EAAEA,CAAA,KAAM;MACZ,MAAMC,IAAI,GAAGH,YAAY,CAACb,kBAAkB;MAE5C,IAAIgB,IAAI,KAAKC,8BAAmB,CAACC,cAAc,EAAE;QAC/CL,YAAY,CAACM,gBAAgB,CAAC,CAAC;QAC/B,OAAO,CAAC;MACV;MAEA,IAAI1C,cAAK,CAACY,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC;QACA,MAAM+B,MAAM,GAAGhB,YAAA,CAAAC,OAAA,CAAWC,QAAQ,CAACc,MAAM;QACzC,MAAMC,GAAG,GAAG,GAAGR,YAAY,CAACS,YAAY,CAAC,CAAC,QAAQF,MAAM,GAAGT,SAAS,EAAE;QACtElC,cAAK,CAACC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;QACvC;QACA0B,YAAA,CAAAC,OAAA,CAAWC,QAAQ,CAACC,MAAM,CAACc,GAAG,CAAC;QAC/B;MACF;;MAEA;MACA,OAAO1C,QAAQ,CAAC,IAAAoC,eAAM,EAAC,CAAC,CAAC;IAC3B,CAAC;IACDQ,SAAS,EAAEV,YAAY,CAACS,YAAY,CAAC;EACvC,CAAC;AACH,CAAC;AAACb,OAAA,CAAAC,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -175,7 +175,7 @@ const useEntryDate = () => {
|
|
|
175
175
|
const entryDate = (0, _reactRedux.useSelector)(_modelcatalog.getEntryDate);
|
|
176
176
|
return {
|
|
177
177
|
entryDate,
|
|
178
|
-
setEntryDate:
|
|
178
|
+
setEntryDate: date => dispatch((0, _ModelCatalog.updateEntryDate)(date))
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
181
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelCatalog.js","names":["_reactRedux","require","_useRouter","_createHref","_ModelCatalogModel","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","_modelcatalog","_ModelCatalog","_Href","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","entryDate","useEntryDate","url","filterParameters","setParameter","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","useCompleteSource","contentHref","Href","removeParameter","addParameter","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","filterValue","value","Array","isArray","join","replace","push","length","useConceptSearch","useContentSearch","dispatch","useDispatch","useSelector","getEntryDate","setEntryDate","updateEntryDate","useRelatedConcepts"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n\n/**\n */\nexport const useRelatedConcepts = (\n href: string | Href,\n key?: string = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,mBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,sBAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,kBAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AACA,IAAAS,gBAAA,GAAAL,sBAAA,CAAAJ,OAAA;AACA,IAAAU,aAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAEA,IAAAW,kBAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAEA,IAAAa,aAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAEA,IAAAe,KAAA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","_interopRequireDefault","_ConceptIndexModel","_ConceptDetailModel","_BusinessScenarioModel","_ContentIndexModel","_ContentTOCModel","_ContentModel","_useModularUIBasic","_models","_modelcatalog","_ModelCatalog","_Href","useModelCatalog","options","useModularUIBasic","expectedModels","targetModel","ModelCatalogModel","exports","useConceptIndex","href","key","entryDate","useEntryDate","url","filterParameters","setParameter","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","useCompleteSource","contentHref","Href","removeParameter","addParameter","useContentType","contentType","ContentTypeModel","getSearchHref","uri","filters","filterString","_keys","default","filterValue","value","Array","isArray","join","replace","push","length","useConceptSearch","useContentSearch","dispatch","useDispatch","useSelector","getEntryDate","setEntryDate","date","updateEntryDate","useRelatedConcepts"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (date: ISO_DATE) => dispatch(updateEntryDate(date)),\n };\n};\n\n/**\n */\nexport const useRelatedConcepts = (\n href: string | Href,\n key?: string = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,mBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,sBAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,kBAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AACA,IAAAS,gBAAA,GAAAL,sBAAA,CAAAJ,OAAA;AACA,IAAAU,aAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAEA,IAAAW,kBAAA,GAAAX,OAAA;AACA,IAA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A,kBAAA","ignoreList":[]}
|
|
@@ -47,7 +47,7 @@ const useModularUI = (modelKey, url, options = {}) => {
|
|
|
47
47
|
const requestOptions = (0, _react.useMemo)(() => {
|
|
48
48
|
const merged = {
|
|
49
49
|
method: _constants.HTTP_METHODS.GET,
|
|
50
|
-
removeOnUnmount:
|
|
50
|
+
removeOnUnmount: false,
|
|
51
51
|
...options
|
|
52
52
|
};
|
|
53
53
|
if (url instanceof _Href.default) {
|