@beinformed/ui 1.33.0 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/esm/react-client/client.js +30 -2
- package/esm/react-client/client.js.map +1 -1
- package/lib/react-client/client.js +28 -0
- package/lib/react-client/client.js.flow +30 -2
- package/lib/react-client/client.js.map +1 -1
- package/package.json +16 -16
- package/src/react-client/client.js +30 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.34.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.33.0...v1.34.0) (2023-09-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **redirectUri:** the redirectURI to a secure page is now handled through the UI library ([cc54f8e](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/cc54f8e5d436d2c14e6f50dd3793ac074a8dcc2f))
|
|
11
|
+
|
|
5
12
|
## [1.33.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.33.0-beta.7...v1.33.0) (2023-08-29)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
|
|
2
|
+
import _URLSearchParams from "@babel/runtime-corejs3/core-js-stable/url-search-params";
|
|
2
3
|
// eslint-disable-next-line react/no-deprecated
|
|
3
4
|
import { hydrate, render } from "react-dom";
|
|
4
5
|
import { has } from "../utils/helpers/objects";
|
|
5
6
|
import setImmediate from "setimmediate";
|
|
6
7
|
import Cache from "../utils/browser/Cache";
|
|
8
|
+
import xhr from "../utils/fetch/xhr";
|
|
7
9
|
import { createBrowserHistory } from "history";
|
|
8
10
|
import configureStore from "../redux/store/configureStore";
|
|
9
11
|
import rehydrate from "./rehydrate";
|
|
10
|
-
import { getBasePath } from "../constants/Settings";
|
|
12
|
+
import { getBasePath, getSetting } from "../constants/Settings";
|
|
11
13
|
import { setAllContentInDataSetting, setLoginPreferences } from "../redux/actions/Preferences";
|
|
12
14
|
import { showXHRErrorNotification } from "../redux/actions/Notification";
|
|
13
15
|
import { handleError } from "../redux/actions/Error";
|
|
14
16
|
import { loginSuccess } from "../redux/actions/SignIn";
|
|
15
|
-
import { locationChange } from "../redux/_router/RouterActions";
|
|
17
|
+
import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
16
18
|
import { JsonParseException, FetchException } from "../exceptions";
|
|
17
19
|
import { Init } from "./Init";
|
|
18
20
|
import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
|
|
21
|
+
import UnauthorizedException from "../exceptions/UnauthorizedException";
|
|
19
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
23
|
/*
|
|
21
24
|
* deserialize serialized data from the server to provide a smooth dehydration.
|
|
@@ -53,6 +56,30 @@ export const setUnhandledRejectionEvent = store => {
|
|
|
53
56
|
};
|
|
54
57
|
};
|
|
55
58
|
|
|
59
|
+
/**
|
|
60
|
+
* The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link
|
|
61
|
+
* @param store
|
|
62
|
+
*/
|
|
63
|
+
const handleRedirectURI = store => {
|
|
64
|
+
const urlParams = new _URLSearchParams(window.location.search);
|
|
65
|
+
const redirectURI = urlParams.get("redirectURI");
|
|
66
|
+
if (redirectURI) {
|
|
67
|
+
xhr({
|
|
68
|
+
url: `${getBasePath()}${redirectURI}`
|
|
69
|
+
}).catch(e => {
|
|
70
|
+
if (e instanceof UnauthorizedException) {
|
|
71
|
+
const LOGIN_PATH = getSetting("LOGIN_PATH", "/signin");
|
|
72
|
+
store.dispatch(replace(LOGIN_PATH, {
|
|
73
|
+
from: {
|
|
74
|
+
pathname: redirectURI
|
|
75
|
+
},
|
|
76
|
+
modal: false
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
56
83
|
/**
|
|
57
84
|
*/
|
|
58
85
|
export const setupClient = function () {
|
|
@@ -74,6 +101,7 @@ export const setupClient = function () {
|
|
|
74
101
|
routerHistory,
|
|
75
102
|
store
|
|
76
103
|
} = configureStore(browserHistory, customReducers, rehydrate(data));
|
|
104
|
+
handleRedirectURI(store);
|
|
77
105
|
setAllContentInDataSetting(store.getState());
|
|
78
106
|
setLoginPreferences(store.getState());
|
|
79
107
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["hydrate","render","has","setImmediate","Cache","createBrowserHistory","configureStore","rehydrate","getBasePath","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","locationChange","JsonParseException","FetchException","Init","handleBeforeRenderHooks","jsx","_jsx","parseDataToJSON","data","JSON","parse","error","getDataFromServer","_context","dataElement","document","querySelector","Error","_trimInstanceProperty","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","getState","loadOtherBrowserTabs","getItem","response","listen","location","action","body","className","addContentLoadedEvent","theme","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { getBasePath } from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePath(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";AACA;AACA,SAASA,OAAO,EAAEC,MAAM,QAAQ,WAAW;AAE3C,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,YAAY,MAAM,cAAc;AAEvC,OAAOC,KAAK,MAAM,wBAAwB;AAE1C,SAASC,oBAAoB,QAAQ,SAAS;AAC9C,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,WAAW,QAAQ,uBAAuB;AAEnD,SACEC,0BAA0B,EAC1BC,mBAAmB,QACd,8BAA8B;AACrC,SAASC,wBAAwB,QAAQ,+BAA+B;AAExE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,YAAY,QAAQ,yBAAyB;AAEtD,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,eAAe;AAElE,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,uBAAuB,QAAQ,kCAAkC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA2B3E;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,IAAY,IAAK;EACxC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC;EACzB,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,MAAM,IAAIV,kBAA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IAPU;IACrB9B,cAAc;IACdoB,KAAK;IACLlE,MAAM;IACNkD,iBAAiB;IACjBiB,sBAAsB;IACtBC;EACK,CAAC,GAAAQ,IAAA;EACN,MAAM;IAAEzC,KAAK;IAAEoB;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAEDe,qBAAqB,CACnB9B,KAAK,EACLoB,aAAa,EACbW,KAAK,EACLlE,MAAM,EACNmE,sBAAsB,EACtBC,KAAK,IAAII,WACX,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["hydrate","render","has","setImmediate","Cache","xhr","createBrowserHistory","configureStore","rehydrate","getBasePath","getSetting","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","locationChange","replace","JsonParseException","FetchException","Init","handleBeforeRenderHooks","UnauthorizedException","jsx","_jsx","parseDataToJSON","data","JSON","parse","error","getDataFromServer","_context","dataElement","document","querySelector","Error","_trimInstanceProperty","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","handleRedirectURI","urlParams","_URLSearchParams","location","search","redirectURI","get","url","catch","e","LOGIN_PATH","from","pathname","modal","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","getState","loadOtherBrowserTabs","getItem","response","listen","action","body","className","addContentLoadedEvent","theme","ErrorFallbackComponent","mount","addEventListener","applicationNode","children","mountClient","element","isSSR","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { getBasePath, getSetting } from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport UnauthorizedException from \"../exceptions/UnauthorizedException\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePath()}${redirectURI}` }).catch((e) => {\n if (e instanceof UnauthorizedException) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePath(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;AACA;AACA,SAASA,OAAO,EAAEC,MAAM,QAAQ,WAAW;AAE3C,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,YAAY,MAAM,cAAc;AAEvC,OAAOC,KAAK,MAAM,wBAAwB;AAE1C,OAAOC,GAAG,MAAM,oBAAoB;AAEpC,SAASC,oBAAoB,QAAQ,SAAS;AAC9C,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,WAAW,EAAEC,UAAU,QAAQ,uBAAuB;AAE/D,SACEC,0B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AAO,MAAMK,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB7B,cAAc;IACdmB,KAAK;IACLnF,MAAM;IACNoE,iBAAiB;IACjBgB,sBAAsB;IACtBC;EACK,CAAC,GAAAQ,IAAA;EACN,MAAM;IAAEtD,KAAK;IAAEkC;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAEDc,qBAAqB,CACnB3C,KAAK,EACLkC,aAAa,EACbU,KAAK,EACLnF,MAAM,EACNoF,sBAAsB,EACtBC,KAAK,IAAII,WACX,CAAC;AACH,CAAC"}
|
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.setupClient = exports.setUnhandledRejectionEvent = exports.client = exports.addContentLoadedEvent = void 0;
|
|
8
8
|
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
|
9
|
+
var _urlSearchParams = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/url-search-params"));
|
|
9
10
|
var _reactDom = require("react-dom");
|
|
10
11
|
var _objects = require("../utils/helpers/objects");
|
|
11
12
|
var _setimmediate = _interopRequireDefault(require("setimmediate"));
|
|
12
13
|
var _Cache = _interopRequireDefault(require("../utils/browser/Cache"));
|
|
14
|
+
var _xhr = _interopRequireDefault(require("../utils/fetch/xhr"));
|
|
13
15
|
var _history = require("history");
|
|
14
16
|
var _configureStore = _interopRequireDefault(require("../redux/store/configureStore"));
|
|
15
17
|
var _rehydrate = _interopRequireDefault(require("./rehydrate"));
|
|
@@ -22,6 +24,7 @@ var _RouterActions = require("../redux/_router/RouterActions");
|
|
|
22
24
|
var _exceptions = require("../exceptions");
|
|
23
25
|
var _Init = require("./Init");
|
|
24
26
|
var _beforeRenderHooks = require("../redux/store/beforeRenderHooks");
|
|
27
|
+
var _UnauthorizedException = _interopRequireDefault(require("../exceptions/UnauthorizedException"));
|
|
25
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
29
|
// eslint-disable-next-line react/no-deprecated
|
|
27
30
|
/*
|
|
@@ -61,8 +64,32 @@ const setUnhandledRejectionEvent = store => {
|
|
|
61
64
|
};
|
|
62
65
|
|
|
63
66
|
/**
|
|
67
|
+
* The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link
|
|
68
|
+
* @param store
|
|
64
69
|
*/
|
|
65
70
|
exports.setUnhandledRejectionEvent = setUnhandledRejectionEvent;
|
|
71
|
+
const handleRedirectURI = store => {
|
|
72
|
+
const urlParams = new _urlSearchParams.default(window.location.search);
|
|
73
|
+
const redirectURI = urlParams.get("redirectURI");
|
|
74
|
+
if (redirectURI) {
|
|
75
|
+
(0, _xhr.default)({
|
|
76
|
+
url: `${(0, _Settings.getBasePath)()}${redirectURI}`
|
|
77
|
+
}).catch(e => {
|
|
78
|
+
if (e instanceof _UnauthorizedException.default) {
|
|
79
|
+
const LOGIN_PATH = (0, _Settings.getSetting)("LOGIN_PATH", "/signin");
|
|
80
|
+
store.dispatch((0, _RouterActions.replace)(LOGIN_PATH, {
|
|
81
|
+
from: {
|
|
82
|
+
pathname: redirectURI
|
|
83
|
+
},
|
|
84
|
+
modal: false
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
*/
|
|
66
93
|
const setupClient = function () {
|
|
67
94
|
let customReducers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
68
95
|
let beforeRenderHooks = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -82,6 +109,7 @@ const setupClient = function () {
|
|
|
82
109
|
routerHistory,
|
|
83
110
|
store
|
|
84
111
|
} = (0, _configureStore.default)(browserHistory, customReducers, (0, _rehydrate.default)(data));
|
|
112
|
+
handleRedirectURI(store);
|
|
85
113
|
(0, _Preferences.setAllContentInDataSetting)(store.getState());
|
|
86
114
|
(0, _Preferences.setLoginPreferences)(store.getState());
|
|
87
115
|
|
|
@@ -7,11 +7,13 @@ import setImmediate from "setimmediate";
|
|
|
7
7
|
|
|
8
8
|
import Cache from "../utils/browser/Cache";
|
|
9
9
|
|
|
10
|
+
import xhr from "../utils/fetch/xhr";
|
|
11
|
+
|
|
10
12
|
import { createBrowserHistory } from "history";
|
|
11
13
|
import configureStore from "../redux/store/configureStore";
|
|
12
14
|
|
|
13
15
|
import rehydrate from "./rehydrate";
|
|
14
|
-
import { getBasePath } from "../constants/Settings";
|
|
16
|
+
import { getBasePath, getSetting } from "../constants/Settings";
|
|
15
17
|
|
|
16
18
|
import {
|
|
17
19
|
setAllContentInDataSetting,
|
|
@@ -22,7 +24,7 @@ import { showXHRErrorNotification } from "../redux/actions/Notification";
|
|
|
22
24
|
import { handleError } from "../redux/actions/Error";
|
|
23
25
|
import { loginSuccess } from "../redux/actions/SignIn";
|
|
24
26
|
|
|
25
|
-
import { locationChange } from "../redux/_router/RouterActions";
|
|
27
|
+
import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
26
28
|
|
|
27
29
|
import { JsonParseException, FetchException } from "../exceptions";
|
|
28
30
|
|
|
@@ -30,6 +32,8 @@ import { Init } from "./Init";
|
|
|
30
32
|
|
|
31
33
|
import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
|
|
32
34
|
|
|
35
|
+
import UnauthorizedException from "../exceptions/UnauthorizedException";
|
|
36
|
+
|
|
33
37
|
import type {
|
|
34
38
|
ComponentType,
|
|
35
39
|
Element as ReactElement,
|
|
@@ -97,6 +101,28 @@ export const setUnhandledRejectionEvent = (store: ReduxStore) => {
|
|
|
97
101
|
};
|
|
98
102
|
};
|
|
99
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link
|
|
106
|
+
* @param store
|
|
107
|
+
*/
|
|
108
|
+
const handleRedirectURI = (store: ReduxStore) => {
|
|
109
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
110
|
+
const redirectURI = urlParams.get("redirectURI");
|
|
111
|
+
if (redirectURI) {
|
|
112
|
+
xhr({ url: `${getBasePath()}${redirectURI}` }).catch((e) => {
|
|
113
|
+
if (e instanceof UnauthorizedException) {
|
|
114
|
+
const LOGIN_PATH = getSetting("LOGIN_PATH", "/signin");
|
|
115
|
+
store.dispatch(
|
|
116
|
+
replace(LOGIN_PATH, {
|
|
117
|
+
from: { pathname: redirectURI },
|
|
118
|
+
modal: false,
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
100
126
|
/**
|
|
101
127
|
*/
|
|
102
128
|
export const setupClient = (
|
|
@@ -122,6 +148,8 @@ export const setupClient = (
|
|
|
122
148
|
rehydrate(data),
|
|
123
149
|
);
|
|
124
150
|
|
|
151
|
+
handleRedirectURI(store);
|
|
152
|
+
|
|
125
153
|
setAllContentInDataSetting(store.getState());
|
|
126
154
|
setLoginPreferences(store.getState());
|
|
127
155
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["_reactDom","require","_objects","_setimmediate","_interopRequireDefault","_Cache","_history","_configureStore","_rehydrate","_Settings","_Preferences","_Notification","_Error","_SignIn","_RouterActions","_exceptions","_Init","_beforeRenderHooks","_jsxRuntime","parseDataToJSON","data","JSON","parse","error","JsonParseException","getDataFromServer","_context","dataElement","document","querySelector","Error","_trim","default","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","dispatch","showXHRErrorNotification","exports","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","Cache","clear","browserHistory","createBrowserHistory","basename","getBasePath","routerHistory","configureStore","rehydrate","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","getItem","loginSuccess","has","FetchException","response","handleError","listen","location","action","locationChange","body","className","handleBeforeRenderHooks","addContentLoadedEvent","theme","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","jsx","Init","children","mountClient","element","isSSR","hydrate","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { getBasePath } from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePath(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;;;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAH,sBAAA,CAAAH,OAAA;AAEA,IAAAO,UAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAEA,IAAAS,YAAA,GAAAT,OAAA;AAIA,IAAAU,aAAA,GAAAV,OAAA;AAEA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY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;MACHtD,KAAK,EAAEA,KAAM;MACb0B,aAAa,EAAEA,aAAc;MAC7BP,WAAW,EAAElB,MAAM,CAACkB,WAAY;MAChC4B,KAAK,EAAEA,KAAM;MACbE,sBAAsB,EAAEA,sBAAuB;MAAAM,QAAA,EAE9CP,MAAM,CAAC;IAAC,CACL,CACR,CAAC;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AADApC,OAAA,CAAAkC,qBAAA,GAAAA,qBAAA;AAEA,MAAMU,WAAW,GAAGA,CAClBJ,eAAwB,EACxBK,OAAkC,KAC/B;EACH,MAAMC,KAAK,GAAGN,eAAe,CAAC3D,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAIiE,KAAK,EAAE;IACT,IAAAC,iBAAO,EAACF,OAAO,EAAEL,eAAe,CAAC;EACnC,CAAC,MAAM;IACL,IAAAJ,gBAAM,EAACS,OAAO,EAAEL,eAAe,CAAC;EAClC;AACF,CAAC;;AAED;AACA;AACA;AACO,MAAMQ,MAAM,GAAGC,IAAA,IAOT;EAAA,IAPU;IACrB/C,cAAc;IACdiC,KAAK;IACLC,MAAM;IACN9B,iBAAiB;IACjB+B,sBAAsB;IACtBC;EACK,CAAC,GAAAW,IAAA;EACN,MAAM;IAAE7D,KAAK;IAAE0B;EAAc,CAAC,GAAGb,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAED4B,qBAAqB,CACnB9C,KAAK,EACL0B,aAAa,EACbqB,KAAK,EACLC,MAAM,EACNC,sBAAsB,EACtBC,KAAK,IAAIM,WACX,CAAC;AACH,CAAC;AAAC5C,OAAA,CAAAgD,MAAA,GAAAA,MAAA"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["_reactDom","require","_objects","_setimmediate","_interopRequireDefault","_Cache","_xhr","_history","_configureStore","_rehydrate","_Settings","_Preferences","_Notification","_Error","_SignIn","_RouterActions","_exceptions","_Init","_beforeRenderHooks","_UnauthorizedException","_jsxRuntime","parseDataToJSON","data","JSON","parse","error","JsonParseException","getDataFromServer","_context","dataElement","document","querySelector","Error","_trim","default","textContent","call","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","dispatch","showXHRErrorNotification","exports","handleRedirectURI","urlParams","_urlSearchParams","location","search","redirectURI","get","xhr","url","getBasePath","catch","e","UnauthorizedException","LOGIN_PATH","getSetting","replace","from","pathname","modal","setupClient","customReducers","arguments","length","undefined","beforeRenderHooks","contextPath","Cache","clear","browserHistory","createBrowserHistory","basename","routerHistory","configureStore","rehydrate","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","getItem","loginSuccess","has","FetchException","response","handleError","listen","action","locationChange","body","className","handleBeforeRenderHooks","addContentLoadedEvent","theme","render","ErrorFallbackComponent","mount","addEventListener","applicationNode","jsx","Init","children","mountClient","element","isSSR","hydrate","client","_ref"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, render } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { getBasePath, getSetting } from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange, replace } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport { Init } from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport UnauthorizedException from \"../exceptions/UnauthorizedException\";\n\nimport type {\n ComponentType,\n Element as ReactElement,\n ElementType,\n} from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype RenderFunction = () => ReactElement<ElementType>;\ntype MountFunction = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => void;\ntype Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n mount: MountFunction,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\nconst getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return {};\n }\n\n return parseDataToJSON(dataElement.textContent);\n};\n\n/**\n */\nexport const setUnhandledRejectionEvent = (store: ReduxStore) => {\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n};\n\n/**\n * The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link\n * @param store\n */\nconst handleRedirectURI = (store: ReduxStore) => {\n const urlParams = new URLSearchParams(window.location.search);\n const redirectURI = urlParams.get(\"redirectURI\");\n if (redirectURI) {\n xhr({ url: `${getBasePath()}${redirectURI}` }).catch((e) => {\n if (e instanceof UnauthorizedException) {\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n store.dispatch(\n replace(LOGIN_PATH, {\n from: { pathname: redirectURI },\n modal: false,\n }),\n );\n }\n });\n }\n};\n\n/**\n */\nexport const setupClient = (\n customReducers: CustomReducers = {},\n beforeRenderHooks: ?Array<BeforeRenderHook>,\n): { store: ReduxStore, routerHistory: RouterHistory } => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const data = getDataFromServer();\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePath(),\n });\n const { routerHistory, store } = configureStore(\n browserHistory,\n customReducers,\n rehydrate(data),\n );\n\n handleRedirectURI(store);\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data?.error?.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n routerHistory.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n setUnhandledRejectionEvent(store);\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (beforeRenderHooks) {\n handleBeforeRenderHooks(beforeRenderHooks, { store });\n }\n\n return { store, routerHistory };\n};\n\n/**\n */\nexport const addContentLoadedEvent = (\n store: ReduxStore,\n routerHistory: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: RenderFunction,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: MountFunction,\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (!applicationNode) {\n throw new Error(\n \"No DOM element with id application found to attach client to\",\n );\n }\n\n mount(\n applicationNode,\n <Init\n store={store}\n routerHistory={routerHistory}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n );\n });\n};\n\n/**\n */\nconst mountClient = (\n applicationNode: Element,\n element: ReactElement<ElementType>,\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(element, applicationNode);\n } else {\n render(element, applicationNode);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.\n */\nexport const client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n mount,\n}: Props) => {\n const { store, routerHistory } = setupClient(\n customReducers,\n beforeRenderHooks,\n );\n\n addContentLoadedEvent(\n store,\n routerHistory,\n theme,\n render,\n ErrorFallbackComponent,\n mount ?? mountClient,\n );\n};\n"],"mappings":";;;;;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,IAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAEA,IAAAQ,UAAA,GAAAL,sBAAA,CAAAH,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAEA,IAAAU,YAAA,GAAAV,OAAA;AAIA,IAAAW,aAAA,GAAAX,OAAA;AAEA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AAEA,IAAAc,cAAA,GAAAd,OAAA;AAEA,IAAAe,WAAA,GAAAf,OAAA;AAEA,IAAAgB,KAAA,GAAAhB,OAAA;AAEA,IAAAiB,kBAAA,GAAAjB,OAAA;AAEA,IAAAkB,sBAAA,GAAAf,sBAAA,CAAAH,OAAA;AAAwE,IAAAmB,WAAA,GAAAnB,OAAA;AAjCxE;AA4DA;AACA;AACA;AACA,M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B6B,sBAAsB;IACtBC;EACK,CAAC,GAAAW,IAAA;EACN,MAAM;IAAE9E,KAAK;IAAE4C;EAAc,CAAC,GAAGZ,WAAW,CAC1CC,cAAc,EACdI,iBACF,CAAC;EAED0B,qBAAqB,CACnB/D,KAAK,EACL4C,aAAa,EACboB,KAAK,EACLC,MAAM,EACNC,sBAAsB,EACtBC,KAAK,IAAIM,WACX,CAAC;AACH,CAAC;AAAC7D,OAAA,CAAAiE,MAAA,GAAAA,MAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -82,13 +82,14 @@
|
|
|
82
82
|
"styled-components": "^5.0.0"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@babel/runtime-corejs3": "^7.22.
|
|
85
|
+
"@babel/runtime-corejs3": "^7.22.15",
|
|
86
86
|
"big.js": "^6.2.1",
|
|
87
87
|
"date-fns": "^2.30.0",
|
|
88
88
|
"deepmerge": "^4.3.1",
|
|
89
89
|
"dequal": "^2.0.3",
|
|
90
90
|
"file-size": "^1.0.0",
|
|
91
91
|
"format-message": "^6.2.4",
|
|
92
|
+
"glob": "^10.3.4",
|
|
92
93
|
"html-entities": "^2.4.0",
|
|
93
94
|
"iban": "^0.0.14",
|
|
94
95
|
"js-cookie": "^3.0.5",
|
|
@@ -98,50 +99,49 @@
|
|
|
98
99
|
"setimmediate": "^1.0.5"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
|
-
"@babel/cli": "^7.22.
|
|
102
|
-
"@babel/core": "^7.22.
|
|
103
|
-
"@babel/eslint-parser": "^7.22.
|
|
102
|
+
"@babel/cli": "^7.22.15",
|
|
103
|
+
"@babel/core": "^7.22.17",
|
|
104
|
+
"@babel/eslint-parser": "^7.22.15",
|
|
104
105
|
"@babel/eslint-plugin": "^7.22.10",
|
|
105
106
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
106
107
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
107
|
-
"@babel/plugin-transform-runtime": "^7.22.
|
|
108
|
-
"@babel/preset-env": "^7.22.
|
|
109
|
-
"@babel/preset-flow": "^7.22.
|
|
110
|
-
"@babel/preset-react": "^7.22.
|
|
108
|
+
"@babel/plugin-transform-runtime": "^7.22.15",
|
|
109
|
+
"@babel/preset-env": "^7.22.15",
|
|
110
|
+
"@babel/preset-flow": "^7.22.15",
|
|
111
|
+
"@babel/preset-react": "^7.22.15",
|
|
111
112
|
"@commitlint/cli": "^17.7.1",
|
|
112
113
|
"@commitlint/config-conventional": "^17.7.0",
|
|
113
114
|
"@testing-library/react": "^14.0.0",
|
|
114
115
|
"auditjs": "^4.0.41",
|
|
115
|
-
"babel-jest": "^29.
|
|
116
|
+
"babel-jest": "^29.7.0",
|
|
116
117
|
"babel-plugin-styled-components": "^2.1.4",
|
|
117
118
|
"cherry-pick": "^0.5.0",
|
|
118
119
|
"commit-and-tag-version": "^11.2.3",
|
|
119
120
|
"cross-env": "^7.0.3",
|
|
120
121
|
"documentation": "^14.0.2",
|
|
121
|
-
"eslint": "^8.
|
|
122
|
+
"eslint": "^8.49.0",
|
|
122
123
|
"eslint-config-prettier": "^9.0.0",
|
|
123
124
|
"eslint-plugin-babel": "^5.3.1",
|
|
124
125
|
"eslint-plugin-ft-flow": "^3.0.0",
|
|
125
126
|
"eslint-plugin-import": "^2.28.1",
|
|
126
127
|
"eslint-plugin-jest": "^27.2.3",
|
|
127
|
-
"eslint-plugin-jsdoc": "^46.
|
|
128
|
+
"eslint-plugin-jsdoc": "^46.6.0",
|
|
128
129
|
"eslint-plugin-react": "^7.33.2",
|
|
129
130
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
130
131
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
|
|
131
132
|
"flow-bin": "^0.200.1",
|
|
132
133
|
"flow-copy-source": "^2.0.9",
|
|
133
134
|
"flow-typed": "^3.9.0",
|
|
134
|
-
"glob": "^10.3.3",
|
|
135
135
|
"history": "^4.0.0",
|
|
136
136
|
"husky": "^8.0.3",
|
|
137
|
-
"jest": "^29.
|
|
138
|
-
"jest-environment-jsdom": "^29.
|
|
137
|
+
"jest": "^29.7.0",
|
|
138
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
139
139
|
"jest-junit": "^16.0.0",
|
|
140
140
|
"jest-sonar-reporter": "^2.0.0",
|
|
141
141
|
"jscodeshift": "^0.15.0",
|
|
142
142
|
"lint-staged": "^13.2.3",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
|
-
"prettier": "^3.0.
|
|
144
|
+
"prettier": "^3.0.3",
|
|
145
145
|
"react": "^18.0.0",
|
|
146
146
|
"react-dom": "^18.0.0",
|
|
147
147
|
"react-helmet-async": "^1.0.0",
|
|
@@ -7,11 +7,13 @@ import setImmediate from "setimmediate";
|
|
|
7
7
|
|
|
8
8
|
import Cache from "../utils/browser/Cache";
|
|
9
9
|
|
|
10
|
+
import xhr from "../utils/fetch/xhr";
|
|
11
|
+
|
|
10
12
|
import { createBrowserHistory } from "history";
|
|
11
13
|
import configureStore from "../redux/store/configureStore";
|
|
12
14
|
|
|
13
15
|
import rehydrate from "./rehydrate";
|
|
14
|
-
import { getBasePath } from "../constants/Settings";
|
|
16
|
+
import { getBasePath, getSetting } from "../constants/Settings";
|
|
15
17
|
|
|
16
18
|
import {
|
|
17
19
|
setAllContentInDataSetting,
|
|
@@ -22,7 +24,7 @@ import { showXHRErrorNotification } from "../redux/actions/Notification";
|
|
|
22
24
|
import { handleError } from "../redux/actions/Error";
|
|
23
25
|
import { loginSuccess } from "../redux/actions/SignIn";
|
|
24
26
|
|
|
25
|
-
import { locationChange } from "../redux/_router/RouterActions";
|
|
27
|
+
import { locationChange, replace } from "../redux/_router/RouterActions";
|
|
26
28
|
|
|
27
29
|
import { JsonParseException, FetchException } from "../exceptions";
|
|
28
30
|
|
|
@@ -30,6 +32,8 @@ import { Init } from "./Init";
|
|
|
30
32
|
|
|
31
33
|
import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
|
|
32
34
|
|
|
35
|
+
import UnauthorizedException from "../exceptions/UnauthorizedException";
|
|
36
|
+
|
|
33
37
|
import type {
|
|
34
38
|
ComponentType,
|
|
35
39
|
Element as ReactElement,
|
|
@@ -97,6 +101,28 @@ export const setUnhandledRejectionEvent = (store: ReduxStore) => {
|
|
|
97
101
|
};
|
|
98
102
|
};
|
|
99
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The redirectURI querystring parameter is available when the server is redirecting an unauthorized deep link
|
|
106
|
+
* @param store
|
|
107
|
+
*/
|
|
108
|
+
const handleRedirectURI = (store: ReduxStore) => {
|
|
109
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
110
|
+
const redirectURI = urlParams.get("redirectURI");
|
|
111
|
+
if (redirectURI) {
|
|
112
|
+
xhr({ url: `${getBasePath()}${redirectURI}` }).catch((e) => {
|
|
113
|
+
if (e instanceof UnauthorizedException) {
|
|
114
|
+
const LOGIN_PATH = getSetting("LOGIN_PATH", "/signin");
|
|
115
|
+
store.dispatch(
|
|
116
|
+
replace(LOGIN_PATH, {
|
|
117
|
+
from: { pathname: redirectURI },
|
|
118
|
+
modal: false,
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
100
126
|
/**
|
|
101
127
|
*/
|
|
102
128
|
export const setupClient = (
|
|
@@ -122,6 +148,8 @@ export const setupClient = (
|
|
|
122
148
|
rehydrate(data),
|
|
123
149
|
);
|
|
124
150
|
|
|
151
|
+
handleRedirectURI(store);
|
|
152
|
+
|
|
125
153
|
setAllContentInDataSetting(store.getState());
|
|
126
154
|
setLoginPreferences(store.getState());
|
|
127
155
|
|