@beinformed/ui 1.65.24 → 1.65.26
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 +7 -5
- package/esm/builder/mergeLayoutHintConfigurations.js.flow +12 -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/useAuthentication.js +7 -3
- package/esm/hooks/useAuthentication.js.flow +6 -3
- 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/i18n/Locale.js +7 -1
- package/esm/i18n/Locale.js.flow +4 -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 +9 -4
- package/esm/models/attributes/StringAttributeModel.js.flow +7 -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 +8 -5
- package/esm/models/base/BaseModel.js.flow +8 -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 +4 -2
- package/esm/models/filters/StringFilterModel.js.flow +3 -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/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 +1 -5
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIConnector.js +3 -4
- package/esm/redux/_modularui/ModularUIConnector.js.flow +2 -1
- 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/actions/Authorization.js +4 -2
- package/esm/redux/actions/Authorization.js.flow +3 -2
- package/esm/redux/actions/Authorization.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/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 +6 -1
- package/esm/redux/store/configureStore.js.flow +4 -1
- package/esm/redux/store/configureStore.js.map +1 -1
- package/esm/redux/types.js.flow +10 -1
- 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 +4 -1
- package/esm/utils/helpers/createHref.js.flow +2 -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 +6 -3
- package/esm/utils/number/parseNumbers.js.flow +4 -3
- package/esm/utils/number/parseNumbers.js.map +1 -1
- package/lib/builder/mergeLayoutHintConfigurations.js +7 -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 +7 -3
- 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/i18n/Locale.js +7 -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 +9 -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 +8 -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 +4 -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/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 +3 -4
- 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/actions/Authorization.js +4 -2
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Preferences.js +4 -4
- package/lib/redux/actions/Preferences.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 +6 -1
- 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 +4 -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 +6 -3
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["hydrateRoot","createRoot","has","setImmediate","Cache","xhr","createBrowserHistory","configureStore","rehydrate","getBasePathModularUI","getBasePathServer","getSetting","setAllContentInDataSetting","setDateTimeSettings","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","updateEntryDate","locationChange","replace","JsonParseException","FetchException","Init","handleBeforeRenderHooks","createTheme","receiveLocale","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","initThemeSettings","state","theme","storedTheme","preferences","handleLocale","locale","getState","i18n","handleRedirectURI","urlParams","_URLSearchParams","location","search","redirectURI","get","url","catch","e","id","LOGIN_PATH","from","pathname","modal","setModelCatalogEntryDate","entryDateFromUrl","hasItem","getItem","setupClient","customReducers","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","loadOtherBrowserTabs","response","listen","action","body","className","addContentLoadedEvent","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","root","client"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrateRoot, createRoot } from \"react-dom/client\";\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 {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setDateTimeSettings,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\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, ReduxState, 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\";\nimport createTheme from \"../react-theme/createTheme\";\nimport { receiveLocale } from \"../redux\";\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 */\nconst initThemeSettings = (state: ReduxState, theme?: Theme | Array<Theme>) => {\n const storedTheme = state.preferences.theme;\n // $FlowFixMe\n createTheme(storedTheme, theme); // on theme creation, the settings are set\n};\n\nconst handleLocale = (store: ReduxStore) => {\n const locale = store.getState().i18n.locale;\n if (locale) {\n store.dispatch(receiveLocale(locale));\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: `${getBasePathModularUI()}${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 setModelCatalogEntryDate = (store: ReduxStore) => {\n if (typeof window !== \"undefined\") {\n const entryDateFromUrl = new URLSearchParams(window.location?.search).get(\n \"entryDate\",\n );\n if (entryDateFromUrl) {\n store.dispatch(updateEntryDate(entryDateFromUrl));\n } else if (Cache.hasItem(\"ModelCatalogEntryDate\")) {\n store.dispatch(Cache.getItem(\"ModelCatalogEntryDate\"));\n }\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n theme?: Theme | Array<Theme>,\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: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n initThemeSettings(store.getState(), theme);\n\n handleLocale(store);\n\n handleRedirectURI(store);\n setModelCatalogEntryDate(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n setDateTimeSettings(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 hydrateRoot(element, applicationNode);\n } else {\n const root = createRoot(element);\n root.render(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,WAAW,EAAEC,UAAU,QAAQ,kBAAkB;AAE1D,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,SACEC,oBAAoB,EACpBC,iBAAiB,EACjBC,UAAU,QACL,uBAAuB;AAE9B,SACEC,0BAA0B,EAC1BC,mBAAmB,EACnBC,mBAAmB,QACd,8BAA8B;AACrC,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,eAAe,QAAQ,+BAA+B;AAE/D,SAASC,cAAc,EAAEC,OAAO,QAAQ,gCAAgC;AAExE,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,eAAe;AAElE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,uBAAuB,QAAQ,kCAAkC;AAY1E,OAAOC,WAAW,MAAM,4BAA4B;AACpD,SAASC,aAAa,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgBzC;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,IAAY,IAAK;EACxC,IAAI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ACC,aAAa,CAAC,cAAc,CAAC;IAC9D,IAAI,CAAC+D,eAAe,EAAE;MACpB,MAAM,IAAI9D,KAAK,CACb,8DACF,CAAC;IACH;IAEA4D,KAAK,CACHE,eAAe,eACfzE,IAAA,CAACL,IAAI;MACHqB,KAAK,EAAEA,KAAM;MACb6C,aAAa,EAAEA,aAAc;MAC7BJ,WAAW,EAAExC,MAAM,CAACwC,WAAY;MAChC7B,KAAK,EAAEA,KAAM;MACb0C,sBAAsB,EAAEA,sBAAuB;MAAAI,QAAA,EAE9CL,MAAM,CAAC;IAAC,CACL,CACR,CAAC;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA,MAAMM,WAAW,GAAGA,CAClBF,eAAwB,EACxBG,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGJ,eAAe,CAAC/D,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAImE,KAAK,EAAE;IACTzG,WAAW,CAACwG,OAAO,EAAEH,eAAe,CAAC;EACvC,CAAC,MAAM;IACL,MAAMK,IAAI,GAAGzG,UAAU,CAACuG,OAAO,CAAC;IAChCE,IAAI,CAACT,MAAM,CAACI,eAAe,CAAC;EAC9B;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMM,MAAM,GAAGA,CAAC;EACrBxB,cAAc;EACd3B,KAAK;EACLyC,MAAM;EACNb,iBAAiB;EACjBc,sBAAsB;EACtBC;AACK,CAAC,KAAK;EACX,MAAM;IAAEvD,KAAK;IAAE6C;EAAc,CAAC,GAAGP,WAAW,CAC1CC,cAAc,EACdC,iBACF,CAAC;EAEDY,qBAAqB,CACnBpD,KAAK,EACL6C,aAAa,EACbjC,KAAK,EACLyC,MAAM,EACNC,sBAAsB,EACtBC,KAAK,IAAII,WACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"client.js","names":["hydrateRoot","createRoot","has","setImmediate","Cache","xhr","createBrowserHistory","configureStore","rehydrate","getBasePathModularUI","getBasePathServer","getSetting","setAllContentInDataSetting","setDateTimeSettings","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","updateEntryDate","locationChange","replace","JsonParseException","FetchException","Init","handleBeforeRenderHooks","createTheme","receiveLocale","jsx","_jsx","parseDataToJSON","data","JSON","parse","error","getDataFromServer","_context","dataElement","document","querySelector","Error","_trimInstanceProperty","textContent","call","setUnhandledRejectionEvent","store","_globalThis","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","initThemeSettings","state","theme","storedTheme","preferences","handleLocale","locale","getState","i18n","handleRedirectURI","urlParams","_URLSearchParams","location","search","redirectURI","get","url","catch","e","id","LOGIN_PATH","from","pathname","modal","setModelCatalogEntryDate","entryDateFromUrl","hasItem","getItem","setupClient","customReducers","beforeRenderHooks","contextPath","undefined","clear","browserHistory","basename","routerHistory","loadOtherBrowserTabs","response","listen","action","body","className","addContentLoadedEvent","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","root","client"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrateRoot, createRoot } from \"react-dom/client\";\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 {\n getBasePathModularUI,\n getBasePathServer,\n getSetting,\n} from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setDateTimeSettings,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\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, ReduxState, 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\";\nimport createTheme from \"../react-theme/createTheme\";\nimport { receiveLocale } from \"../redux\";\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 // $FlowIssue\n globalThis.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 */\nconst initThemeSettings = (state: ReduxState, theme?: Theme | Array<Theme>) => {\n const storedTheme = state.preferences.theme;\n // $FlowFixMe\n createTheme(storedTheme, theme); // on theme creation, the settings are set\n};\n\nconst handleLocale = (store: ReduxStore) => {\n const locale = store.getState().i18n.locale;\n if (locale) {\n store.dispatch(receiveLocale(locale));\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 // $FlowIssue\n const urlParams = new URLSearchParams(globalThis.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePathModularUI()}${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 setModelCatalogEntryDate = (store: ReduxStore) => {\n // $FlowIssue\n if (globalThis) {\n // $FlowIssue\n const { search } = globalThis.location;\n const entryDateFromUrl = new URLSearchParams(search).get(\"entryDate\");\n if (entryDateFromUrl) {\n store.dispatch(updateEntryDate(entryDateFromUrl));\n } else if (Cache.hasItem(\"ModelCatalogEntryDate\")) {\n store.dispatch(Cache.getItem(\"ModelCatalogEntryDate\"));\n }\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers?: CustomReducers,\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n theme?: Theme | Array<Theme>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n // $FlowIssue\n if (globalThis.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: getBasePathServer(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers ?? {},\n rehydrate(data),\n );\n\n initThemeSettings(store.getState(), theme);\n\n handleLocale(store);\n\n handleRedirectURI(store);\n setModelCatalogEntryDate(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n setDateTimeSettings(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 // $FlowIssue\n globalThis.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 // $FlowIssue\n contextPath={globalThis.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 hydrateRoot(element, applicationNode);\n } else {\n const root = createRoot(element);\n root.render(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,WAAW,EAAEC,UAAU,QAAQ,kBAAkB;AAE1D,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,SACEC,oBAAoB,EACpBC,iBAAiB,EACjBC,UAAU,QACL,uBAAuB;AAE9B,SACEC,0BAA0B,EAC1BC,mBAAmB,EACnBC,mBAAmB,QACd,8BAA8B;AACrC,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,eAAe,QAAQ,+BAA+B;AAE/D,SAASC,cAAc,EAAEC,OAAO,QAAQ,gCAAgC;AAExE,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,eAAe;AAElE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,uBAAuB,QAAQ,kCAAkC;AAY1E,OAAOC,WAAW,MAAM,4BAA4B;AACpD,SAASC,aAAa,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgBzC;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,IAAIZ,kBAAkB,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,MAAM,IAAI/D,KAAK,CACb,8DACF,CAAC;IACH;IAEA6D,KAAK,CACHE,eAAe,eACf1E,IAAA,CAACL,IAAI;MACHqB,KAAK,EAAEA,KAAM;MACb8C,aAAa,EAAEA;MACf;MAAA;MACAL,WAAW,EAAExC,WAAA,CAAWwC,WAAY;MACpC7B,KAAK,EAAEA,KAAM;MACb2C,sBAAsB,EAAEA,sBAAuB;MAAAI,QAAA,EAE9CL,MAAM,CAAC;IAAC,CACL,CACR,CAAC;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA,MAAMM,WAAW,GAAGA,CAClBF,eAAwB,EACxBG,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGJ,eAAe,CAAChE,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAIoE,KAAK,EAAE;IACT1G,WAAW,CAACyG,OAAO,EAAEH,eAAe,CAAC;EACvC,CAAC,MAAM;IACL,MAAMK,IAAI,GAAG1G,UAAU,CAACwG,OAAO,CAAC;IAChCE,IAAI,CAACT,MAAM,CAACI,eAAe,CAAC;EAC9B;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMM,MAAM,GAAGA,CAAC;EACrBzB,cAAc;EACd3B,KAAK;EACL0C,MAAM;EACNd,iBAAiB;EACjBe,sBAAsB;EACtBC;AACK,CAAC,KAAK;EACX,MAAM;IAAExD,KAAK;IAAE8C;EAAc,CAAC,GAAGR,WAAW,CAC1CC,cAAc,EACdC,iBACF,CAAC;EAEDa,qBAAqB,CACnBrD,KAAK,EACL8C,aAAa,EACblC,KAAK,EACL0C,MAAM,EACNC,sBAAsB,EACtBC,KAAK,IAAII,WACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _globalThis from "@babel/runtime-corejs3/core-js/global-this";
|
|
1
2
|
(function x() {
|
|
2
3
|
const dataElement = document.querySelector('script[type="application/json"][data-app-state="app-json"]');
|
|
3
4
|
if (!dataElement) {
|
|
@@ -5,7 +6,8 @@
|
|
|
5
6
|
}
|
|
6
7
|
const contextPath = dataElement.getAttribute("data-app-contextpath");
|
|
7
8
|
if (contextPath) {
|
|
8
|
-
|
|
9
|
+
// $FlowIssue
|
|
10
|
+
_globalThis.contextPath = contextPath;
|
|
9
11
|
}
|
|
10
12
|
const filePath = dataElement.getAttribute("data-app-filepath");
|
|
11
13
|
if (filePath && filePath !== "{FILEPATH}") {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
const contextPath = dataElement.getAttribute("data-app-contextpath");
|
|
13
13
|
if (contextPath) {
|
|
14
|
-
|
|
14
|
+
// $FlowIssue
|
|
15
|
+
globalThis.contextPath = contextPath;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const filePath = dataElement.getAttribute("data-app-filepath");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextPath.js","names":["x","dataElement","document","querySelector","Error","contextPath","getAttribute","
|
|
1
|
+
{"version":3,"file":"contextPath.js","names":["x","dataElement","document","querySelector","Error","contextPath","getAttribute","_globalThis","filePath","__webpack_public_path__","nonce","__webpack_nonce__"],"sources":["../../src/react-client/contextPath.js"],"sourcesContent":["// @flow\n(function x() {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n if (!dataElement) {\n throw new Error(\n \"Error finding script with attribute app-json to retrieve context path\",\n );\n }\n\n const contextPath = dataElement.getAttribute(\"data-app-contextpath\");\n if (contextPath) {\n // $FlowIssue\n globalThis.contextPath = contextPath;\n }\n\n const filePath = dataElement.getAttribute(\"data-app-filepath\");\n if (filePath && filePath !== \"{FILEPATH}\") {\n __webpack_public_path__ = `${filePath}/`; // NOSONAR\n } else if (contextPath) {\n __webpack_public_path__ = `${contextPath}/`; // NOSONAR\n }\n\n const nonce = dataElement.getAttribute(\"data-app-nonce\");\n if (nonce) {\n __webpack_nonce__ = nonce; // NOSONAR\n }\n})();\n\nexport {};\n"],"mappings":";AACA,CAAC,SAASA,CAACA,CAAA,EAAG;EACZ,MAAMC,WAAW,GAAGC,QAAQ,CAACC,aAAa,CACxC,4DACF,CAAC;EACD,IAAI,CAACF,WAAW,EAAE;IAChB,MAAM,IAAIG,KAAK,CACb,uEACF,CAAC;EACH;EAEA,MAAMC,WAAW,GAAGJ,WAAW,CAACK,YAAY,CAAC,sBAAsB,CAAC;EACpE,IAAID,WAAW,EAAE;IACf;IACAE,WAAA,CAAWF,WAAW,GAAGA,WAAW;EACtC;EAEA,MAAMG,QAAQ,GAAGP,WAAW,CAACK,YAAY,CAAC,mBAAmB,CAAC;EAC9D,IAAIE,QAAQ,IAAIA,QAAQ,KAAK,YAAY,EAAE;IACzCC,uBAAuB,GAAG,GAAGD,QAAQ,GAAG,CAAC,CAAC;EAC5C,CAAC,MAAM,IAAIH,WAAW,EAAE;IACtBI,uBAAuB,GAAG,GAAGJ,WAAW,GAAG,CAAC,CAAC;EAC/C;EAEA,MAAMK,KAAK,GAAGT,WAAW,CAACK,YAAY,CAAC,gBAAgB,CAAC;EACxD,IAAII,KAAK,EAAE;IACTC,iBAAiB,GAAGD,KAAK,CAAC,CAAC;EAC7B;AACF,CAAC,EAAE,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -44,10 +44,7 @@ const setLocales = (state, {
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
const getDefaultLocale = () => {
|
|
47
|
-
|
|
48
|
-
return navigator?.language.split("-")[0] || "en";
|
|
49
|
-
}
|
|
50
|
-
return "en";
|
|
47
|
+
return navigator?.language?.split("-")[0] || "en";
|
|
51
48
|
};
|
|
52
49
|
|
|
53
50
|
// REDUCER
|
|
@@ -55,10 +55,7 @@ const setLocales = (
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
const getDefaultLocale = () => {
|
|
58
|
-
|
|
59
|
-
return navigator?.language.split("-")[0] || "en";
|
|
60
|
-
}
|
|
61
|
-
return "en";
|
|
58
|
+
return navigator?.language?.split("-")[0] || "en";
|
|
62
59
|
};
|
|
63
60
|
|
|
64
61
|
// REDUCER
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18nReducer.js","names":["Cache","setCookie","clearCookie","Locales","updateLocale","state","locale","locales","length","clear","setLocales","getDefaultLocale","navigator","language","split","initialState","I18nReducer","action","type","payload"],"sources":["../../../src/redux/_i18n/I18nReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport { setCookie, clearCookie } from \"../../utils/browser/Cookies\";\n\nimport Locales from \"../../i18n/Locales\";\n\nimport type { Reducer } from \"redux\";\nimport type { I18nState } from \"./types\";\nimport type { ReduxAction } from \"../types\";\n\n/**\n */\nconst updateLocale = (state: I18nState, locale: string) => {\n // set locale in cookie\n if (state.locales?.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n // clear cache because of cached contributions\n Cache.clear();\n\n return {\n ...state,\n locale,\n };\n};\n\n/**\n */\nconst setLocales = (\n state: I18nState,\n { locale, locales }: { locale: string, locales: Locales },\n) => {\n // set locale in cookie\n if (state.locales.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n if (locale) {\n return {\n ...state,\n locales,\n locale,\n };\n }\n\n return {\n ...state,\n locales,\n };\n};\n\nconst getDefaultLocale = () => {\n
|
|
1
|
+
{"version":3,"file":"I18nReducer.js","names":["Cache","setCookie","clearCookie","Locales","updateLocale","state","locale","locales","length","clear","setLocales","getDefaultLocale","navigator","language","split","initialState","I18nReducer","action","type","payload"],"sources":["../../../src/redux/_i18n/I18nReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport { setCookie, clearCookie } from \"../../utils/browser/Cookies\";\n\nimport Locales from \"../../i18n/Locales\";\n\nimport type { Reducer } from \"redux\";\nimport type { I18nState } from \"./types\";\nimport type { ReduxAction } from \"../types\";\n\n/**\n */\nconst updateLocale = (state: I18nState, locale: string) => {\n // set locale in cookie\n if (state.locales?.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n // clear cache because of cached contributions\n Cache.clear();\n\n return {\n ...state,\n locale,\n };\n};\n\n/**\n */\nconst setLocales = (\n state: I18nState,\n { locale, locales }: { locale: string, locales: Locales },\n) => {\n // set locale in cookie\n if (state.locales.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n if (locale) {\n return {\n ...state,\n locales,\n locale,\n };\n }\n\n return {\n ...state,\n locales,\n };\n};\n\nconst getDefaultLocale = () => {\n return navigator?.language?.split(\"-\")[0] || \"en\";\n};\n\n// REDUCER\nconst initialState: I18nState = {\n locales: new Locales(),\n locale: getDefaultLocale(),\n};\n\n/**\n * Form reducer\n */\nexport const I18nReducer: Reducer<I18nState, ReduxAction> = (\n state = initialState,\n action = void 0,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SET_LOCALES\":\n return setLocales(state, action.payload);\n\n case \"UPDATE_LOCALE\":\n return updateLocale(state, action.payload);\n\n default:\n return state;\n }\n};\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,2BAA2B;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,6BAA6B;AAEpE,OAAOC,OAAO,MAAM,oBAAoB;AAMxC;AACA;AACA,MAAMC,YAAY,GAAGA,CAACC,KAAgB,EAAEC,MAAc,KAAK;EACzD;EACA,IAAID,KAAK,CAACE,OAAO,EAAEC,MAAM,GAAG,CAAC,EAAE;IAC7BP,SAAS,CAAC,QAAQ,EAAEK,MAAM,CAAC;EAC7B,CAAC,MAAM;IACLJ,WAAW,CAAC,QAAQ,CAAC;EACvB;;EAEA;EACAF,KAAK,CAACS,KAAK,CAAC,CAAC;EAEb,OAAO;IACL,GAAGJ,KAAK;IACRC;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMI,UAAU,GAAGA,CACjBL,KAAgB,EAChB;EAAEC,MAAM;EAAEC;AAA8C,CAAC,KACtD;EACH;EACA,IAAIF,KAAK,CAACE,OAAO,CAACC,MAAM,GAAG,CAAC,EAAE;IAC5BP,SAAS,CAAC,QAAQ,EAAEK,MAAM,CAAC;EAC7B,CAAC,MAAM;IACLJ,WAAW,CAAC,QAAQ,CAAC;EACvB;EAEA,IAAII,MAAM,EAAE;IACV,OAAO;MACL,GAAGD,KAAK;MACRE,OAAO;MACPD;IACF,CAAC;EACH;EAEA,OAAO;IACL,GAAGD,KAAK;IACRE;EACF,CAAC;AACH,CAAC;AAED,MAAMI,gBAAgB,GAAGA,CAAA,KAAM;EAC7B,OAAOC,SAAS,EAAEC,QAAQ,EAAEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI;AACnD,CAAC;;AAED;AACA,MAAMC,YAAuB,GAAG;EAC9BR,OAAO,EAAE,IAAIJ,OAAO,CAAC,CAAC;EACtBG,MAAM,EAAEK,gBAAgB,CAAC;AAC3B,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,WAA4C,GAAGA,CAC1DX,KAAK,GAAGU,YAAY,EACpBE,MAAM,GAAG,KAAK,CAAC,KACZ;EACH,IAAI,CAACA,MAAM,EAAE;IACX,OAAOZ,KAAK;EACd;EAEA,QAAQY,MAAM,CAACC,IAAI;IACjB,KAAK,aAAa;MAChB,OAAOR,UAAU,CAACL,KAAK,EAAEY,MAAM,CAACE,OAAO,CAAC;IAE1C,KAAK,eAAe;MAClB,OAAOf,YAAY,CAACC,KAAK,EAAEY,MAAM,CAACE,OAAO,CAAC;IAE5C;MACE,OAAOd,KAAK;EAChB;AACF,CAAC","ignoreList":[]}
|
|
@@ -80,10 +80,7 @@ const getRequestLocale = optionLocale => {
|
|
|
80
80
|
if (optionLocale) {
|
|
81
81
|
return optionLocale;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
return navigator.language.split("-")[0] || "en";
|
|
85
|
-
}
|
|
86
|
-
return "en";
|
|
83
|
+
return navigator?.language?.split("-")[0] || "en";
|
|
87
84
|
};
|
|
88
85
|
|
|
89
86
|
/**
|
|
@@ -108,11 +108,7 @@ const getRequestLocale = (optionLocale: ?string): string => {
|
|
|
108
108
|
return optionLocale;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
return navigator.language.split("-")[0] || "en";
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return "en";
|
|
111
|
+
return navigator?.language?.split("-")[0] || "en";
|
|
116
112
|
};
|
|
117
113
|
|
|
118
114
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIActions.js","names":["HTTP_METHODS","MODULARUI_STATUS","Href","ErrorResponse","finishProgress","startProgress","handleError","setModel","key","model","connectKey","type","payload","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","requestOptions","loadModelSuccessAction","updateHandler","getRequestLocale","optionLocale","navigator","language","split","loadModel","href","options","origin","contextPath","method","GET","params","data","timeout","headers","events","onProgress","locale","childmodels","targetModel","forceTargetModel","cache","isReload","withCredentials","successAction","errorAction","error","errorResponse","isChangePassword","isResourceNotFoundAfterReload","ERROR","loadModularUI","retryCount","retryDelay","dispatch","getState","modularuiStore","modularui","currentRequest","isLoading","LOADING","isDifferentRequest","toString","_Promise","resolve","setTimeout","loadModelPromise","then","catch","reloadModel","selfhref"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {\n RequestModularUIOptions,\n UpdateHandler,\n} from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel,\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>,\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status, requestOptions },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n updateHandler: UpdateHandler | void,\n): UpdateModelAction | SetModelAction => {\n if (updateHandler) {\n return updateModel(updateHandler(model));\n }\n return setModel(key, model);\n};\n\n/**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\nconst getRequestLocale = (optionLocale: ?string): string => {\n if (optionLocale) {\n return optionLocale;\n }\n\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator.language.split(\"-\")[0] || \"en\";\n }\n\n return \"en\";\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n params: options?.params,\n data: options?.data,\n timeout: options?.timeout,\n headers: options?.headers,\n events: options?.events,\n onProgress: options?.onProgress,\n locale: getRequestLocale(options?.locale),\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n isReload: options?.isReload,\n withCredentials: options?.withCredentials,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key, {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n retryCount: number = 3,\n retryDelay: number = 200,\n ): ThunkAction<> =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n const currentRequest = modularuiStore?.[key];\n\n const isLoading = currentRequest?.status === MODULARUI_STATUS.LOADING;\n\n if (isLoading) {\n const isDifferentRequest =\n currentRequest.requestOptions?.href?.toString() !== href.toString();\n if (isDifferentRequest && retryCount > 0) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(\n dispatch(\n loadModularUI(key, href, options, retryCount - 1, retryDelay),\n ),\n );\n }, retryDelay);\n });\n }\n\n // Same request is already loading — do nothing\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction<> =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";AACA,SAASA,YAAY,EAAEC,gBAAgB,QAAQ,2BAA2B;AAC1E,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,8BAA8B;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;AAmB9C;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMI,UAAU,GACrBC,MAAqD,KAChC;EACrBH,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEE;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMC,WAAW,GAAIN,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMO,UAAU,GAAIP,KAAqB,KAAwB;EACtEE,IAAI,EAAE,uBAAuB;EAC7BC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMQ,gBAAgB,GAAIT,GAAW,KAA8B;EACxEG,IAAI,EAAE,sBAAsB;EAC5BC,OAAO,EAAEJ;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAMU,cAAc,GAAGA,CAAA,MAA6B;EACzDP,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AACA,OAAO,MAAMQ,YAAY,GAAGA,CAC1BX,GAAW,EACXY,MAAsC,EACtCC,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;EACVgB,QAAQ,EAAE;AACZ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ModularUIActions.js","names":["HTTP_METHODS","MODULARUI_STATUS","Href","ErrorResponse","finishProgress","startProgress","handleError","setModel","key","model","connectKey","type","payload","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","requestOptions","loadModelSuccessAction","updateHandler","getRequestLocale","optionLocale","navigator","language","split","loadModel","href","options","origin","contextPath","method","GET","params","data","timeout","headers","events","onProgress","locale","childmodels","targetModel","forceTargetModel","cache","isReload","withCredentials","successAction","errorAction","error","errorResponse","isChangePassword","isResourceNotFoundAfterReload","ERROR","loadModularUI","retryCount","retryDelay","dispatch","getState","modularuiStore","modularui","currentRequest","isLoading","LOADING","isDifferentRequest","toString","_Promise","resolve","setTimeout","loadModelPromise","then","catch","reloadModel","selfhref"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {\n RequestModularUIOptions,\n UpdateHandler,\n} from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel,\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>,\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status, requestOptions },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n updateHandler: UpdateHandler | void,\n): UpdateModelAction | SetModelAction => {\n if (updateHandler) {\n return updateModel(updateHandler(model));\n }\n return setModel(key, model);\n};\n\n/**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\nconst getRequestLocale = (optionLocale: ?string): string => {\n if (optionLocale) {\n return optionLocale;\n }\n\n return navigator?.language?.split(\"-\")[0] || \"en\";\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n key,\n origin: options?.origin,\n contextPath: options?.contextPath,\n href:\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n }),\n method: options?.method ?? HTTP_METHODS.GET,\n params: options?.params,\n data: options?.data,\n timeout: options?.timeout,\n headers: options?.headers,\n events: options?.events,\n onProgress: options?.onProgress,\n locale: getRequestLocale(options?.locale),\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n isReload: options?.isReload,\n withCredentials: options?.withCredentials,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key, {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n return removeModelByKey(key);\n }\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n retryCount: number = 3,\n retryDelay: number = 200,\n ): ThunkAction<> =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n const currentRequest = modularuiStore?.[key];\n\n const isLoading = currentRequest?.status === MODULARUI_STATUS.LOADING;\n\n if (isLoading) {\n const isDifferentRequest =\n currentRequest.requestOptions?.href?.toString() !== href.toString();\n if (isDifferentRequest && retryCount > 0) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(\n dispatch(\n loadModularUI(key, href, options, retryCount - 1, retryDelay),\n ),\n );\n }, retryDelay);\n });\n }\n\n // Same request is already loading — do nothing\n return Promise.resolve();\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction<> =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";AACA,SAASA,YAAY,EAAEC,gBAAgB,QAAQ,2BAA2B;AAC1E,OAAOC,IAAI,MAAM,wBAAwB;AACzC,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,8BAA8B;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;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UACfD,OAAO,CACLV,QAAQ,CACNH,aAAa,CAAChD,GAAG,EAAEsB,IAAI,EAAEC,OAAO,EAAE0B,UAAU,GAAG,CAAC,EAAEC,UAAU,CAC9D,CACF,CAAC;QACH,CAAC,EAAEA,UAAU,CAAC;MAChB,CAAC,CAAC;IACJ;;IAEA;IACA,OAAOU,QAAA,CAAQC,OAAO,CAAC,CAAC;EAC1B;EAEAV,QAAQ,CAACtD,aAAa,CAAC,CAAC,CAAC;EAEzB,MAAMkE,gBAAgB,GAAGZ,QAAQ,CAAC9B,SAAS,CAACrB,GAAG,EAAEsB,IAAI,EAAEC,OAAO,CAAC,CAAC;EAEhE,OAAOqC,QAAA,CAAQC,OAAO,CAACE,gBAAgB,CAAC,CACrCC,IAAI,CAAC,MAAMb,QAAQ,CAACvD,cAAc,CAAC,CAAC,CAAC,CAAC,CACtCqE,KAAK,CAAEtB,KAAK,IAAKQ,QAAQ,CAACrD,WAAW,CAAC6C,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AACA,OAAO,MAAMuB,WAAW,GAAGA,CACzBjE,KAAqB,EACrBsB,OAAiC,KAEjCyB,aAAa,CAAC/C,KAAK,CAACC,UAAU,EAAED,KAAK,CAACkE,QAAQ,EAAE;EAC9C,GAAG5C,OAAO;EACVgB,QAAQ,EAAE;AACZ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -30,10 +30,9 @@ const patchUpdateModelOption = oldOptions => {
|
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead
|
|
32
32
|
*/
|
|
33
|
-
const modularUIConnector = (name, resource,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}) => {
|
|
33
|
+
const modularUIConnector = (name, resource,
|
|
34
|
+
// $FlowIssue
|
|
35
|
+
options = {}) => {
|
|
37
36
|
const {
|
|
38
37
|
propName = "data",
|
|
39
38
|
removeOnUnmount = false,
|
|
@@ -60,7 +60,8 @@ const patchUpdateModelOption = (oldOptions: Object) => {
|
|
|
60
60
|
const modularUIConnector = (
|
|
61
61
|
name: string,
|
|
62
62
|
resource: string | Function,
|
|
63
|
-
|
|
63
|
+
// $FlowIssue
|
|
64
|
+
options: ModularUIOptions = {},
|
|
64
65
|
): ((Component: ComponentType<any>) => (props: any) => Node) => {
|
|
65
66
|
const {
|
|
66
67
|
propName = "data",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIConnector.js","names":["useDispatch","useLocation","loadModularUI","reloadModel","Href","getDisplayName","useUrl","useModularUI","useModularUIBasic","useLocale","FormModel","jsx","_jsx","patchUpdateModelOption","oldOptions","updateModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","location","locale","url","model","modelEntry","modelKey","connectKey","handleFetch","href","fetchOptions","handleManualReload","m","o","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","displayName"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { loadModularUI, reloadModel } from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useModularUIBasic } from \"../../hooks/useModularUIBasic\";\n\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = {
|
|
1
|
+
{"version":3,"file":"ModularUIConnector.js","names":["useDispatch","useLocation","loadModularUI","reloadModel","Href","getDisplayName","useUrl","useModularUI","useModularUIBasic","useLocale","FormModel","jsx","_jsx","patchUpdateModelOption","oldOptions","updateModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","location","locale","url","model","modelEntry","modelKey","connectKey","handleFetch","href","fetchOptions","handleManualReload","m","o","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","displayName"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { loadModularUI, reloadModel } from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useModularUIBasic } from \"../../hooks/useModularUIBasic\";\n\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport FormModel from \"../../models/form/FormModel\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n * @deprecated - will be removed in the future, use the equivalent hook 'useModularUI' or 'useModularUIBasic' instead\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n // $FlowIssue\n options: ModularUIOptions = {},\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n const locale = useLocale();\n const url = useUrl(resource, { location, ...props });\n\n // $FlowFixMe\n const model = useModularUIBasic<ModularUIModel>(name, url, options);\n\n const modelEntry = useModularUI(name, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = model?.connectKey ?? name;\n\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n const handleManualReload = (m: ModularUIModel, o: Object) => {\n dispatch(reloadModel(m, o));\n };\n\n const newProps: InjectedProps = {\n modelKey,\n [propName ?? \"data\"]: model,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry?.lastModification ?? null,\n hasModel: Boolean(model),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(Component, name)})`;\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AACzC,SAASC,WAAW,QAAQ,cAAc;AAE1C,SAASC,aAAa,EAAEC,WAAW,QAAQ,oBAAoB;AAE/D,OAAOC,IAAI,MAAM,wBAAwB;AACzC,SAASC,cAAc,QAAQ,mBAAmB;AAElD,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,iBAAiB,QAAQ,+BAA+B;AAEjE,SAASC,SAAS,QAAQ,qBAAqB;AAE/C,OAAOC,SAAS,MAAM,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAmBpD,MAAMC,sBAAsB,GAAIC,UAAkB,IAAK;EACrD,IACE,aAAa,IAAIA,UAAU,IAC3BA,UAAU,CAACC,WAAW,YAAYL,SAAS,EAC3C;IACA,OAAO;MACL,GAAGI,UAAU;MACbE,aAAa,EAAGC,QAAwB,IAAqB;QAC3D,IAAIA,QAAQ,YAAYP,SAAS,EAAE;UACjC;UACA,MAAMQ,WAAsB,GAAGJ,UAAU,CAACC,WAAW,CAACI,KAAK,CAAC,CAAC;UAC7DD,WAAW,CAACE,MAAM,CAACH,QAAQ,CAAC;UAC5B,OAAOC,WAAW;QACpB;QACA,OAAOD,QAAQ;MACjB;IACF,CAAC;EACH;EAEA,OAAOH,UAAU;AACnB,CAAC;;AAED;AACA;AACA;AACA,MAAMO,kBAAkB,GAAGA,CACzBC,IAAY,EACZC,QAA2B;AAC3B;AACAC,OAAyB,GAAG,CAAC,CAAC,KACgC;EAC9D,MAAM;IACJC,QAAQ,GAAG,MAAM;IACjBC,eAAe,GAAG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,EAAEC,OAAO,CAACd,KAAK,CAAC;QACxBF,MAAM;QACNiB,cAAc,EAAEX,WAAW;QAC3BrC,WAAW,EAAEwC;MACf,CAAC;MAED,oBAAO/B,IAAA,CAACgB,SAAS;QAAA,GAAKE,KAAK;QAAA,GAAMgB;MAAQ,CAAG,CAAC;IAC/C,CAAC;IAEDjB,gBAAgB,CAACuB,WAAW,GAAG,gBAAgB/C,cAAc,CAACuB,SAAS,EAAEN,IAAI,CAAC,GAAG;IACjF,OAAOO,gBAAgB;EACzB,CAAC;AACH,CAAC;AAED,eAAeR,kBAAkB","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
1
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
3
2
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
4
3
|
import { MODULARUI_STATUS } from "../../constants/Constants";
|
|
@@ -54,7 +53,9 @@ const setModel = (state, {
|
|
|
54
53
|
/**
|
|
55
54
|
*/
|
|
56
55
|
const initModularUI = (state, models) => {
|
|
57
|
-
const newState =
|
|
56
|
+
const newState = {
|
|
57
|
+
...state
|
|
58
|
+
};
|
|
58
59
|
models.forEach(({
|
|
59
60
|
key,
|
|
60
61
|
model
|
|
@@ -97,7 +98,9 @@ const updateModel = (state, model) => {
|
|
|
97
98
|
/**
|
|
98
99
|
*/
|
|
99
100
|
const removeKey = (modelKey, state) => {
|
|
100
|
-
const newState =
|
|
101
|
+
const newState = {
|
|
102
|
+
...state
|
|
103
|
+
};
|
|
101
104
|
delete newState[modelKey];
|
|
102
105
|
return newState;
|
|
103
106
|
};
|
|
@@ -70,7 +70,7 @@ const initModularUI = (
|
|
|
70
70
|
state: ModularUIState,
|
|
71
71
|
models: Array<{ key: string, model: ModularUIModel }>,
|
|
72
72
|
) => {
|
|
73
|
-
const newState =
|
|
73
|
+
const newState = { ...state };
|
|
74
74
|
|
|
75
75
|
models.forEach(({ key, model }) => {
|
|
76
76
|
newState[key] = {
|
|
@@ -110,7 +110,7 @@ const updateModel = (state: ModularUIState, model: ModularUIModel) => {
|
|
|
110
110
|
/**
|
|
111
111
|
*/
|
|
112
112
|
const removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {
|
|
113
|
-
const newState =
|
|
113
|
+
const newState = { ...state };
|
|
114
114
|
delete newState[modelKey];
|
|
115
115
|
return newState;
|
|
116
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIReducer.js","names":["MODULARUI_STATUS","ApplicationModel","updateStatus","state","key","status","requestOptions","LOADING","lastModification","Date","now","setModel","model","FINISHED","console","debug","initModularUI","models","newState","
|
|
1
|
+
{"version":3,"file":"ModularUIReducer.js","names":["MODULARUI_STATUS","ApplicationModel","updateStatus","state","key","status","requestOptions","LOADING","lastModification","Date","now","setModel","model","FINISHED","console","debug","initModularUI","models","newState","forEach","getModelKey","_context","_findInstanceProperty","_Object$keys","call","connectKey","updateModel","modelKey","removeKey","resetModularUI","initialState","ModularUIReducer","action","type","payload"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n {\n key,\n status,\n requestOptions,\n }: {\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n requestOptions: any,\n },\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n requestOptions: requestOptions || state[key]?.requestOptions,\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel },\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n status: MODULARUI_STATUS.FINISHED,\n },\n };\n }\n\n // eslint-disable-next-line no-console\n console.debug(\"No model for setModel\");\n return state;\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>,\n) => {\n const newState = { ...state };\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n // eslint-disable-next-line no-console\n console.debug(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`,\n );\n return state;\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = { ...state };\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,gBAAgB,QAAQ,cAAc;AAO/C;AACA;AACA,MAAMC,YAAY,GAAGA,CACnBC,KAAqB,EACrB;EACEC,GAAG;EACHC,MAAM;EACNC;AAKF,CAAC,KACE;EACH;EACA,IAAID,MAAM,KAAKL,gBAAgB,CAACO,OAAO,IAAI,CAACJ,KAAK,CAACC,GAAG,CAAC,EAAE;IACtD,OAAOD,KAAK;EACd;EAEA,OAAO;IACL,GAAGA,KAAK;IACR,CAACC,GAAG,GAAG;MACL,GAAGD,KAAK,CAACC,GAAG,CAAC;MACbC,MAAM;MACNG,gBAAgB,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MAC5BJ,cAAc,EAAEA,cAAc,IAAIH,KAAK,CAACC,GAAG,CAAC,EAAEE;IAChD;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMK,QAAQ,GAAGA,CACfR,KAAqB,EACrB;EAAEC,GAAG;EAAEQ;AAA+C,CAAC,KACpD;EACH,IAAI,CAACT,KAAK,CAACC,GAAG,CAAC,EAAE;IACf,OAAOD,KAAK;EACd;EAEA,IAAIS,KAAK,EAAE;IACT,OAAO;MACL,GAAGT,KAAK;MACR,CAACC,GAAG,GAAG;QACL,GAAGD,KAAK,CAACC,GAAG,CAAC;QACbQ,KAAK;QACLJ,gBAAgB,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;QAC5BL,MAAM,EAAEL,gBAAgB,CAACa;MAC3B;IACF,CAAC;EACH;;EAEA;EACAC,OAAO,CAACC,KAAK,CAAC,uBAAuB,CAAC;EACtC,OAAOZ,KAAK;AACd,CAAC;;AAED;AACA;AACA,MAAMa,aAAa,GAAG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This from "@babel/runtime-corejs3/core-js/global-this";
|
|
1
2
|
import ErrorResponse from "../../models/error/ErrorResponse";
|
|
2
3
|
import { replace } from "../_router/RouterActions";
|
|
3
4
|
import { logoutSuccess } from "./SignOut";
|
|
@@ -22,7 +23,7 @@ export const handleUnauthorized = errorResponse => (dispatch, getState) => {
|
|
|
22
23
|
if (location?.pathname !== LOGIN_PATH) {
|
|
23
24
|
const locationFrom = location?.state?.from;
|
|
24
25
|
return dispatch(replace(LOGIN_PATH, {
|
|
25
|
-
from: locationFrom
|
|
26
|
+
from: locationFrom ?? state.router.location,
|
|
26
27
|
modal: false
|
|
27
28
|
}));
|
|
28
29
|
}
|
|
@@ -32,7 +33,8 @@ export const handleUnauthorized = errorResponse => (dispatch, getState) => {
|
|
|
32
33
|
dispatch(removeModelByKey(errorResponse.connectKey));
|
|
33
34
|
}
|
|
34
35
|
if (getSetting("PAGE_RELOAD_ON_UNAUTHORIZED_ERROR", false) && errorResponse.response?.error) {
|
|
35
|
-
|
|
36
|
+
// $FlowIssue
|
|
37
|
+
_globalThis.location.reload();
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
38
40
|
const application = getApplication(getState());
|
|
@@ -36,7 +36,7 @@ export const handleUnauthorized =
|
|
|
36
36
|
const locationFrom = location?.state?.from;
|
|
37
37
|
return dispatch(
|
|
38
38
|
replace(LOGIN_PATH, {
|
|
39
|
-
from: locationFrom
|
|
39
|
+
from: locationFrom ?? state.router.location,
|
|
40
40
|
modal: false,
|
|
41
41
|
}),
|
|
42
42
|
);
|
|
@@ -53,7 +53,8 @@ export const handleUnauthorized =
|
|
|
53
53
|
getSetting("PAGE_RELOAD_ON_UNAUTHORIZED_ERROR", false) &&
|
|
54
54
|
errorResponse.response?.error
|
|
55
55
|
) {
|
|
56
|
-
|
|
56
|
+
// $FlowIssue
|
|
57
|
+
globalThis.location.reload();
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authorization.js","names":["ErrorResponse","replace","logoutSuccess","Cache","removeModelByKey","getApplication","noAction","reloadApplication","sendAuthenticationError","getSetting","handleUnauthorized","errorResponse","dispatch","getState","finish","removeItem","isInvalidUsername","message","state","location","router","LOGIN_PATH","pathname","locationFrom","from","modal","connectKey","response","error","
|
|
1
|
+
{"version":3,"file":"Authorization.js","names":["ErrorResponse","replace","logoutSuccess","Cache","removeModelByKey","getApplication","noAction","reloadApplication","sendAuthenticationError","getSetting","handleUnauthorized","errorResponse","dispatch","getState","finish","removeItem","isInvalidUsername","message","state","location","router","LOGIN_PATH","pathname","locationFrom","from","modal","connectKey","response","error","_globalThis","reload","application","shouldReload","getItem","isLoggedIn","then"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/RouterActions\";\nimport { logoutSuccess } from \"./SignOut\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport { removeModelByKey } from \"../_modularui/ModularUIActions\";\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\nimport { noAction, reloadApplication } from \"./Application\";\nimport { sendAuthenticationError } from \"./SignIn\";\n\nimport { getSetting } from \"../../constants\";\n\nimport type { ThunkAction } from \"../types\";\n\n/**\n */\nexport const handleUnauthorized =\n (errorResponse: ErrorResponse): ThunkAction<> =>\n (dispatch, getState) => {\n const finish = () => {\n dispatch(logoutSuccess());\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message));\n }\n\n const state = getState();\n const location = state.router.location;\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n return dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ?? state.router.location,\n modal: false,\n }),\n );\n }\n\n return dispatch(noAction());\n };\n\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response?.error\n ) {\n // $FlowIssue\n globalThis.location.reload();\n return;\n }\n\n const application = getApplication(getState());\n const shouldReload = Cache.getItem(\"auth\") || application?.isLoggedIn;\n\n return shouldReload ? dispatch(reloadApplication()).then(finish) : finish();\n };\n"],"mappings":";AACA,OAAOA,aAAa,MAAM,kCAAkC;AAE5D,SAASC,OAAO,QAAQ,0BAA0B;AAClD,SAASC,aAAa,QAAQ,WAAW;AAEzC,OAAOC,KAAK,MAAM,2BAA2B;AAE7C,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,QAAQ,EAAEC,iBAAiB,QAAQ,eAAe;AAC3D,SAASC,uBAAuB,QAAQ,UAAU;AAElD,SAASC,UAAU,QAAQ,iBAAiB;AAI5C;AACA;AACA,OAAO,MAAMC,kBAAkB,GAC5BC,aAA4B,IAC7B,CAACC,QAAQ,EAAEC,QAAQ,KAAK;EACtB,MAAMC,MAAM,GAAGA,CAAA,KAAM;IACnBF,QAAQ,CAACV,aAAa,CAAC,CAAC,CAAC;IACzBC,KAAK,CAACY,UAAU,CAAC,MAAM,CAAC;IAExB,IAAIJ,aAAa,CAACK,iBAAiB,EAAE;MACnCJ,QAAQ,CAACJ,uBAAuB,CAACG,aAAa,CAACM,OAAO,CAAC,CAAC;IAC1D;IAEA,MAAMC,KAAK,GAAGL,QAAQ,CAAC,CAAC;IACxB,MAAMM,QAAQ,GAAGD,KAAK,CAACE,MAAM,CAACD,QAAQ;IACtC,MAAME,UAAU,GAAGZ,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC;IAEtD,IAAIU,QAAQ,EAAEG,QAAQ,KAAKD,UAAU,EAAE;MACrC,MAAME,YAAY,GAAGJ,QAAQ,EAAED,KAAK,EAAEM,IAAI;MAC1C,OAAOZ,QAAQ,CACbX,OAAO,CAACoB,UAAU,EAAE;QAClBG,IAAI,EAAED,YAAY,IAAIL,KAAK,CAACE,MAAM,CAACD,QAAQ;QAC3CM,KAAK,EAAE;MACT,CAAC,CACH,CAAC;IACH;IAEA,OAAOb,QAAQ,CAACN,QAAQ,CAAC,CAAC,CAAC;EAC7B,CAAC;EAED,IAAIK,aAAa,CAACe,UAAU,EAAE;IAC5Bd,QAAQ,CAACR,gBAAgB,CAACO,aAAa,CAACe,UAAU,CAAC,CAAC;EACtD;EAEA,IACEjB,UAAU,CAAC,mCAAmC,EAAE,KAAK,CAAC,IACtDE,aAAa,CAACgB,QAAQ,EAAEC,KAAK,EAC7B;IACA;IACAC,WAAA,CAAWV,QAAQ,CAACW,MAAM,CAAC,CAAC;IAC5B;EACF;EAEA,MAAMC,WAAW,GAAG1B,cAAc,CAACQ,QAAQ,CAAC,CAAC,CAAC;EAC9C,MAAMmB,YAAY,GAAG7B,KAAK,CAAC8B,OAAO,CAAC,MAAM,CAAC,IAAIF,WAAW,EAAEG,UAAU;EAErE,OAAOF,YAAY,GAAGpB,QAAQ,CAACL,iBAAiB,CAAC,CAAC,CAAC,CAAC4B,IAAI,CAACrB,MAAM,CAAC,GAAGA,MAAM,CAAC,CAAC;AAC7E,CAAC","ignoreList":[]}
|
|
@@ -68,9 +68,9 @@ export const setThemePreference = configTheme => {
|
|
|
68
68
|
*/
|
|
69
69
|
export const setAllContentInDataSetting = state => {
|
|
70
70
|
let allContentInDataSetting = false;
|
|
71
|
-
if (typeof preferencesProvider
|
|
71
|
+
if (typeof preferencesProvider?.getModularUIContentInData === "function") {
|
|
72
72
|
allContentInDataSetting = preferencesProvider.getModularUIContentInData();
|
|
73
|
-
} else if (typeof state
|
|
73
|
+
} else if (typeof state?.preferences == "object") {
|
|
74
74
|
allContentInDataSetting = state.preferences[ALL_CONTENT_IN_DATA_SETTING];
|
|
75
75
|
}
|
|
76
76
|
setSetting(ALL_CONTENT_IN_DATA_SETTING, !!allContentInDataSetting);
|
|
@@ -82,9 +82,9 @@ export const setAllContentInDataSetting = state => {
|
|
|
82
82
|
*/
|
|
83
83
|
export const setDateTimeSettings = state => {
|
|
84
84
|
let isIncludeTimeOffsetInDateTimes = false;
|
|
85
|
-
if (typeof preferencesProvider
|
|
85
|
+
if (typeof preferencesProvider?.isIncludeTimeOffsetInDateTimes === "function") {
|
|
86
86
|
isIncludeTimeOffsetInDateTimes = preferencesProvider.isIncludeTimeOffsetInDateTimes();
|
|
87
|
-
} else if (typeof state
|
|
87
|
+
} else if (typeof state?.preferences === "object") {
|
|
88
88
|
isIncludeTimeOffsetInDateTimes = state.preferences[INCLUDE_TIME_OFFSET];
|
|
89
89
|
}
|
|
90
90
|
setSetting(INCLUDE_TIME_OFFSET, !!isIncludeTimeOffsetInDateTimes);
|
|
@@ -27,7 +27,7 @@ const getServerPreferenceValue = (
|
|
|
27
27
|
preferenceName: string,
|
|
28
28
|
defaultValue: PreferenceValue = null,
|
|
29
29
|
type?: string,
|
|
30
|
-
) => {
|
|
30
|
+
): PreferenceValue => {
|
|
31
31
|
let value: PreferenceValue = null;
|
|
32
32
|
if (typeof preferencesProvider !== "undefined") {
|
|
33
33
|
value = preferencesProvider.getPreferenceByName(preferenceName);
|
|
@@ -41,7 +41,7 @@ const getServerPreferenceValue = (
|
|
|
41
41
|
value = value.split(",").map((val) => val.trim());
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
return value;
|
|
44
|
+
return (value: PreferenceValue);
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -104,12 +104,9 @@ export const setAllContentInDataSetting = (
|
|
|
104
104
|
): SetPreferenceAction => {
|
|
105
105
|
let allContentInDataSetting: PreferenceValue = false;
|
|
106
106
|
|
|
107
|
-
if (
|
|
108
|
-
typeof preferencesProvider !== "undefined" &&
|
|
109
|
-
typeof preferencesProvider.getModularUIContentInData !== "undefined"
|
|
110
|
-
) {
|
|
107
|
+
if (typeof preferencesProvider?.getModularUIContentInData === "function") {
|
|
111
108
|
allContentInDataSetting = preferencesProvider.getModularUIContentInData();
|
|
112
|
-
} else if (typeof state
|
|
109
|
+
} else if (typeof state?.preferences == "object") {
|
|
113
110
|
allContentInDataSetting = state.preferences[ALL_CONTENT_IN_DATA_SETTING];
|
|
114
111
|
}
|
|
115
112
|
|
|
@@ -125,12 +122,11 @@ export const setDateTimeSettings = (
|
|
|
125
122
|
): SetPreferenceAction => {
|
|
126
123
|
let isIncludeTimeOffsetInDateTimes: PreferenceValue = false;
|
|
127
124
|
if (
|
|
128
|
-
typeof preferencesProvider
|
|
129
|
-
typeof preferencesProvider.isIncludeTimeOffsetInDateTimes !== "undefined"
|
|
125
|
+
typeof preferencesProvider?.isIncludeTimeOffsetInDateTimes === "function"
|
|
130
126
|
) {
|
|
131
127
|
isIncludeTimeOffsetInDateTimes =
|
|
132
128
|
preferencesProvider.isIncludeTimeOffsetInDateTimes();
|
|
133
|
-
} else if (typeof state
|
|
129
|
+
} else if (typeof state?.preferences === "object") {
|
|
134
130
|
isIncludeTimeOffsetInDateTimes = state.preferences[INCLUDE_TIME_OFFSET];
|
|
135
131
|
}
|
|
136
132
|
|