@zengenti/contensis-react-base 4.0.0-beta.58 → 4.0.0-beta.59
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/cjs/{App-C5hfqiyz.js → App-Dr56ZsQj.js} +2 -1
- package/{esm/App-BVdAv4vL.js.map → cjs/App-Dr56ZsQj.js.map} +1 -1
- package/cjs/client.js +4 -3
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +22 -6
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/util.js +9 -0
- package/cjs/util.js.map +1 -1
- package/esm/{App-BVdAv4vL.js → App-CrCf7gso.js} +2 -1
- package/{cjs/App-C5hfqiyz.js.map → esm/App-CrCf7gso.js.map} +1 -1
- package/esm/client.js +5 -4
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +23 -7
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/util.js +1 -0
- package/esm/util.js.map +1 -1
- package/models/server/util/jsx.d.ts +1 -0
- package/models/util/index.d.ts +1 -0
- package/package.json +2 -1
package/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../src/client/client.tsx"],"sourcesContent":["import 'isomorphic-fetch';\nimport React from 'react';\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { unstable_HistoryRouter as HistoryRouter } from 'react-router-dom';\nimport { loadableReady } from '@loadable/component';\nimport { parse } from 'query-string';\nimport { CookiesProvider } from 'react-cookie';\n\nimport { createLocaleRoutes } from '~/i18n/routes';\nimport { actions } from '~/i18n/redux/slice';\nimport { selectVersionStatus } from '~/redux/selectors/version';\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';\nimport { SSRContextProvider } from '~/util/SSRContext';\n\nimport { AppConfig, AppState } from '~/models';\n\ndeclare let window: typeof globalThis & {\n isDynamic: boolean;\n REDUX_DATA: AppState;\n __USE_HYDRATE__: boolean;\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') as HTMLElement;\n\n const {\n i18n,\n // stateType = 'immutable', // changed default in v4\n stateType = 'js',\n routes,\n withReducers,\n withSagas,\n withEvents,\n } = config;\n\n // process locales in static routes for i18n\n const localeRoutes = createLocaleRoutes(routes);\n\n const GetClientJSX = store => {\n const ClientJsx = (\n <CookiesProvider>\n <ReduxProvider store={store}>\n <HistoryRouter\n history={history as any}\n future={{\n v7_relativeSplatPath: true,\n v7_startTransition: true,\n }}\n >\n <SSRContextProvider>\n <ReactApp routes={routes} withEvents={withEvents} />\n </SSRContextProvider>\n </HistoryRouter>\n </ReduxProvider>\n </CookiesProvider>\n );\n return ClientJsx;\n };\n\n const isDev = process.env.NODE_ENV !== 'production';\n // const isProduction = !isDev;\n const shouldHydrate = window.__USE_HYDRATE__ && !window.isDynamic;\n\n /**\n * Webpack HMR Setup.\n */\n const HMRRenderer = Component => {\n if (shouldHydrate)\n loadableReady(\n () => {\n hydrateRoot(documentRoot, Component, {\n onRecoverableError(error) {\n console.warn('Hydration warning:', error);\n },\n });\n },\n { namespace: 'modern' }\n );\n else createRoot(documentRoot).render(Component);\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 = parse(window.location.search);\n const versionStatus = deliveryApi.getClientSideVersionStatus();\n\n if (isDev || window.isDynamic || window.REDUX_DATA) {\n createStore(withReducers, window.REDUX_DATA, history, stateType).then(\n store => {\n const state = store.getState();\n const ssrVersionStatus = selectVersionStatus(state);\n if (!ssrVersionStatus)\n store.dispatch(setVersionStatus(versionStatus));\n\n if (isDev && window.REDUX_DATA)\n console.log('Hydrating from inline Redux');\n\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n if (i18n) {\n store.dispatch(\n actions.INIT_LOCALES({\n locales: {},\n // Keep a record of the locale routes in Redux\n // so we can navigate between them when switching language\n routes: localeRoutes,\n ...i18n,\n })\n );\n }\n\n delete (window as any).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 const ssRedux = JSON.parse(data);\n createStore(withReducers, ssRedux, history, stateType).then(store => {\n store.dispatch(setVersionStatus(versionStatus));\n\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 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","i18n","stateType","routes","withReducers","withSagas","withEvents","localeRoutes","createLocaleRoutes","GetClientJSX","store","ClientJsx","React","createElement","CookiesProvider","ReduxProvider","HistoryRouter","history","future","v7_relativeSplatPath","v7_startTransition","SSRContextProvider","isDev","process","env","NODE_ENV","shouldHydrate","window","__USE_HYDRATE__","isDynamic","HMRRenderer","Component","loadableReady","hydrateRoot","onRecoverableError","error","console","warn","namespace","createRoot","render","hmr","module","hot","accept","qs","parse","location","search","versionStatus","deliveryApi","getClientSideVersionStatus","REDUX_DATA","createStore","then","state","getState","ssrVersionStatus","selectVersionStatus","dispatch","setVersionStatus","log","runSaga","rootSaga","setCurrentProject","pickProject","hostname","actions","INIT_LOCALES","locales","fetch","pathname","response","json","data","ssRedux","J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ACC,YAAQ,CAAC1D,SAAS,CAAC,CAAC;UAClCK,KAAK,CAACiD,QAAQ,CACZK,2BAAiB,CACfC,eAAW,CAACtC,MAAM,CAACoB,QAAQ,CAACmB,QAAQ,EAAErB,EAAE,CAAC,EACzC,EAAE,EACFlB,MAAM,CAACoB,QAAQ,CAACmB,QAClB,CACF,CAAC;AAEDpC,UAAAA,WAAW,CAACrB,YAAY,CAACC,KAAK,CAAC,CAAC;UAEhC+B,GAAG,CAAC/B,KAAK,CAAC;AACZ,QAAA,CAAC,CAAC;AACJ,MAAA,CAAC,CAAC;AACN,IAAA;AACF,EAAA;AACF;;;;;"}
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../src/client/client.tsx"],"sourcesContent":["import 'isomorphic-fetch';\nimport React from 'react';\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { unstable_HistoryRouter as HistoryRouter } from 'react-router-dom';\nimport { loadableReady } from '@loadable/component';\nimport { parse } from 'query-string';\nimport { CookiesProvider } from 'react-cookie';\nimport { HelmetProvider } from 'react-helmet-async';\n\nimport { createLocaleRoutes } from '~/i18n/routes';\nimport { actions } from '~/i18n/redux/slice';\nimport { selectVersionStatus } from '~/redux/selectors/version';\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';\nimport { SSRContextProvider } from '~/util/SSRContext';\n\nimport { AppConfig, AppState } from '~/models';\n\ndeclare let window: typeof globalThis & {\n isDynamic: boolean;\n REDUX_DATA: AppState;\n __USE_HYDRATE__: boolean;\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') as HTMLElement;\n\n const {\n i18n,\n // stateType = 'immutable', // changed default in v4\n stateType = 'js',\n routes,\n withReducers,\n withSagas,\n withEvents,\n } = config;\n\n // process locales in static routes for i18n\n const localeRoutes = createLocaleRoutes(routes);\n\n const GetClientJSX = store => {\n const ClientJsx = (\n <HelmetProvider>\n <CookiesProvider>\n <ReduxProvider store={store}>\n <HistoryRouter\n history={history as any}\n future={{\n v7_relativeSplatPath: true,\n v7_startTransition: true,\n }}\n >\n <SSRContextProvider>\n <ReactApp routes={routes} withEvents={withEvents} />\n </SSRContextProvider>\n </HistoryRouter>\n </ReduxProvider>\n </CookiesProvider>\n </HelmetProvider>\n );\n return ClientJsx;\n };\n\n const isDev = process.env.NODE_ENV !== 'production';\n // const isProduction = !isDev;\n const shouldHydrate = window.__USE_HYDRATE__ && !window.isDynamic;\n\n /**\n * Webpack HMR Setup.\n */\n const HMRRenderer = Component => {\n if (shouldHydrate)\n loadableReady(\n () => {\n hydrateRoot(documentRoot, Component, {\n onRecoverableError(error) {\n console.warn('Hydration warning:', error);\n },\n });\n },\n { namespace: 'modern' }\n );\n else createRoot(documentRoot).render(Component);\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 = parse(window.location.search);\n const versionStatus = deliveryApi.getClientSideVersionStatus();\n\n if (isDev || window.isDynamic || window.REDUX_DATA) {\n createStore(withReducers, window.REDUX_DATA, history, stateType).then(\n store => {\n const state = store.getState();\n const ssrVersionStatus = selectVersionStatus(state);\n if (!ssrVersionStatus)\n store.dispatch(setVersionStatus(versionStatus));\n\n if (isDev && window.REDUX_DATA)\n console.log('Hydrating from inline Redux');\n\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n if (i18n) {\n store.dispatch(\n actions.INIT_LOCALES({\n locales: {},\n // Keep a record of the locale routes in Redux\n // so we can navigate between them when switching language\n routes: localeRoutes,\n ...i18n,\n })\n );\n }\n\n delete (window as any).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 const ssRedux = JSON.parse(data);\n createStore(withReducers, ssRedux, history, stateType).then(store => {\n store.dispatch(setVersionStatus(versionStatus));\n\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 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","i18n","stateType","routes","withReducers","withSagas","withEvents","localeRoutes","createLocaleRoutes","GetClientJSX","store","ClientJsx","React","createElement","HelmetProvider","CookiesProvider","ReduxProvider","HistoryRouter","history","future","v7_relativeSplatPath","v7_startTransition","SSRContextProvider","isDev","process","env","NODE_ENV","shouldHydrate","window","__USE_HYDRATE__","isDynamic","HMRRenderer","Component","loadableReady","hydrateRoot","onRecoverableError","error","console","warn","namespace","createRoot","render","hmr","module","hot","accept","qs","parse","location","search","versionStatus","deliveryApi","getClientSideVersionStatus","REDUX_DATA","createStore","then","state","getState","ssrVersionStatus","selectVersionStatus","dispatch","setVersionStatus","log","runSaga","rootSaga","setCurrentProject","pickProject","hostname","actions","INIT_LOCALES","locales","fetch","pathname","response","json","data","ssRedux","JSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAMA,SAAS,CAAC;AACdC,EAAAA,WAAWA,CAACC,QAA4C,EAAEC,MAAiB,EAAE;AAC3E,IAAA,MAAMC,YAAY,GAAGC,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAgB;IAEnE,MAAM;MACJC,IA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,CAACmB,QAClB,CACF,CAAC;AAEDpC,UAAAA,WAAW,CAACtB,YAAY,CAACC,KAAK,CAAC,CAAC;UAEhCgC,GAAG,CAAChC,KAAK,CAAC;AACZ,QAAA,CAAC,CAAC;AACJ,MAAA,CAAC,CAAC;AACN,IAAA;AACF,EAAA;AACF;;;;;"}
|
|
@@ -32,7 +32,7 @@ var lodash = require('lodash');
|
|
|
32
32
|
var lodashClean = require('lodash-clean');
|
|
33
33
|
var CookieHelper_class = require('./CookieHelper.class-Det3qfdU.js');
|
|
34
34
|
var cookiesMiddleware = require('universal-cookie-express');
|
|
35
|
-
var App = require('./App-
|
|
35
|
+
var App = require('./App-Dr56ZsQj.js');
|
|
36
36
|
var store = require('./store-Dn7vP6G0.js');
|
|
37
37
|
var version = require('./version-2FamXHhj.js');
|
|
38
38
|
var selectors = require('./selectors-BrxJ8-F8.js');
|
|
@@ -42,6 +42,7 @@ var server$2 = require('@loadable/server');
|
|
|
42
42
|
var chalk = require('chalk');
|
|
43
43
|
var minifyCssString = require('minify-css-string');
|
|
44
44
|
var reactCookie = require('react-cookie');
|
|
45
|
+
var reactHelmetAsync = require('react-helmet-async');
|
|
45
46
|
var server$3 = require('react-router-dom/server');
|
|
46
47
|
var SSRContext = require('./SSRContext-DotLlTQc.js');
|
|
47
48
|
require('./VersionInfo-zFPsvS8q.js');
|
|
@@ -1224,7 +1225,9 @@ const ssrJsxProducer = (ReactApp, {
|
|
|
1224
1225
|
var _providers$styledComp;
|
|
1225
1226
|
// Recast ChunkExtractorManager to avoid TS error `Property 'children' does not exist on type...`
|
|
1226
1227
|
const ChunkExtractor = server$2.ChunkExtractorManager;
|
|
1227
|
-
const jsx = /*#__PURE__*/React__default.default.createElement(
|
|
1228
|
+
const jsx = /*#__PURE__*/React__default.default.createElement(reactHelmetAsync.HelmetProvider, {
|
|
1229
|
+
context: providers.helmet
|
|
1230
|
+
}, /*#__PURE__*/React__default.default.createElement(ChunkExtractor, {
|
|
1228
1231
|
extractor: providers.loadable.extractor
|
|
1229
1232
|
}, /*#__PURE__*/React__default.default.createElement(reactCookie.CookiesProvider, {
|
|
1230
1233
|
cookies: providers.cookies
|
|
@@ -1246,7 +1249,7 @@ const ssrJsxProducer = (ReactApp, {
|
|
|
1246
1249
|
}, /*#__PURE__*/React__default.default.createElement(ReactApp, {
|
|
1247
1250
|
routes: props.routes,
|
|
1248
1251
|
withEvents: props.withEvents
|
|
1249
|
-
})))))));
|
|
1252
|
+
}))))))));
|
|
1250
1253
|
|
|
1251
1254
|
// Wrap the JSX in a StyleSheetManager if a ServerStyleSheet is provided
|
|
1252
1255
|
return !((_providers$styledComp = providers.styledComponents) !== null && _providers$styledComp !== void 0 && _providers$styledComp.sheet) ? jsx : providers.styledComponents.sheet.collectStyles(jsx);
|
|
@@ -1366,12 +1369,17 @@ const webApp = (app, ReactApp, config) => {
|
|
|
1366
1369
|
// and read back any context props set by the ReactApp
|
|
1367
1370
|
const context = {};
|
|
1368
1371
|
|
|
1372
|
+
// Per-request helmet context object — populated by HelmetProvider during renderToString
|
|
1373
|
+
// Using a fresh object per request ensures thread safety under concurrent SSR requests
|
|
1374
|
+
const helmetContext = {};
|
|
1375
|
+
|
|
1369
1376
|
// Amalgamate all props for the various Providers we wrap the ReactApp with
|
|
1370
1377
|
const jsxProviderProps = {
|
|
1371
1378
|
loadable: {
|
|
1372
1379
|
extractor: loadableExtractor.commonLoadableExtractor
|
|
1373
1380
|
},
|
|
1374
1381
|
cookies: ssrCookies,
|
|
1382
|
+
helmet: helmetContext,
|
|
1375
1383
|
redux: store$1,
|
|
1376
1384
|
httpContext: context,
|
|
1377
1385
|
router: {
|
|
@@ -1488,15 +1496,23 @@ const webApp = (app, ReactApp, config) => {
|
|
|
1488
1496
|
const html = server$1.renderToString(styledJsx);
|
|
1489
1497
|
// Helmet.renderStatic() has to be called synchronously immediately after calling renderToString()
|
|
1490
1498
|
// as it is not thread-safe (or specifically scoped to only this request)
|
|
1499
|
+
// TODO: deprecate `react-helmet`
|
|
1491
1500
|
const helmet = reactHelmet.Helmet.renderStatic();
|
|
1492
1501
|
|
|
1502
|
+
// helmetContext is populated synchronously by HelmetProvider during renderToString()
|
|
1503
|
+
// It is scoped per-request via the helmetContext object, making this thread-safe
|
|
1504
|
+
// under concurrent SSR requests (unlike the previous Helmet.renderStatic() global singleton)
|
|
1505
|
+
const {
|
|
1506
|
+
helmet: helmetAsync
|
|
1507
|
+
} = helmetContext;
|
|
1508
|
+
|
|
1493
1509
|
// Because we have had to call renderToString() here to reliably gather all helmet metadata
|
|
1494
1510
|
// We could potentially call sheet.getStyleTags() here too and avoid piping a react-rendered
|
|
1495
1511
|
// stream to a second stream to inject styled-components CSS
|
|
1496
1512
|
|
|
1497
|
-
const htmlAttributes = helmet.htmlAttributes.toString();
|
|
1498
|
-
let title = helmet.title.toString();
|
|
1499
|
-
const metadata = helmet.meta.toString().concat(helmet.base.toString()).concat(helmet.link.toString()).concat(helmet.script.toString()).concat(helmet.noscript.toString());
|
|
1513
|
+
const htmlAttributes = helmetAsync.htmlAttributes.toString() || helmet.htmlAttributes.toString();
|
|
1514
|
+
let title = helmet.title.toString().includes('><') ? helmetAsync.title.toString() : helmet.title.toString();
|
|
1515
|
+
const metadata = helmetAsync.meta.toString().concat(helmetAsync.base.toString()).concat(helmetAsync.priority.toString()).concat(helmetAsync.link.toString()).concat(helmetAsync.script.toString()).concat(helmetAsync.noscript.toString()).concat(helmet.meta.toString()).concat(helmet.base.toString()).concat(helmet.link.toString()).concat(helmet.script.toString()).concat(helmet.noscript.toString());
|
|
1500
1516
|
try {
|
|
1501
1517
|
/**
|
|
1502
1518
|
* Loads all page assets into the provided templateHTML
|