@zengenti/contensis-react-base 2.5.1-beta.3 → 3.0.0-beta.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/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 +48 -65
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +63 -68
- 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 +49 -66
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +62 -65
- 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 +5 -5
- package/models/search/models/Search.d.ts +8 -1
- package/models/search/models/SearchActions.d.ts +3 -4
- 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 +1126 -533
- package/package.json +8 -9
- 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
|
@@ -1,64 +1,40 @@
|
|
|
1
1
|
import 'isomorphic-fetch';
|
|
2
|
-
import { preloadReady } from 'react-loadable';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { Router } from 'react-router-dom';
|
|
5
4
|
import { Provider } from 'react-redux';
|
|
6
5
|
import 'react-router-config';
|
|
7
6
|
import 'jsonpath-mapper';
|
|
8
|
-
import 'immutable';
|
|
9
7
|
import 'redux';
|
|
10
|
-
import 'redux-immutable';
|
|
11
8
|
import 'redux-thunk';
|
|
12
9
|
import 'redux-saga';
|
|
13
10
|
import 'redux-injectors';
|
|
14
|
-
import
|
|
15
|
-
import { s as
|
|
16
|
-
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';
|
|
17
15
|
import 'history';
|
|
18
|
-
import { d as deliveryApi,
|
|
19
|
-
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';
|
|
20
18
|
import '@redux-saga/core/effects';
|
|
21
19
|
import 'contensis-delivery-api';
|
|
22
|
-
import './
|
|
20
|
+
import './selectors-82e71d8e.js';
|
|
21
|
+
import './version-59c8f9be.js';
|
|
23
22
|
import { parse } from 'query-string';
|
|
24
|
-
import './selectors-68799788.js';
|
|
25
23
|
import 'loglevel';
|
|
26
|
-
import './ToJs-
|
|
27
|
-
import './login-
|
|
24
|
+
import './ToJs-52fee252.js';
|
|
25
|
+
import './login-92db44d1.js';
|
|
28
26
|
import 'await-to-js';
|
|
29
27
|
import 'js-cookie';
|
|
30
28
|
import { AppContainer } from 'react-hot-loader';
|
|
31
|
-
import './RouteLoader-
|
|
29
|
+
import './RouteLoader-c2faac87.js';
|
|
32
30
|
import { hydrate, render } from 'react-dom';
|
|
33
|
-
|
|
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
|
-
};
|
|
31
|
+
import { loadableReady } from '@loadable/component';
|
|
57
32
|
|
|
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
|
-
|
|
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,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CAAgBC,MAAlC,CAFS,CADI,EAKf,EALe,EAMfF,MAAM,CAACC,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;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import 'isomorphic-fetch';
|
|
2
2
|
import express from 'express';
|
|
3
|
-
import Loadable from 'react-loadable';
|
|
4
3
|
import httpProxy from 'http-proxy';
|
|
5
4
|
import fs from 'fs';
|
|
6
5
|
import path from 'path';
|
|
@@ -10,36 +9,35 @@ import { renderToString } from 'react-dom/server';
|
|
|
10
9
|
import { StaticRouter } from 'react-router-dom';
|
|
11
10
|
import { Provider } from 'react-redux';
|
|
12
11
|
import { matchRoutes } from 'react-router-config';
|
|
13
|
-
import Helmet from 'react-helmet';
|
|
12
|
+
import { Helmet } from 'react-helmet';
|
|
14
13
|
import { ServerStyleSheet } from 'styled-components';
|
|
15
14
|
import serialize from 'serialize-javascript';
|
|
16
15
|
import minifyCssString from 'minify-css-string';
|
|
17
16
|
import mapJson from 'jsonpath-mapper';
|
|
18
17
|
import { ChunkExtractor, ChunkExtractorManager } from '@loadable/server';
|
|
19
|
-
import { fromJS } from 'immutable';
|
|
20
18
|
import 'redux';
|
|
21
|
-
import 'redux-immutable';
|
|
22
19
|
import 'redux-thunk';
|
|
23
20
|
import 'redux-saga';
|
|
24
21
|
import 'redux-injectors';
|
|
25
|
-
import
|
|
26
|
-
import { s as
|
|
27
|
-
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';
|
|
28
26
|
import 'history';
|
|
29
|
-
import { h as history, d as deliveryApi, p as pickProject, r as rootSaga } from './App-
|
|
30
|
-
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';
|
|
31
29
|
import '@redux-saga/core/effects';
|
|
32
30
|
import 'contensis-delivery-api';
|
|
33
|
-
import './
|
|
31
|
+
import { g as getImmutableOrJS, s as selectRouteEntry, a as selectCurrentProject } from './selectors-82e71d8e.js';
|
|
32
|
+
import './version-59c8f9be.js';
|
|
34
33
|
import 'query-string';
|
|
35
|
-
import { s as selectRouteEntry, a as selectCurrentProject } from './selectors-68799788.js';
|
|
36
34
|
import 'loglevel';
|
|
37
|
-
import './ToJs-
|
|
38
|
-
import './login-
|
|
35
|
+
import './ToJs-52fee252.js';
|
|
36
|
+
import './login-92db44d1.js';
|
|
39
37
|
import 'await-to-js';
|
|
40
38
|
import 'js-cookie';
|
|
41
39
|
import 'react-hot-loader';
|
|
42
|
-
import './RouteLoader-
|
|
40
|
+
import './RouteLoader-c2faac87.js';
|
|
43
41
|
|
|
44
42
|
const servers = SERVERS;
|
|
45
43
|
/* global SERVERS */
|
|
@@ -218,43 +216,6 @@ const handleResponse = (request, response, content, send = 'send') => {
|
|
|
218
216
|
response[send](content);
|
|
219
217
|
};
|
|
220
218
|
|
|
221
|
-
const addStandardHeaders = (state, response, packagejson, groups) => {
|
|
222
|
-
if (state) {
|
|
223
|
-
try {
|
|
224
|
-
console.info('About to add headers');
|
|
225
|
-
const routingSurrogateKeys = state.getIn(['routing', 'surrogateKeys'], '');
|
|
226
|
-
const surrogateKeyHeader = ` ${packagejson.name}-app ${routingSurrogateKeys}`;
|
|
227
|
-
response.header('surrogate-key', surrogateKeyHeader);
|
|
228
|
-
addVarnishAuthenticationHeaders(state, response, groups);
|
|
229
|
-
response.setHeader('Surrogate-Control', `max-age=${getCacheDuration(response.statusCode)}`);
|
|
230
|
-
} catch (e) {
|
|
231
|
-
console.info('Error Adding headers', e.message);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
const addVarnishAuthenticationHeaders = (state, response, groups = {}) => {
|
|
236
|
-
if (state) {
|
|
237
|
-
try {
|
|
238
|
-
const stateEntry = selectRouteEntry(state);
|
|
239
|
-
const project = selectCurrentProject(state);
|
|
240
|
-
const {
|
|
241
|
-
globalGroups,
|
|
242
|
-
allowedGroups
|
|
243
|
-
} = groups; // console.info(globalGroups, allowedGroups);
|
|
244
|
-
|
|
245
|
-
let allGroups = Array.from(globalGroups && globalGroups[project] || {});
|
|
246
|
-
|
|
247
|
-
if (stateEntry && stateEntry.getIn(['authentication', 'isLoginRequired']) && allowedGroups && allowedGroups[project]) {
|
|
248
|
-
allGroups = [...allGroups, ...allowedGroups[project]];
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
response.header('x-contensis-viewer-groups', allGroups.join('|'));
|
|
252
|
-
} catch (e) {
|
|
253
|
-
console.info('Error adding authentication header', e);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
|
|
258
219
|
const readFileSync = path => fs.readFileSync(path, 'utf8');
|
|
259
220
|
|
|
260
221
|
const loadableBundleData = ({
|
|
@@ -338,8 +299,46 @@ const getBundleTags = (loadableExtractor, scripts, staticRoutePath = 'static') =
|
|
|
338
299
|
return startupTag;
|
|
339
300
|
};
|
|
340
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
|
+
|
|
341
339
|
const webApp = (app, ReactApp, config) => {
|
|
342
340
|
const {
|
|
341
|
+
stateType = 'immutable',
|
|
343
342
|
routes,
|
|
344
343
|
withReducers,
|
|
345
344
|
withSagas,
|
|
@@ -359,7 +358,7 @@ const webApp = (app, ReactApp, config) => {
|
|
|
359
358
|
scripts.startup = scripts.startup || startupScriptFilename;
|
|
360
359
|
const responseHandler = typeof handleResponses === 'function' ? handleResponses : handleResponse;
|
|
361
360
|
const versionInfo = JSON.parse(fs.readFileSync(`dist/${staticFolderPath}/version.json`, 'utf8'));
|
|
362
|
-
app.get('/*', (request, response) => {
|
|
361
|
+
app.get('/*', async (request, response) => {
|
|
363
362
|
const {
|
|
364
363
|
url
|
|
365
364
|
} = request;
|
|
@@ -394,9 +393,9 @@ const webApp = (app, ReactApp, config) => {
|
|
|
394
393
|
|
|
395
394
|
response.status(200); // Create a store (with a memory history) from our current url
|
|
396
395
|
|
|
397
|
-
const store = createStore(withReducers,
|
|
396
|
+
const store = await createStore(withReducers, {}, history({
|
|
398
397
|
initialEntries: [url]
|
|
399
|
-
})); // 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
|
|
400
399
|
|
|
401
400
|
const versionStatusFromHostname = deliveryApi.getVersionStatusFromHostname(request.hostname);
|
|
402
401
|
console.info(`Request for ${request.path} hostname: ${request.hostname} versionStatus: ${versionStatusFromHostname}`);
|
|
@@ -559,17 +558,15 @@ const start = (ReactApp, config, ServerFeatures) => {
|
|
|
559
558
|
app.on('ready', async () => {
|
|
560
559
|
// Configure DNS to make life easier
|
|
561
560
|
// await ConfigureLocalDNS();
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
console.info('GoodBye :(');
|
|
572
|
-
});
|
|
561
|
+
const server = app.listen(3001, () => {
|
|
562
|
+
console.info(`HTTP server is listening @ port 3001`);
|
|
563
|
+
setTimeout(function () {
|
|
564
|
+
app.emit('app_started');
|
|
565
|
+
}, 500);
|
|
566
|
+
});
|
|
567
|
+
app.on('stop', () => {
|
|
568
|
+
server.close(function () {
|
|
569
|
+
console.info('GoodBye :(');
|
|
573
570
|
});
|
|
574
571
|
});
|
|
575
572
|
});
|