@zengenti/contensis-react-base 2.5.1-beta.4 → 3.0.0-beta.3
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/README.md +8 -2
- package/cjs/{App-fbd91490.js → App-581b6653.js} +20 -19
- package/cjs/App-581b6653.js.map +1 -0
- package/cjs/{RouteLoader-f99cd734.js → RouteLoader-282c03ab.js} +5 -5
- package/cjs/RouteLoader-282c03ab.js.map +1 -0
- package/cjs/ToJs-87edc45d.js +230 -0
- package/cjs/ToJs-87edc45d.js.map +1 -0
- package/cjs/{actions-e9f69947.js → actions-12871aca.js} +9 -13
- package/cjs/actions-12871aca.js.map +1 -0
- package/cjs/client.js +47 -64
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +54 -55
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +1 -1
- package/cjs/fromJSLeaveImmer-9b550c8e.js +40 -0
- package/cjs/fromJSLeaveImmer-9b550c8e.js.map +1 -0
- package/cjs/{login-4f274c6a.js → login-81d7f9ef.js} +11 -10
- package/cjs/login-81d7f9ef.js.map +1 -0
- package/cjs/{reducers-cb531715.js → reducers-fde41d6b.js} +76 -31
- package/cjs/reducers-fde41d6b.js.map +1 -0
- package/cjs/redux.js +11 -8
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +5 -5
- package/cjs/search.js +409 -233
- package/cjs/search.js.map +1 -1
- package/cjs/selectors-ed26ed97.js +141 -0
- package/cjs/selectors-ed26ed97.js.map +1 -0
- package/cjs/user.js +14 -14
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +24 -10
- package/cjs/util.js.map +1 -1
- package/cjs/version-0c190929.js +20 -0
- package/cjs/version-0c190929.js.map +1 -0
- package/cjs/{version-3a808c12.js → version-f061e409.js} +154 -76
- package/cjs/version-f061e409.js.map +1 -0
- package/esm/{App-fbef99b3.js → App-122f28a3.js} +20 -19
- package/esm/App-122f28a3.js.map +1 -0
- package/esm/{RouteLoader-281d47e1.js → RouteLoader-c2faac87.js} +5 -5
- package/esm/RouteLoader-c2faac87.js.map +1 -0
- package/esm/ToJs-52fee252.js +199 -0
- package/esm/ToJs-52fee252.js.map +1 -0
- package/esm/{actions-ddd9c623.js → actions-3cc39599.js} +4 -7
- package/esm/actions-3cc39599.js.map +1 -0
- package/esm/client.js +48 -65
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +53 -53
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +1 -1
- package/esm/fromJSLeaveImmer-e44d1a91.js +38 -0
- package/esm/fromJSLeaveImmer-e44d1a91.js.map +1 -0
- package/esm/{login-1f9ad133.js → login-92db44d1.js} +11 -10
- package/esm/login-92db44d1.js.map +1 -0
- package/esm/{reducers-feab84fc.js → reducers-d6c0edb1.js} +77 -31
- package/esm/reducers-d6c0edb1.js.map +1 -0
- package/esm/redux.js +9 -8
- package/esm/redux.js.map +1 -1
- package/esm/routing.js +5 -5
- package/esm/search.js +409 -235
- package/esm/search.js.map +1 -1
- package/esm/selectors-82e71d8e.js +116 -0
- package/esm/selectors-82e71d8e.js.map +1 -0
- package/esm/user.js +10 -10
- package/esm/user.js.map +1 -1
- package/esm/util.js +24 -10
- package/esm/util.js.map +1 -1
- package/esm/version-59c8f9be.js +15 -0
- package/esm/version-59c8f9be.js.map +1 -0
- package/esm/{version-64906b26.js → version-cb9cd09d.js} +133 -76
- package/esm/version-cb9cd09d.js.map +1 -0
- package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
- package/models/config.d.ts +2 -0
- package/models/redux/appstate.d.ts +85 -0
- package/models/redux/index.d.ts +1 -0
- package/models/redux/reducers/navigation.d.ts +6 -2
- package/models/redux/reducers/version.d.ts +5 -2
- package/models/redux/store/store.d.ts +4 -1
- package/models/redux/util.d.ts +2 -0
- package/models/routing/components/RouteLoader.d.ts +20 -2
- package/models/routing/redux/reducers.d.ts +21 -3
- package/models/routing/redux/selectors.d.ts +29 -25
- package/models/routing/routes.d.ts +10 -2
- package/models/search/hooks/useMinilist.hook.d.ts +7 -20
- package/models/search/models/Search.d.ts +8 -1
- package/models/search/models/SearchActions.d.ts +3 -4
- package/models/search/models/SearchProps.d.ts +16 -2
- package/models/search/models/SearchState.d.ts +25 -9
- package/models/search/models/WithSearch.d.ts +61 -0
- package/models/search/redux/getIn.d.ts +3 -0
- package/models/search/redux/reducers.d.ts +346 -2
- package/models/search/redux/sagas.d.ts +2 -2
- package/models/search/redux/schema.d.ts +56 -8
- package/models/search/redux/selectors.d.ts +75 -66
- package/models/search/redux/util.d.ts +1 -1
- package/models/search/search/util.d.ts +2 -3
- package/models/user/components/Login.d.ts +10 -1
- package/models/user/containers/ChangePassword.container.d.ts +4 -1
- package/models/user/containers/ForgotPassword.container.d.ts +4 -1
- package/models/user/containers/Login.container.d.ts +4 -1
- package/models/user/containers/Registration.container.d.ts +4 -1
- package/models/user/hocs/withLogin.d.ts +9 -1
- package/models/user/hocs/withRegistration.d.ts +9 -1
- package/models/user/hooks/useChangePassword.d.ts +5 -5
- package/models/user/hooks/useForgotPassword.d.ts +6 -6
- package/models/user/hooks/useLogin.d.ts +45 -7
- package/models/user/hooks/useRegistration.d.ts +4 -4
- package/models/user/redux/reducers.d.ts +54 -3
- package/models/user/redux/selectors.d.ts +72 -27
- package/models/util/ToJs.d.ts +4 -1
- package/package-lock.json +1092 -21401
- package/package.json +9 -8
- package/cjs/App-fbd91490.js.map +0 -1
- package/cjs/RouteLoader-f99cd734.js.map +0 -1
- package/cjs/ToJs-d72e5b10.js +0 -167
- package/cjs/ToJs-d72e5b10.js.map +0 -1
- package/cjs/actions-e9f69947.js.map +0 -1
- package/cjs/login-4f274c6a.js.map +0 -1
- package/cjs/reducers-cb531715.js.map +0 -1
- package/cjs/selectors-1295124a.js +0 -139
- package/cjs/selectors-1295124a.js.map +0 -1
- package/cjs/version-2193b4a2.js +0 -24
- package/cjs/version-2193b4a2.js.map +0 -1
- package/cjs/version-3a808c12.js.map +0 -1
- package/esm/App-fbef99b3.js.map +0 -1
- package/esm/RouteLoader-281d47e1.js.map +0 -1
- package/esm/ToJs-6e7b247c.js +0 -136
- package/esm/ToJs-6e7b247c.js.map +0 -1
- package/esm/actions-ddd9c623.js.map +0 -1
- package/esm/login-1f9ad133.js.map +0 -1
- package/esm/reducers-feab84fc.js.map +0 -1
- package/esm/selectors-68799788.js +0 -117
- package/esm/selectors-68799788.js.map +0 -1
- package/esm/version-64906b26.js.map +0 -1
- package/esm/version-7fdbd2d5.js +0 -19
- package/esm/version-7fdbd2d5.js.map +0 -1
package/esm/client.js
CHANGED
|
@@ -4,61 +4,37 @@ import { Router } from 'react-router-dom';
|
|
|
4
4
|
import { Provider } from 'react-redux';
|
|
5
5
|
import 'react-router-config';
|
|
6
6
|
import 'jsonpath-mapper';
|
|
7
|
-
import 'immutable';
|
|
8
7
|
import 'redux';
|
|
9
|
-
import 'redux-immutable';
|
|
10
8
|
import 'redux-thunk';
|
|
11
9
|
import 'redux-saga';
|
|
12
10
|
import 'redux-injectors';
|
|
13
|
-
import
|
|
14
|
-
import { s as
|
|
15
|
-
import {
|
|
11
|
+
import 'immer';
|
|
12
|
+
import { c as createStore, s as setVersionStatus } from './version-cb9cd09d.js';
|
|
13
|
+
import { s as setCurrentProject } from './actions-3cc39599.js';
|
|
14
|
+
import './reducers-d6c0edb1.js';
|
|
16
15
|
import 'history';
|
|
17
|
-
import { d as deliveryApi,
|
|
18
|
-
export { A as ReactApp } from './App-
|
|
16
|
+
import { d as deliveryApi, b as browserHistory, r as rootSaga, p as pickProject } from './App-122f28a3.js';
|
|
17
|
+
export { A as ReactApp } from './App-122f28a3.js';
|
|
19
18
|
import '@redux-saga/core/effects';
|
|
20
19
|
import 'contensis-delivery-api';
|
|
21
|
-
import './
|
|
20
|
+
import './selectors-82e71d8e.js';
|
|
21
|
+
import './version-59c8f9be.js';
|
|
22
22
|
import { parse } from 'query-string';
|
|
23
|
-
import './selectors-68799788.js';
|
|
24
23
|
import 'loglevel';
|
|
25
|
-
import './ToJs-
|
|
26
|
-
import './login-
|
|
24
|
+
import './ToJs-52fee252.js';
|
|
25
|
+
import './login-92db44d1.js';
|
|
27
26
|
import 'await-to-js';
|
|
28
27
|
import 'js-cookie';
|
|
29
28
|
import { AppContainer } from 'react-hot-loader';
|
|
30
|
-
import './RouteLoader-
|
|
29
|
+
import './RouteLoader-c2faac87.js';
|
|
31
30
|
import { hydrate, render } from 'react-dom';
|
|
32
31
|
import { loadableReady } from '@loadable/component';
|
|
33
32
|
|
|
34
|
-
const fromJSLeaveImmer = js => {
|
|
35
|
-
// console.info(js);
|
|
36
|
-
// if (typeof js !== 'object' || js === null) return js;
|
|
37
|
-
// // console.info(`from js - here is js ${JSON.stringify(js)}`);
|
|
38
|
-
// const convertedObject = isOrdered ? OrderedMap() : fromJS({});
|
|
39
|
-
// const keys = Object.keys(js);
|
|
40
|
-
// keys.forEach(key => {
|
|
41
|
-
// if (key === 'immer') {
|
|
42
|
-
// convertedObject.set(key, js[key]);
|
|
43
|
-
// // console.info(`LOOK! - immer untouched bar root key "${key}"`);
|
|
44
|
-
// } else {
|
|
45
|
-
// // console.info(`LOOK! - normal immutable feature "${key}"`);
|
|
46
|
-
// convertedObject.set(key, isOrdered ? fromJSOrdered(js) : fromJS(js));
|
|
47
|
-
// }
|
|
48
|
-
// });
|
|
49
|
-
const immutableObj = fromJSOrdered(js);
|
|
50
|
-
|
|
51
|
-
if (immutableObj && !!immutableObj.get('immer')) {
|
|
52
|
-
immutableObj.set('immer', immutableObj.get('immer').toJS());
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return immutableObj;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
33
|
class ClientApp {
|
|
59
34
|
constructor(ReactApp, config) {
|
|
60
35
|
const documentRoot = document.getElementById('root');
|
|
61
36
|
const {
|
|
37
|
+
stateType = 'immutable',
|
|
62
38
|
routes,
|
|
63
39
|
withReducers,
|
|
64
40
|
withSagas,
|
|
@@ -83,27 +59,40 @@ class ClientApp {
|
|
|
83
59
|
*/
|
|
84
60
|
|
|
85
61
|
const HMRRenderer = Component => {
|
|
86
|
-
loadableReady(() => {
|
|
87
|
-
|
|
88
|
-
}
|
|
62
|
+
if (isProduction) loadableReady(() => {
|
|
63
|
+
hydrate(Component, documentRoot);
|
|
64
|
+
}, {
|
|
65
|
+
namespace: 'modern'
|
|
66
|
+
});else render(Component, documentRoot);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const hmr = store => {
|
|
70
|
+
// webpack Hot Module Replacement API
|
|
71
|
+
if (module.hot) {
|
|
72
|
+
module.hot.accept(ReactApp, () => {
|
|
73
|
+
// if you are using harmony modules ({modules:false})
|
|
74
|
+
HMRRenderer(GetClientJSX(store));
|
|
75
|
+
});
|
|
76
|
+
}
|
|
89
77
|
};
|
|
90
78
|
|
|
91
|
-
let store = null;
|
|
92
79
|
const qs = parse(window.location.search);
|
|
93
80
|
const versionStatusFromHostname = deliveryApi.getClientSideVersionStatus();
|
|
94
81
|
|
|
95
82
|
if (window.isDynamic || window.REDUX_DATA || process.env.NODE_ENV !== 'production') {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
83
|
+
createStore(withReducers, window.REDUX_DATA, browserHistory, stateType).then(store => {
|
|
84
|
+
store.dispatch(setVersionStatus(qs.versionStatus || versionStatusFromHostname));
|
|
85
|
+
/* eslint-disable no-console */
|
|
99
86
|
|
|
100
|
-
|
|
101
|
-
|
|
87
|
+
console.log('Hydrating from inline Redux');
|
|
88
|
+
/* eslint-enable no-console */
|
|
102
89
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
90
|
+
store.runSaga(rootSaga(withSagas));
|
|
91
|
+
store.dispatch(setCurrentProject(pickProject(window.location.hostname, qs), [], window.location.hostname));
|
|
92
|
+
delete window.REDUX_DATA;
|
|
93
|
+
HMRRenderer(GetClientJSX(store));
|
|
94
|
+
hmr(store);
|
|
95
|
+
});
|
|
107
96
|
} else {
|
|
108
97
|
fetch(`${window.location.pathname}?redux=true`).then(response => response.json()).then(data => {
|
|
109
98
|
/* eslint-disable no-console */
|
|
@@ -112,22 +101,16 @@ class ClientApp {
|
|
|
112
101
|
|
|
113
102
|
/* eslint-enable no-console */
|
|
114
103
|
const ssRedux = JSON.parse(data);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (module.hot) {
|
|
128
|
-
module.hot.accept(ReactApp, () => {
|
|
129
|
-
// if you are using harmony modules ({modules:false})
|
|
130
|
-
HMRRenderer(GetClientJSX(store));
|
|
104
|
+
createStore(withReducers, ssRedux, browserHistory, stateType).then(store => {
|
|
105
|
+
// store.dispatch(setVersionStatus(versionStatusFromHostname));
|
|
106
|
+
store.runSaga(rootSaga(withSagas));
|
|
107
|
+
store.dispatch(setCurrentProject(pickProject(window.location.hostname, parse(window.location.search)), [], window.location.hostname)); // if (typeof window != 'undefined') {
|
|
108
|
+
// store.dispatch(checkUserLoggedIn());
|
|
109
|
+
// }
|
|
110
|
+
|
|
111
|
+
HMRRenderer(GetClientJSX(store));
|
|
112
|
+
hmr(store);
|
|
113
|
+
});
|
|
131
114
|
});
|
|
132
115
|
}
|
|
133
116
|
}
|
package/esm/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../src/client/client.tsx"],"sourcesContent":["import 'isomorphic-fetch';\nimport React from 'react';\nimport { render, hydrate } from 'react-dom';\nimport { AppContainer } from 'react-hot-loader';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { Router } from 'react-router-dom';\nimport { loadableReady } from '@loadable/component';\nimport * as queryString from 'query-string';\n\nimport { setVersionStatus } from '~/redux/actions/version';\nimport rootSaga from '~/redux/sagas';\nimport { browserHistory as history } from '~/redux/store/history';\nimport createStore from '~/redux/store/store';\n\nimport { setCurrentProject } from '~/routing/redux/actions';\n\nimport { deliveryApi } from '~/util/ContensisDeliveryApi';\nimport pickProject from '~/util/pickProject';\n\nimport { AppConfig } from '~/config';\n\ndeclare let window: typeof globalThis & {\n isDynamic;\n REDUX_DATA;\n};\n\ntype ReactAppProps = { routes: any; withEvents: any };\n\nclass ClientApp {\n constructor(ReactApp: React.ComponentType<ReactAppProps>, config: AppConfig) {\n const documentRoot = document.getElementById('root');\n\n const {\n stateType = 'immutable',\n routes,\n withReducers,\n withSagas,\n withEvents,\n } = config;\n\n const GetClientJSX = store => {\n const ClientJsx = (\n <AppContainer>\n <ReduxProvider store={store}>\n <Router history={history}>\n <ReactApp routes={routes} withEvents={withEvents} />\n </Router>\n </ReduxProvider>\n </AppContainer>\n );\n return ClientJsx;\n };\n\n const isProduction = !(process.env.NODE_ENV !== 'production');\n\n /**\n * Webpack HMR Setup.\n */\n const HMRRenderer = Component => {\n if (isProduction)\n loadableReady(\n () => {\n hydrate(Component, documentRoot);\n },\n { namespace: 'modern' }\n );\n else render(Component, documentRoot);\n };\n\n const hmr = store => {\n // webpack Hot Module Replacement API\n if (module.hot) {\n module.hot.accept(ReactApp as unknown as string, () => {\n // if you are using harmony modules ({modules:false})\n HMRRenderer(GetClientJSX(store));\n });\n }\n };\n\n const qs = queryString.parse(window.location.search);\n const versionStatusFromHostname = deliveryApi.getClientSideVersionStatus();\n\n if (\n window.isDynamic ||\n window.REDUX_DATA ||\n process.env.NODE_ENV !== 'production'\n ) {\n createStore(withReducers, window.REDUX_DATA, history, stateType).then(\n store => {\n store.dispatch(\n setVersionStatus(qs.versionStatus || versionStatusFromHostname)\n );\n\n /* eslint-disable no-console */\n console.log('Hydrating from inline Redux');\n /* eslint-enable no-console */\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n\n delete window.REDUX_DATA;\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n }\n );\n } else {\n fetch(`${window.location.pathname}?redux=true`)\n .then(response => response.json())\n .then(data => {\n /* eslint-disable no-console */\n // console.log('Got Data Back');\n // console.log(data);\n /* eslint-enable no-console */\n const ssRedux = JSON.parse(data);\n createStore(withReducers, ssRedux, history, stateType).then(store => {\n // store.dispatch(setVersionStatus(versionStatusFromHostname));\n\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(\n window.location.hostname,\n queryString.parse(window.location.search)\n ),\n [],\n window.location.hostname\n )\n );\n // if (typeof window != 'undefined') {\n // store.dispatch(checkUserLoggedIn());\n // }\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n });\n });\n }\n }\n}\n\nexport default ClientApp;\n"],"names":["ClientApp","constructor","ReactApp","config","documentRoot","document","getElementById","stateType","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","ReduxProvider","history","isProduction","process","env","NODE_ENV","HMRRenderer","Component","loadableReady","hydrate","namespace","render","hmr","module","hot","accept","qs","queryString","window","location","search","versionStatusFromHostname","deliveryApi","getClientSideVersionStatus","isDynamic","REDUX_DATA","createStore","then","dispatch","setVersionStatus","versionStatus","console","log","runSaga","rootSaga","setCurrentProject","pickProject","hostname","fetch","pathname","response","json","data","ssRedux","JSON","parse"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAMA,SAAN,CAAgB;AACdC,EAAAA,WAAW,CAACC,QAAD,EAA+CC,MAA/C,EAAkE;AAC3E,UAAMC,YAAY,GAAGC,QAAQ,CAACC,cAAT,CAAwB,MAAxB,CAArB;AAEA,UAAM;AACJC,MAAAA,SAAS,GAAG,WADR;AAEJC,MAAAA,MAFI;AAGJC,MAAAA,YAHI;AAIJC,MAAAA,SAJI;AAKJC,MAAAA;AALI,QAMFR,MANJ;;AAQA,UAAMS,YAAY,GAAGC,KAAK,IAAI;AAC5B,YAAMC,SAAS,gBACb,o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ACC,QAAP,CAAgBkB,QAND,CADnB,EAJmE;AAenE;AACA;;AACA/B,UAAAA,WAAW,CAACT,YAAY,CAACC,KAAD,CAAb,CAAX;AAEAc,UAAAA,GAAG,CAACd,KAAD,CAAH;AACD,SApBD;AAqBD,OA7BH;AA8BD;AACF;;AAnHa;;;;"}
|
|
@@ -9,36 +9,35 @@ import { renderToString } from 'react-dom/server';
|
|
|
9
9
|
import { StaticRouter } from 'react-router-dom';
|
|
10
10
|
import { Provider } from 'react-redux';
|
|
11
11
|
import { matchRoutes } from 'react-router-config';
|
|
12
|
-
import Helmet from 'react-helmet';
|
|
12
|
+
import { Helmet } from 'react-helmet';
|
|
13
13
|
import { ServerStyleSheet } from 'styled-components';
|
|
14
14
|
import serialize from 'serialize-javascript';
|
|
15
15
|
import minifyCssString from 'minify-css-string';
|
|
16
16
|
import mapJson from 'jsonpath-mapper';
|
|
17
17
|
import { ChunkExtractor, ChunkExtractorManager } from '@loadable/server';
|
|
18
|
-
import { fromJS } from 'immutable';
|
|
19
18
|
import 'redux';
|
|
20
|
-
import 'redux-immutable';
|
|
21
19
|
import 'redux-thunk';
|
|
22
20
|
import 'redux-saga';
|
|
23
21
|
import 'redux-injectors';
|
|
24
|
-
import
|
|
25
|
-
import { s as
|
|
26
|
-
import './
|
|
22
|
+
import 'immer';
|
|
23
|
+
import { c as createStore, s as setVersionStatus, a as setVersion } from './version-cb9cd09d.js';
|
|
24
|
+
import { s as setCurrentProject } from './actions-3cc39599.js';
|
|
25
|
+
import './reducers-d6c0edb1.js';
|
|
27
26
|
import 'history';
|
|
28
|
-
import { h as history, d as deliveryApi, p as pickProject, r as rootSaga } from './App-
|
|
29
|
-
export { A as ReactApp } from './App-
|
|
27
|
+
import { h as history, d as deliveryApi, p as pickProject, r as rootSaga } from './App-122f28a3.js';
|
|
28
|
+
export { A as ReactApp } from './App-122f28a3.js';
|
|
30
29
|
import '@redux-saga/core/effects';
|
|
31
30
|
import 'contensis-delivery-api';
|
|
32
|
-
import './
|
|
31
|
+
import { g as getImmutableOrJS, s as selectRouteEntry, a as selectCurrentProject } from './selectors-82e71d8e.js';
|
|
32
|
+
import './version-59c8f9be.js';
|
|
33
33
|
import 'query-string';
|
|
34
|
-
import { s as selectRouteEntry, a as selectCurrentProject } from './selectors-68799788.js';
|
|
35
34
|
import 'loglevel';
|
|
36
|
-
import './ToJs-
|
|
37
|
-
import './login-
|
|
35
|
+
import './ToJs-52fee252.js';
|
|
36
|
+
import './login-92db44d1.js';
|
|
38
37
|
import 'await-to-js';
|
|
39
38
|
import 'js-cookie';
|
|
40
39
|
import 'react-hot-loader';
|
|
41
|
-
import './RouteLoader-
|
|
40
|
+
import './RouteLoader-c2faac87.js';
|
|
42
41
|
|
|
43
42
|
const servers = SERVERS;
|
|
44
43
|
/* global SERVERS */
|
|
@@ -217,43 +216,6 @@ const handleResponse = (request, response, content, send = 'send') => {
|
|
|
217
216
|
response[send](content);
|
|
218
217
|
};
|
|
219
218
|
|
|
220
|
-
const addStandardHeaders = (state, response, packagejson, groups) => {
|
|
221
|
-
if (state) {
|
|
222
|
-
try {
|
|
223
|
-
console.info('About to add headers');
|
|
224
|
-
const routingSurrogateKeys = state.getIn(['routing', 'surrogateKeys'], '');
|
|
225
|
-
const surrogateKeyHeader = ` ${packagejson.name}-app ${routingSurrogateKeys}`;
|
|
226
|
-
response.header('surrogate-key', surrogateKeyHeader);
|
|
227
|
-
addVarnishAuthenticationHeaders(state, response, groups);
|
|
228
|
-
response.setHeader('Surrogate-Control', `max-age=${getCacheDuration(response.statusCode)}`);
|
|
229
|
-
} catch (e) {
|
|
230
|
-
console.info('Error Adding headers', e.message);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
const addVarnishAuthenticationHeaders = (state, response, groups = {}) => {
|
|
235
|
-
if (state) {
|
|
236
|
-
try {
|
|
237
|
-
const stateEntry = selectRouteEntry(state);
|
|
238
|
-
const project = selectCurrentProject(state);
|
|
239
|
-
const {
|
|
240
|
-
globalGroups,
|
|
241
|
-
allowedGroups
|
|
242
|
-
} = groups; // console.info(globalGroups, allowedGroups);
|
|
243
|
-
|
|
244
|
-
let allGroups = Array.from(globalGroups && globalGroups[project] || {});
|
|
245
|
-
|
|
246
|
-
if (stateEntry && stateEntry.getIn(['authentication', 'isLoginRequired']) && allowedGroups && allowedGroups[project]) {
|
|
247
|
-
allGroups = [...allGroups, ...allowedGroups[project]];
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
response.header('x-contensis-viewer-groups', allGroups.join('|'));
|
|
251
|
-
} catch (e) {
|
|
252
|
-
console.info('Error adding authentication header', e);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
|
|
257
219
|
const readFileSync = path => fs.readFileSync(path, 'utf8');
|
|
258
220
|
|
|
259
221
|
const loadableBundleData = ({
|
|
@@ -337,8 +299,46 @@ const getBundleTags = (loadableExtractor, scripts, staticRoutePath = 'static') =
|
|
|
337
299
|
return startupTag;
|
|
338
300
|
};
|
|
339
301
|
|
|
302
|
+
const addStandardHeaders = (state, response, packagejson, groups) => {
|
|
303
|
+
if (state) {
|
|
304
|
+
try {
|
|
305
|
+
console.info('About to add headers');
|
|
306
|
+
const routingSurrogateKeys = getImmutableOrJS(state, ['routing', 'surrogateKeys'], '');
|
|
307
|
+
const surrogateKeyHeader = ` ${packagejson.name}-app ${routingSurrogateKeys}`;
|
|
308
|
+
response.header('surrogate-key', surrogateKeyHeader);
|
|
309
|
+
addVarnishAuthenticationHeaders(state, response, groups);
|
|
310
|
+
response.setHeader('Surrogate-Control', `max-age=${getCacheDuration(response.statusCode)}`);
|
|
311
|
+
} catch (e) {
|
|
312
|
+
console.info('Error Adding headers', e.message);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
const addVarnishAuthenticationHeaders = (state, response, groups = {}) => {
|
|
317
|
+
if (state) {
|
|
318
|
+
try {
|
|
319
|
+
const stateEntry = selectRouteEntry(state);
|
|
320
|
+
const project = selectCurrentProject(state);
|
|
321
|
+
const {
|
|
322
|
+
globalGroups,
|
|
323
|
+
allowedGroups
|
|
324
|
+
} = groups; // console.info(globalGroups, allowedGroups);
|
|
325
|
+
|
|
326
|
+
let allGroups = Array.from(globalGroups && globalGroups[project] || {});
|
|
327
|
+
|
|
328
|
+
if (stateEntry && getImmutableOrJS(stateEntry, ['authentication', 'isLoginRequired']) && allowedGroups && allowedGroups[project]) {
|
|
329
|
+
allGroups = [...allGroups, ...allowedGroups[project]];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
response.header('x-contensis-viewer-groups', allGroups.join('|'));
|
|
333
|
+
} catch (e) {
|
|
334
|
+
console.info('Error adding authentication header', e);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
340
339
|
const webApp = (app, ReactApp, config) => {
|
|
341
340
|
const {
|
|
341
|
+
stateType = 'immutable',
|
|
342
342
|
routes,
|
|
343
343
|
withReducers,
|
|
344
344
|
withSagas,
|
|
@@ -358,7 +358,7 @@ const webApp = (app, ReactApp, config) => {
|
|
|
358
358
|
scripts.startup = scripts.startup || startupScriptFilename;
|
|
359
359
|
const responseHandler = typeof handleResponses === 'function' ? handleResponses : handleResponse;
|
|
360
360
|
const versionInfo = JSON.parse(fs.readFileSync(`dist/${staticFolderPath}/version.json`, 'utf8'));
|
|
361
|
-
app.get('/*', (request, response) => {
|
|
361
|
+
app.get('/*', async (request, response) => {
|
|
362
362
|
const {
|
|
363
363
|
url
|
|
364
364
|
} = request;
|
|
@@ -393,9 +393,9 @@ const webApp = (app, ReactApp, config) => {
|
|
|
393
393
|
|
|
394
394
|
response.status(200); // Create a store (with a memory history) from our current url
|
|
395
395
|
|
|
396
|
-
const store = createStore(withReducers,
|
|
396
|
+
const store = await createStore(withReducers, {}, history({
|
|
397
397
|
initialEntries: [url]
|
|
398
|
-
})); // dispatch any global and non-saga related actions before calling our JSX
|
|
398
|
+
}), stateType); // dispatch any global and non-saga related actions before calling our JSX
|
|
399
399
|
|
|
400
400
|
const versionStatusFromHostname = deliveryApi.getVersionStatusFromHostname(request.hostname);
|
|
401
401
|
console.info(`Request for ${request.path} hostname: ${request.hostname} versionStatus: ${versionStatusFromHostname}`);
|