@beinformed/ui 1.28.0 → 1.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/esm/react-client/Init.js +1 -2
- package/esm/react-client/Init.js.map +1 -1
- package/esm/react-client/client.js +2 -3
- package/esm/react-client/client.js.map +1 -1
- package/esm/react-client/index.js +3 -3
- package/esm/react-client/index.js.map +1 -1
- package/lib/react-client/Init.js +2 -3
- package/lib/react-client/Init.js.flow +2 -5
- package/lib/react-client/Init.js.map +1 -1
- package/lib/react-client/client.js +4 -5
- package/lib/react-client/client.js.flow +3 -5
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/index.js +31 -19
- package/lib/react-client/index.js.flow +3 -6
- package/lib/react-client/index.js.map +1 -1
- package/package.json +1 -1
- package/src/react-client/Init.js +2 -5
- package/src/react-client/client.js +3 -5
- package/src/react-client/index.js +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
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.28.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.28.1...v1.28.2) (2023-02-20)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **export:** make all parts of react-client importable ([7d571e1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/7d571e1b350fda26e546ea67a0ee633e7d8d8f1d))
|
|
10
|
+
|
|
11
|
+
## [1.28.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.28.0...v1.28.1) (2023-02-20)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- **export:** make all parts of react-client importable ([11c4465](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/11c446547c576385644fc8519350c33fd517e009))
|
|
16
|
+
|
|
5
17
|
## [1.28.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.27.6...v1.28.0) (2023-02-20)
|
|
6
18
|
|
|
7
19
|
### Features
|
package/esm/react-client/Init.js
CHANGED
|
@@ -6,7 +6,7 @@ import ErrorBoundary from "../react/ErrorBoundary";
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
/**
|
|
8
8
|
*/
|
|
9
|
-
const Init = _ref => {
|
|
9
|
+
export const Init = _ref => {
|
|
10
10
|
let {
|
|
11
11
|
store,
|
|
12
12
|
routerHistory,
|
|
@@ -33,5 +33,4 @@ const Init = _ref => {
|
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
Init.displayName = "BI.Init";
|
|
36
|
-
export default Init;
|
|
37
36
|
//# sourceMappingURL=Init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Init.js","names":["Provider","HelmetProvider","Router","ThemeProvider","ErrorBoundary","Init","store","routerHistory","contextPath","theme","children","ErrorFallbackComponent","displayName"],"sources":["../../src/react-client/Init.js"],"sourcesContent":["// @flow\nimport { Provider } from \"react-redux\";\nimport { HelmetProvider } from \"react-helmet-async\";\nimport { Router } from \"react-router\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { RouterHistory } from \"react-router\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\
|
|
1
|
+
{"version":3,"file":"Init.js","names":["Provider","HelmetProvider","Router","ThemeProvider","ErrorBoundary","Init","store","routerHistory","contextPath","theme","children","ErrorFallbackComponent","displayName"],"sources":["../../src/react-client/Init.js"],"sourcesContent":["// @flow\nimport { Provider } from \"react-redux\";\nimport { HelmetProvider } from \"react-helmet-async\";\nimport { Router } from \"react-router\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { RouterHistory } from \"react-router\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype Props = {\n +store: ReduxStore,\n +routerHistory: RouterHistory,\n +contextPath: string,\n +theme?: Theme | Array<Theme>,\n +children: ?Node,\n +ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/**\n */\nexport const Init = ({\n store,\n routerHistory,\n contextPath,\n theme,\n children,\n ErrorFallbackComponent,\n}: Props): Node => (\n <Provider store={store}>\n <ThemeProvider theme={theme}>\n <HelmetProvider>\n <ErrorBoundary FallbackComponent={ErrorFallbackComponent}>\n <Router history={routerHistory} basename={contextPath}>\n {children}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </Provider>\n);\nInit.displayName = \"BI.Init\";\n"],"mappings":"AACA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,MAAM,QAAQ,cAAc;AAErC,OAAOC,aAAa,MAAM,8BAA8B;AACxD,OAAOC,aAAa,MAAM,wBAAwB;AAAC;AAiBnD;AACA;AACA,OAAO,MAAMC,IAAI,GAAG;EAAA,IAAC;IACnBC,KAAK;IACLC,aAAa;IACbC,WAAW;IACXC,KAAK;IACLC,QAAQ;IACRC;EACK,CAAC;EAAA,oBACN,KAAC,QAAQ;IAAC,KAAK,EAAEL,KAAM;IAAA,uBACrB,KAAC,aAAa;MAAC,KAAK,EAAEG,KAAM;MAAA,uBAC1B,KAAC,cAAc;QAAA,uBACb,KAAC,aAAa;UAAC,iBAAiB,EAAEE,sBAAuB;UAAA,uBACvD,KAAC,MAAM;YAAC,OAAO,EAAEJ,aAAc;YAAC,QAAQ,EAAEC,WAAY;YAAA,UACnDE;UAAQ;QACF;MACK;IACD;EACH,EACP;AAAA,CACZ;AACDL,IAAI,CAACO,WAAW,GAAG,SAAS"}
|
|
@@ -13,7 +13,7 @@ import { handleError } from "../redux/actions/Error";
|
|
|
13
13
|
import { loginSuccess } from "../redux/actions/SignIn";
|
|
14
14
|
import { locationChange } from "../redux/_router/RouterActions";
|
|
15
15
|
import { JsonParseException, FetchException } from "../exceptions";
|
|
16
|
-
import Init from "./Init";
|
|
16
|
+
import { Init } from "./Init";
|
|
17
17
|
import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
/*
|
|
@@ -142,7 +142,7 @@ const mountClient = (applicationNode, initComponent) => {
|
|
|
142
142
|
/**
|
|
143
143
|
* Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.
|
|
144
144
|
*/
|
|
145
|
-
const client = _ref => {
|
|
145
|
+
export const client = _ref => {
|
|
146
146
|
let {
|
|
147
147
|
customReducers,
|
|
148
148
|
theme,
|
|
@@ -156,5 +156,4 @@ const client = _ref => {
|
|
|
156
156
|
} = setupClient(customReducers, beforeRenderHooks);
|
|
157
157
|
addContentLoadedEvent(store, routerHistory, theme, render, ErrorFallbackComponent, mountClient);
|
|
158
158
|
};
|
|
159
|
-
export default client;
|
|
160
159
|
//# sourceMappingURL=client.js.map
|
|
@@ -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","parseDataToJSON","data","JSON","parse","error","getDataFromServer","dataElement","document","querySelector","Error","textContent","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","setupClient","customReducers","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","getState","loadOtherBrowserTabs","getItem","response","listen","location","action","body","className","addContentLoadedEvent","theme","ErrorFallbackComponent","mount","addEventListener","applicationNode","mountClient","initComponent","isSSR","client"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\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\nexport type Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\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: Function,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: Function\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 initComponent: ReactElement<ElementType>\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(initComponent, applicationNode);\n } else {\n render(initComponent, 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 */\nconst client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\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 mountClient\n );\n};\n\nexport default client;\n"],"mappings":";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,S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,GAAG,QAMF;EAAA,IANG;IACdzB,cAAc;IACdiB,KAAK;IACL1D,MAAM;IACN0C,iBAAiB;IACjBiB;EACK,CAAC;EACN,MAAM;IAAE7B,KAAK;IAAEiB;EAAc,CAAC,GAAGP,WAAW,CAC1CC,cAAc,EACdC,iBAAiB,CAClB;EAEDe,qBAAqB,CACnB3B,KAAK,EACLiB,aAAa,EACbW,KAAK,EACL1D,MAAM,EACN2D,sBAAsB,EACtBI,WAAW,CACZ;AACH,CAAC;AAED,eAAeG,MAAM"}
|
|
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","parseDataToJSON","data","JSON","parse","error","getDataFromServer","dataElement","document","querySelector","Error","textContent","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","errorMessage","reason","message","toString","dispatch","setupClient","customReducers","beforeRenderHooks","contextPath","clear","browserHistory","basename","routerHistory","getState","loadOtherBrowserTabs","getItem","response","listen","location","action","body","className","addContentLoadedEvent","theme","ErrorFallbackComponent","mount","addEventListener","applicationNode","mountClient","initComponent","isSSR","client"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\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 Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\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: Function,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: Function\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 initComponent: ReactElement<ElementType>\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(initComponent, applicationNode);\n } else {\n render(initComponent, 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}: 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 mountClient\n );\n};\n"],"mappings":";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;AAqB3E;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,IAAIR,kBAAkB,CAAE,yBAAwBK,IAAK,EAAC,CAAC;EAC/D;AACF,CAAC;AAED,MAAMI,iBAAiB,GAAG,MAAM;EAAA;EAC9B,MAAMC,WAAW,GAAGC,QAAQ,CAACC,aAAa,CACxC,4DAA4D,CAC7D;EAED,IAAI,CAACF,WAAW,EAAE;IAChB,MAAM,IAAIG,KAAK,CAAC,qCAAqC,CAAC;EACxD,CAAC,MAAM,IAAI,iCAAAH,WAAW,CAACI,WAAW,gBAAO,KAAK,EAAE,EAAE;IACh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ACpB,MAAM,IAAInC,KAAK,CACb,8DAA8D,CAC/D;IACH;IAEAiC,KAAK,CACHE,eAAe,eACf,KAAC,IAAI;MACH,KAAK,EAAEhC,KAAM;MACb,aAAa,EAAEiB,aAAc;MAC7B,WAAW,EAAEhB,MAAM,CAACY,WAAY;MAChC,KAAK,EAAEe,KAAM;MACb,sBAAsB,EAAEC,sBAAuB;MAAA,UAE9C3D,MAAM;IAAE,EACJ,CACR;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA,MAAM+D,WAAW,GAAG,CAClBD,eAAwB,EACxBE,aAAwC,KACrC;EACH,MAAMC,KAAK,GAAGH,eAAe,CAACpC,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAIuC,KAAK,EAAE;IACTlE,OAAO,CAACiE,aAAa,EAAEF,eAAe,CAAC;EACzC,CAAC,MAAM;IACL9D,MAAM,CAACgE,aAAa,EAAEF,eAAe,CAAC;EACxC;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMI,MAAM,GAAG,QAMT;EAAA,IANU;IACrBzB,cAAc;IACdiB,KAAK;IACL1D,MAAM;IACN0C,iBAAiB;IACjBiB;EACK,CAAC;EACN,MAAM;IAAE7B,KAAK;IAAEiB;EAAc,CAAC,GAAGP,WAAW,CAC1CC,cAAc,EACdC,iBAAiB,CAClB;EAEDe,qBAAqB,CACnB3B,KAAK,EACLiB,aAAa,EACbW,KAAK,EACL1D,MAAM,EACN2D,sBAAsB,EACtBI,WAAW,CACZ;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from "./client";
|
|
2
|
+
export * from "./Init";
|
|
3
|
+
export * from "../redux/actions/Error";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/react-client/index.js"],"sourcesContent":["// @flow\nexport * from \"./client\";\nexport * from \"./Init\";\nexport * from \"../redux/actions/Error\";\n"],"mappings":"AACA,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,cAAc,wBAAwB"}
|
package/lib/react-client/Init.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.Init = void 0;
|
|
8
8
|
var _reactRedux = require("react-redux");
|
|
9
9
|
var _reactHelmetAsync = require("react-helmet-async");
|
|
10
10
|
var _reactRouter = require("react-router");
|
|
@@ -39,7 +39,6 @@ const Init = _ref => {
|
|
|
39
39
|
})
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
+
exports.Init = Init;
|
|
42
43
|
Init.displayName = "BI.Init";
|
|
43
|
-
var _default = Init;
|
|
44
|
-
exports.default = _default;
|
|
45
44
|
//# sourceMappingURL=Init.js.map
|
|
@@ -12,7 +12,7 @@ import type { Theme } from "../react-theme/types";
|
|
|
12
12
|
import type { ReduxStore } from "../redux/types";
|
|
13
13
|
import type { Props as FallbackProps } from "../react/ErrorBoundaryFallback";
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
type Props = {
|
|
16
16
|
+store: ReduxStore,
|
|
17
17
|
+routerHistory: RouterHistory,
|
|
18
18
|
+contextPath: string,
|
|
@@ -23,7 +23,7 @@ export type Props = {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
*/
|
|
26
|
-
const Init = ({
|
|
26
|
+
export const Init = ({
|
|
27
27
|
store,
|
|
28
28
|
routerHistory,
|
|
29
29
|
contextPath,
|
|
@@ -43,7 +43,4 @@ const Init = ({
|
|
|
43
43
|
</ThemeProvider>
|
|
44
44
|
</Provider>
|
|
45
45
|
);
|
|
46
|
-
|
|
47
46
|
Init.displayName = "BI.Init";
|
|
48
|
-
|
|
49
|
-
export default Init;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Init.js","names":["Init","store","routerHistory","contextPath","theme","children","ErrorFallbackComponent","displayName"],"sources":["../../src/react-client/Init.js"],"sourcesContent":["// @flow\nimport { Provider } from \"react-redux\";\nimport { HelmetProvider } from \"react-helmet-async\";\nimport { Router } from \"react-router\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { RouterHistory } from \"react-router\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\
|
|
1
|
+
{"version":3,"file":"Init.js","names":["Init","store","routerHistory","contextPath","theme","children","ErrorFallbackComponent","displayName"],"sources":["../../src/react-client/Init.js"],"sourcesContent":["// @flow\nimport { Provider } from \"react-redux\";\nimport { HelmetProvider } from \"react-helmet-async\";\nimport { Router } from \"react-router\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { RouterHistory } from \"react-router\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\ntype Props = {\n +store: ReduxStore,\n +routerHistory: RouterHistory,\n +contextPath: string,\n +theme?: Theme | Array<Theme>,\n +children: ?Node,\n +ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/**\n */\nexport const Init = ({\n store,\n routerHistory,\n contextPath,\n theme,\n children,\n ErrorFallbackComponent,\n}: Props): Node => (\n <Provider store={store}>\n <ThemeProvider theme={theme}>\n <HelmetProvider>\n <ErrorBoundary FallbackComponent={ErrorFallbackComponent}>\n <Router history={routerHistory} basename={contextPath}>\n {children}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </Provider>\n);\nInit.displayName = \"BI.Init\";\n"],"mappings":";;;;;;;AACA;AACA;AACA;AAEA;AACA;AAAmD;AAiBnD;AACA;AACO,MAAMA,IAAI,GAAG;EAAA,IAAC;IACnBC,KAAK;IACLC,aAAa;IACbC,WAAW;IACXC,KAAK;IACLC,QAAQ;IACRC;EACK,CAAC;EAAA,oBACN,qBAAC,oBAAQ;IAAC,KAAK,EAAEL,KAAM;IAAA,uBACrB,qBAAC,sBAAa;MAAC,KAAK,EAAEG,KAAM;MAAA,uBAC1B,qBAAC,gCAAc;QAAA,uBACb,qBAAC,sBAAa;UAAC,iBAAiB,EAAEE,sBAAuB;UAAA,uBACvD,qBAAC,mBAAM;YAAC,OAAO,EAAEJ,aAAc;YAAC,QAAQ,EAAEC,WAAY;YAAA,UACnDE;UAAQ;QACF;MACK;IACD;EACH,EACP;AAAA,CACZ;AAAC;AACFL,IAAI,CAACO,WAAW,GAAG,SAAS"}
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.setupClient = exports.setUnhandledRejectionEvent = exports.
|
|
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
9
|
var _reactDom = require("react-dom");
|
|
10
10
|
var _objects = require("../utils/helpers/objects");
|
|
@@ -20,7 +20,7 @@ var _Error = require("../redux/actions/Error");
|
|
|
20
20
|
var _SignIn = require("../redux/actions/SignIn");
|
|
21
21
|
var _RouterActions = require("../redux/_router/RouterActions");
|
|
22
22
|
var _exceptions = require("../exceptions");
|
|
23
|
-
var _Init =
|
|
23
|
+
var _Init = require("./Init");
|
|
24
24
|
var _beforeRenderHooks = require("../redux/store/beforeRenderHooks");
|
|
25
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
26
|
/*
|
|
@@ -126,7 +126,7 @@ const addContentLoadedEvent = (store, routerHistory, theme, render, ErrorFallbac
|
|
|
126
126
|
if (!applicationNode) {
|
|
127
127
|
throw new Error("No DOM element with id application found to attach client to");
|
|
128
128
|
}
|
|
129
|
-
mount(applicationNode, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Init.
|
|
129
|
+
mount(applicationNode, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Init.Init, {
|
|
130
130
|
store: store,
|
|
131
131
|
routerHistory: routerHistory,
|
|
132
132
|
contextPath: window.contextPath,
|
|
@@ -166,6 +166,5 @@ const client = _ref => {
|
|
|
166
166
|
} = setupClient(customReducers, beforeRenderHooks);
|
|
167
167
|
addContentLoadedEvent(store, routerHistory, theme, render, ErrorFallbackComponent, mountClient);
|
|
168
168
|
};
|
|
169
|
-
|
|
170
|
-
exports.default = _default;
|
|
169
|
+
exports.client = client;
|
|
171
170
|
//# sourceMappingURL=client.js.map
|
|
@@ -25,7 +25,7 @@ import { locationChange } from "../redux/_router/RouterActions";
|
|
|
25
25
|
|
|
26
26
|
import { JsonParseException, FetchException } from "../exceptions";
|
|
27
27
|
|
|
28
|
-
import Init from "./Init";
|
|
28
|
+
import { Init } from "./Init";
|
|
29
29
|
|
|
30
30
|
import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
|
|
31
31
|
|
|
@@ -40,7 +40,7 @@ import type { RouterHistory } from "react-router";
|
|
|
40
40
|
import type { BeforeRenderHook } from "../redux/store/beforeRenderHooks";
|
|
41
41
|
import type { Props as FallbackProps } from "../react/ErrorBoundaryFallback";
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
type Props = {
|
|
44
44
|
customReducers?: CustomReducers,
|
|
45
45
|
theme?: Theme | Array<Theme>,
|
|
46
46
|
render: Function,
|
|
@@ -202,7 +202,7 @@ const mountClient = (
|
|
|
202
202
|
/**
|
|
203
203
|
* Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.
|
|
204
204
|
*/
|
|
205
|
-
const client = ({
|
|
205
|
+
export const client = ({
|
|
206
206
|
customReducers,
|
|
207
207
|
theme,
|
|
208
208
|
render,
|
|
@@ -223,5 +223,3 @@ const client = ({
|
|
|
223
223
|
mountClient
|
|
224
224
|
);
|
|
225
225
|
};
|
|
226
|
-
|
|
227
|
-
export default client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["parseDataToJSON","data","JSON","parse","error","JsonParseException","getDataFromServer","dataElement","document","querySelector","Error","textContent","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","dispatch","showXHRErrorNotification","setupClient","customReducers","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","mountClient","initComponent","isSSR","hydrate","client"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\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\nexport type Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\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: Function,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: Function\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 initComponent: ReactElement<ElementType>\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(initComponent, applicationNode);\n } else {\n render(initComponent, 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 */\nconst client = ({\n customReducers,\n theme,\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\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 mountClient\n );\n};\n\nexport default client;\n"],"mappings":";;;;;;;;AACA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AAEA;AAIA;AAEA;AACA;AAEA;AAEA;AAEA;AAEA;AAA2E;AAqB3E;AACA;AACA;AACA,MAAMA,eAAe,GAAIC,IAAY,IAAK;EACxC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC;EACzB,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,MAAM,IAAIC,8BAAkB,CAAE,yBAAwBJ,IAAK,EAAC,CAAC;EAC/D;AACF,CAAC;AAED,MAAMK,iBAAiB,GAAG,MAAM;EAAA;EAC9B,MAAMC,WAAW,GAAGC,QAAQ,CAACC,aAAa,CACxC,4DAA4D,CAC7D;EAED,IAAI,CAACF,WAAW,EAAE;IAChB,MAAM,IAAIG,KAAK,CAAC,qCAAqC,CAAC;EACxD,CAAC,MAAM,IAAI,8BAAAH,WAAW,CAACI,WAAW,gBAAO,KAAK,EAAE,EAAE;IAChD,OAAO,CAAC,CAAC;EACX;EAEA,OAAOX,eAAe,CAACO,WAAW,CAACI,WAAW,CAAC;AACjD,CAAC;;AAED;AACA;AACO,MAAMC,0BAA0B,GAAIC,KAAiB,IAAK;EAC/DC,MAAM,CAACC,oBAAoB,GAAIC,KAAK,IAAK;IACvC,IAAIA,KAAK,CAACC,MAAM,EAAE;MAChB,OAAO,IAAAC,qBAAY,EAAC,MAAM;QACxB,MAAMC,YAAY,GAAGH,KAAK,CAACC,MAAM,CAACG,MAAM,CAACC,OAAO,CAACC,QAAQ,EAAE;QAE3DT,KAAK,CAACU,QAAQ,CAAC,IAAAC,sCAAwB,EAACL,YAAY,CAAC,CAAC;QACtD,MAAMH,KAAK,CAACC,MAAM,CAACG,MAAM;MAC3B,CAAC,CAAC;IACJ;IAEA,O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aAAa,CAAC,cAAc,CAAC;EAC3D,IAAIuD,KAAK,EAAE;IACT,IAAAC,iBAAO,EAACF,aAAa,EAAEF,eAAe,CAAC;EACzC,CAAC,MAAM;IACL,IAAAJ,gBAAM,EAACM,aAAa,EAAEF,eAAe,CAAC;EACxC;AACF,CAAC;;AAED;AACA;AACA;AACA,MAAMK,MAAM,GAAG,QAMF;EAAA,IANG;IACdxC,cAAc;IACd8B,KAAK;IACLC,MAAM;IACN9B,iBAAiB;IACjB+B;EACK,CAAC;EACN,MAAM;IAAE7C,KAAK;IAAEsB;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdC,iBAAiB,CAClB;EAED4B,qBAAqB,CACnB1C,KAAK,EACLsB,aAAa,EACbqB,KAAK,EACLC,MAAM,EACNC,sBAAsB,EACtBI,WAAW,CACZ;AACH,CAAC;AAAC,eAEaI,MAAM;AAAA"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["parseDataToJSON","data","JSON","parse","error","JsonParseException","getDataFromServer","dataElement","document","querySelector","Error","textContent","setUnhandledRejectionEvent","store","window","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","dispatch","showXHRErrorNotification","setupClient","customReducers","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","mountClient","initComponent","isSSR","hydrate","client"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\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 Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\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: Function,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n mount: Function\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 initComponent: ReactElement<ElementType>\n) => {\n const isSSR = applicationNode.querySelector(\".application\");\n if (isSSR) {\n hydrate(initComponent, applicationNode);\n } else {\n render(initComponent, 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}: 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 mountClient\n );\n};\n"],"mappings":";;;;;;;;AACA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AAEA;AAIA;AAEA;AACA;AAEA;AAEA;AAEA;AAEA;AAA2E;AAqB3E;AACA;AACA;AACA,MAAMA,eAAe,GAAIC,IAAY,IAAK;EACxC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC;EACzB,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,MAAM,IAAIC,8BAAkB,CAAE,yBAAwBJ,IAAK,EAAC,CAAC;EAC/D;AACF,CAAC;AAED,MAAMK,iBAAiB,GAAG,MAAM;EAAA;EAC9B,MAAMC,WAAW,GAAGC,QAAQ,CAACC,aAAa,CACxC,4DAA4D,CAC7D;EAED,IAAI,CAACF,WAAW,EAAE;IAChB,MAAM,IAAIG,KAAK,CAAC,qCAAqC,CAAC;EACxD,CAAC,MAAM,IAAI,8BAAAH,WAAW,CAACI,WAAW,gBAAO,KAAK,EAAE,EAAE;IAChD,OAAO,CAAC,CAAC;EACX;EAEA,OAAOX,eAAe,CAACO,WAAW,CAACI,WAAW,CAAC;AACjD,CAAC;;AAED;AACA;AACO,MAAMC,0BAA0B,GAAIC,KAAiB,IAAK;EAC/DC,MAAM,CAACC,oBAAoB,GAAIC,KAAK,IAAK;IACvC,IAAIA,KAAK,CAACC,MAAM,EAAE;MAChB,OAAO,IAAAC,qBAAY,EAAC,MAAM;QACx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ChC,KAAK,EAAE4B,KAAM;MACb,sBAAsB,EAAEE,sBAAuB;MAAA,UAE9CD,MAAM;IAAE,EACJ,CACR;EACH,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AADA;AAEA,MAAMK,WAAW,GAAG,CAClBD,eAAwB,EACxBE,aAAwC,KACrC;EACH,MAAMC,KAAK,GAAGH,eAAe,CAACpD,aAAa,CAAC,cAAc,CAAC;EAC3D,IAAIuD,KAAK,EAAE;IACT,IAAAC,iBAAO,EAACF,aAAa,EAAEF,eAAe,CAAC;EACzC,CAAC,MAAM;IACL,IAAAJ,gBAAM,EAACM,aAAa,EAAEF,eAAe,CAAC;EACxC;AACF,CAAC;;AAED;AACA;AACA;AACO,MAAMK,MAAM,GAAG,QAMT;EAAA,IANU;IACrBxC,cAAc;IACd8B,KAAK;IACLC,MAAM;IACN9B,iBAAiB;IACjB+B;EACK,CAAC;EACN,MAAM;IAAE7C,KAAK;IAAEsB;EAAc,CAAC,GAAGV,WAAW,CAC1CC,cAAc,EACdC,iBAAiB,CAClB;EAED4B,qBAAqB,CACnB1C,KAAK,EACLsB,aAAa,EACbqB,KAAK,EACLC,MAAM,EACNC,sBAAsB,EACtBI,WAAW,CACZ;AACH,CAAC;AAAC"}
|
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
var _client = require("./client");
|
|
8
|
+
_Object$keys(_client).forEach(function (key) {
|
|
9
|
+
if (key === "default" || key === "__esModule") return;
|
|
10
|
+
if (key in exports && exports[key] === _client[key]) return;
|
|
11
|
+
Object.defineProperty(exports, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () {
|
|
14
|
+
return _client[key];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
12
17
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
18
|
+
var _Init = require("./Init");
|
|
19
|
+
_Object$keys(_Init).forEach(function (key) {
|
|
20
|
+
if (key === "default" || key === "__esModule") return;
|
|
21
|
+
if (key in exports && exports[key] === _Init[key]) return;
|
|
22
|
+
Object.defineProperty(exports, key, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return _Init[key];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
24
28
|
});
|
|
25
29
|
var _Error = require("../redux/actions/Error");
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
_Object$keys(_Error).forEach(function (key) {
|
|
31
|
+
if (key === "default" || key === "__esModule") return;
|
|
32
|
+
if (key in exports && exports[key] === _Error[key]) return;
|
|
33
|
+
Object.defineProperty(exports, key, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return _Error[key];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
28
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
export { default as client } from "./client";
|
|
7
|
-
export type { Props } from "./client";
|
|
2
|
+
export * from "./client";
|
|
3
|
+
export * from "./Init";
|
|
4
|
+
export * from "../redux/actions/Error";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/react-client/index.js"],"sourcesContent":["// @flow\nexport
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/react-client/index.js"],"sourcesContent":["// @flow\nexport * from \"./client\";\nexport * from \"./Init\";\nexport * from \"../redux/actions/Error\";\n"],"mappings":";;;;;;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/package.json
CHANGED
package/src/react-client/Init.js
CHANGED
|
@@ -12,7 +12,7 @@ import type { Theme } from "../react-theme/types";
|
|
|
12
12
|
import type { ReduxStore } from "../redux/types";
|
|
13
13
|
import type { Props as FallbackProps } from "../react/ErrorBoundaryFallback";
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
type Props = {
|
|
16
16
|
+store: ReduxStore,
|
|
17
17
|
+routerHistory: RouterHistory,
|
|
18
18
|
+contextPath: string,
|
|
@@ -23,7 +23,7 @@ export type Props = {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
*/
|
|
26
|
-
const Init = ({
|
|
26
|
+
export const Init = ({
|
|
27
27
|
store,
|
|
28
28
|
routerHistory,
|
|
29
29
|
contextPath,
|
|
@@ -43,7 +43,4 @@ const Init = ({
|
|
|
43
43
|
</ThemeProvider>
|
|
44
44
|
</Provider>
|
|
45
45
|
);
|
|
46
|
-
|
|
47
46
|
Init.displayName = "BI.Init";
|
|
48
|
-
|
|
49
|
-
export default Init;
|
|
@@ -25,7 +25,7 @@ import { locationChange } from "../redux/_router/RouterActions";
|
|
|
25
25
|
|
|
26
26
|
import { JsonParseException, FetchException } from "../exceptions";
|
|
27
27
|
|
|
28
|
-
import Init from "./Init";
|
|
28
|
+
import { Init } from "./Init";
|
|
29
29
|
|
|
30
30
|
import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
|
|
31
31
|
|
|
@@ -40,7 +40,7 @@ import type { RouterHistory } from "react-router";
|
|
|
40
40
|
import type { BeforeRenderHook } from "../redux/store/beforeRenderHooks";
|
|
41
41
|
import type { Props as FallbackProps } from "../react/ErrorBoundaryFallback";
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
type Props = {
|
|
44
44
|
customReducers?: CustomReducers,
|
|
45
45
|
theme?: Theme | Array<Theme>,
|
|
46
46
|
render: Function,
|
|
@@ -202,7 +202,7 @@ const mountClient = (
|
|
|
202
202
|
/**
|
|
203
203
|
* Mount the webapplication to the DOM, setup redux store and caches, add unhandledRejectionEvent, used client side when JavaScript is enabled.
|
|
204
204
|
*/
|
|
205
|
-
const client = ({
|
|
205
|
+
export const client = ({
|
|
206
206
|
customReducers,
|
|
207
207
|
theme,
|
|
208
208
|
render,
|
|
@@ -223,5 +223,3 @@ const client = ({
|
|
|
223
223
|
mountClient
|
|
224
224
|
);
|
|
225
225
|
};
|
|
226
|
-
|
|
227
|
-
export default client;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
export { default as client } from "./client";
|
|
7
|
-
export type { Props } from "./client";
|
|
2
|
+
export * from "./client";
|
|
3
|
+
export * from "./Init";
|
|
4
|
+
export * from "../redux/actions/Error";
|