@zengenti/contensis-react-base 3.0.2-beta.9 → 4.0.0-beta.1
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 +38 -2
- package/cjs/{App-81a45001.js → App-cf7e3103.js} +69 -34
- package/cjs/App-cf7e3103.js.map +1 -0
- package/cjs/{login-51b66359.js → ChangePassword.container-a617190b.js} +246 -84
- package/cjs/ChangePassword.container-a617190b.js.map +1 -0
- package/cjs/{ContensisDeliveryApi-de88df2a.js → ContensisDeliveryApi-9e32960d.js} +156 -122
- package/cjs/ContensisDeliveryApi-9e32960d.js.map +1 -0
- package/cjs/CookieConstants-000427db.js +10 -0
- package/cjs/CookieConstants-000427db.js.map +1 -0
- package/cjs/{RouteLoader-47d70a26.js → RouteLoader-3e284fd6.js} +9 -7
- package/cjs/RouteLoader-3e284fd6.js.map +1 -0
- package/cjs/{ToJs-61c03582.js → ToJs-149fc5e1.js} +49 -2
- package/cjs/ToJs-149fc5e1.js.map +1 -0
- package/cjs/_commonjsHelpers-b3309d7b.js +11 -0
- package/cjs/_commonjsHelpers-b3309d7b.js.map +1 -0
- package/cjs/client.js +43 -17
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +49 -362
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +3495 -127
- package/cjs/forms.js.map +1 -1
- package/cjs/redux.js +3 -4
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +4 -4
- package/cjs/{sagas-6d12e7ca.js → sagas-e04b94c1.js} +44 -20
- package/cjs/sagas-e04b94c1.js.map +1 -0
- package/cjs/search.js +13 -13
- package/cjs/search.js.map +1 -1
- package/cjs/{selectors-c76c2676.js → selectors-46b689d0.js} +11 -11
- package/cjs/selectors-46b689d0.js.map +1 -0
- package/cjs/user.js +33 -159
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +6 -4
- package/cjs/util.js.map +1 -1
- package/cjs/{version-38afaf2a.js → version-79a027cb.js} +12 -23
- package/cjs/version-79a027cb.js.map +1 -0
- package/cjs/{version-886f49d8.js → version-afd4f77e.js} +3 -3
- package/cjs/{version-886f49d8.js.map → version-afd4f77e.js.map} +1 -1
- package/esm/{App-5f914483.js → App-6e8e803b.js} +63 -29
- package/esm/App-6e8e803b.js.map +1 -0
- package/esm/{login-4d07c2de.js → ChangePassword.container-ae0f9ce4.js} +229 -78
- package/esm/ChangePassword.container-ae0f9ce4.js.map +1 -0
- package/esm/{ContensisDeliveryApi-ad06857d.js → ContensisDeliveryApi-c66b0cc3.js} +155 -123
- package/esm/ContensisDeliveryApi-c66b0cc3.js.map +1 -0
- package/esm/CookieConstants-3d3b6531.js +6 -0
- package/esm/CookieConstants-3d3b6531.js.map +1 -0
- package/esm/{RouteLoader-f5d5f733.js → RouteLoader-e3c5505f.js} +9 -7
- package/esm/RouteLoader-e3c5505f.js.map +1 -0
- package/esm/{ToJs-0066e629.js → ToJs-ae860aad.js} +49 -3
- package/esm/ToJs-ae860aad.js.map +1 -0
- package/esm/_commonjsHelpers-1789f0cf.js +8 -0
- package/esm/_commonjsHelpers-1789f0cf.js.map +1 -0
- package/esm/client.js +43 -18
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +48 -362
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +3497 -129
- package/esm/forms.js.map +1 -1
- package/esm/redux.js +6 -7
- package/esm/redux.js.map +1 -1
- package/esm/routing.js +4 -4
- package/esm/{sagas-53d2aefb.js → sagas-933a8fc8.js} +44 -20
- package/esm/sagas-933a8fc8.js.map +1 -0
- package/esm/search.js +14 -14
- package/esm/search.js.map +1 -1
- package/esm/{selectors-3f0d804d.js → selectors-01074974.js} +11 -12
- package/esm/selectors-01074974.js.map +1 -0
- package/esm/user.js +21 -151
- package/esm/user.js.map +1 -1
- package/esm/util.js +4 -4
- package/esm/util.js.map +1 -1
- package/esm/{version-f4629693.js → version-0fbd1b82.js} +3 -3
- package/esm/{version-f4629693.js.map → version-0fbd1b82.js.map} +1 -1
- package/esm/{version-dd31c7f0.js → version-346a9787.js} +13 -23
- package/esm/version-346a9787.js.map +1 -0
- package/models/app/App.d.ts +3 -3
- package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +5 -3
- package/models/client/client.d.ts +1 -1
- package/models/config.d.ts +4 -4
- package/models/redux/appstate.d.ts +2 -1
- package/models/routing/components/Loading.d.ts +2 -2
- package/models/routing/components/NotFound.d.ts +2 -2
- package/models/routing/components/Status.d.ts +1 -1
- package/models/routing/redux/actions.d.ts +10 -6
- package/models/routing/redux/selectors.d.ts +5 -4
- package/models/routing/redux/types.d.ts +0 -1
- package/models/routing/routes.d.ts +20 -17
- package/models/routing/util/queries.d.ts +3 -2
- package/models/search/models/Queries.d.ts +9 -10
- package/models/search/models/Search.d.ts +26 -24
- package/models/search/models/SearchActions.d.ts +36 -36
- package/models/search/models/SearchState.d.ts +11 -11
- package/models/search/models/SearchUtil.d.ts +1 -1
- package/models/search/models/WithSearch.d.ts +1 -1
- package/models/search/redux/actions.d.ts +7 -7
- package/models/search/redux/selectors.d.ts +27 -27
- package/models/search/redux/types.d.ts +21 -21
- package/models/search/redux/util.d.ts +2 -2
- package/models/search/search/ContensisDeliveryApi.d.ts +1 -1
- package/models/search/search/expressions.d.ts +4 -4
- package/models/search/search/util.d.ts +2 -2
- package/models/search/transformations/state-to-queryparams.mapper.d.ts +1 -1
- package/models/server/features/linkdepth-api/LinkDepthSearchService.d.ts +1 -1
- package/models/server/features/linkdepth-api/search.d.ts +3 -3
- package/models/server/internalServer.d.ts +7 -5
- package/models/server/util/bundles.d.ts +2 -2
- package/models/server/util/handleExceptions.d.ts +1 -1
- package/models/testImmer/redux/reducer.d.ts +1 -1
- package/models/user/components/Login.d.ts +2 -2
- package/models/user/components/LoginForm.d.ts +2 -1
- package/models/user/components/LogoutForm.d.ts +2 -1
- package/models/user/containers/ChangePassword.container.d.ts +2 -2
- package/models/user/containers/ForgotPassword.container.d.ts +2 -2
- package/models/user/containers/Login.container.d.ts +2 -2
- package/models/user/containers/Registration.container.d.ts +2 -2
- package/models/user/hocs/withLogin.d.ts +6 -11
- package/models/user/hocs/withRegistration.d.ts +2 -8
- package/models/user/redux/actions.d.ts +2 -2
- package/models/user/redux/sagas/login.d.ts +9 -8
- package/models/user/redux/selectors.d.ts +4 -4
- package/models/user/util/CookieConstants.d.ts +8 -0
- package/models/user/util/CookieHelper.class.d.ts +15 -3
- package/models/user/util/LoginHelper.class.d.ts +27 -23
- package/models/util/CachedDeliveryApi.d.ts +25 -0
- package/models/util/ContensisDeliveryApi.d.ts +20 -44
- package/models/util/LruCache.d.ts +12 -0
- package/models/util/ToJs.d.ts +1 -1
- package/models/util/index.d.ts +1 -1
- package/models/util/json-mapper.d.ts +1 -1
- package/package.json +14 -16
- package/cjs/App-81a45001.js.map +0 -1
- package/cjs/ContensisDeliveryApi-de88df2a.js.map +0 -1
- package/cjs/RouteLoader-47d70a26.js.map +0 -1
- package/cjs/ToJs-61c03582.js.map +0 -1
- package/cjs/login-51b66359.js.map +0 -1
- package/cjs/sagas-6d12e7ca.js.map +0 -1
- package/cjs/selectors-c76c2676.js.map +0 -1
- package/cjs/version-38afaf2a.js.map +0 -1
- package/esm/App-5f914483.js.map +0 -1
- package/esm/ContensisDeliveryApi-ad06857d.js.map +0 -1
- package/esm/RouteLoader-f5d5f733.js.map +0 -1
- package/esm/ToJs-0066e629.js.map +0 -1
- package/esm/login-4d07c2de.js.map +0 -1
- package/esm/sagas-53d2aefb.js.map +0 -1
- package/esm/selectors-3f0d804d.js.map +0 -1
- package/esm/version-dd31c7f0.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as cachedSearch, d as deliveryApi } from './ContensisDeliveryApi-
|
|
1
|
+
import { c as cachedSearch, d as deliveryApi } from './ContensisDeliveryApi-c66b0cc3.js';
|
|
2
2
|
import { Query as Query$1 } from 'contensis-delivery-api';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Provider } from 'react-redux';
|
|
@@ -6,7 +6,7 @@ import mapJson from 'jsonpath-mapper';
|
|
|
6
6
|
import 'reselect';
|
|
7
7
|
import 'deepmerge';
|
|
8
8
|
import 'query-string';
|
|
9
|
-
import { d as defaultExpressions, c as contentTypeIdExpression, f as filterExpressions, t as termExpressions, o as orderByExpression, a as customWhereExpressions } from './sagas-
|
|
9
|
+
import { d as defaultExpressions, c as contentTypeIdExpression, f as filterExpressions, t as termExpressions, o as orderByExpression, a as customWhereExpressions } from './sagas-933a8fc8.js';
|
|
10
10
|
import 'immer';
|
|
11
11
|
import 'deep-equal';
|
|
12
12
|
import { Op, Query } from 'contensis-core-api';
|
|
@@ -23,18 +23,21 @@ import { StaticRouter } from 'react-router-dom';
|
|
|
23
23
|
import { matchRoutes } from 'react-router-config';
|
|
24
24
|
import { Helmet } from 'react-helmet';
|
|
25
25
|
import { ServerStyleSheet } from 'styled-components';
|
|
26
|
-
import serialize
|
|
26
|
+
import serialize from 'serialize-javascript';
|
|
27
27
|
import minifyCssString from 'minify-css-string';
|
|
28
28
|
import { ChunkExtractor, ChunkExtractorManager } from '@loadable/server';
|
|
29
29
|
import { identity, noop } from 'lodash';
|
|
30
|
+
import { c as commonjsGlobal } from './_commonjsHelpers-1789f0cf.js';
|
|
30
31
|
import { buildCleaner } from 'lodash-clean';
|
|
31
32
|
import { CookiesProvider } from 'react-cookie';
|
|
32
|
-
import
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
import { s as
|
|
33
|
+
import cookiesMiddleware from 'universal-cookie-express';
|
|
34
|
+
import { c as createStore } from './version-346a9787.js';
|
|
35
|
+
import { h as history, p as pickProject, r as rootSaga } from './App-6e8e803b.js';
|
|
36
|
+
export { A as ReactApp } from './App-6e8e803b.js';
|
|
37
|
+
import { s as setVersionStatus, a as setVersion } from './version-0fbd1b82.js';
|
|
38
|
+
import { s as selectSurrogateKeys, a as selectRouteEntry, b as selectCurrentProject, g as getImmutableOrJS, c as setCurrentProject } from './selectors-01074974.js';
|
|
37
39
|
import chalk from 'chalk';
|
|
40
|
+
import './CookieConstants-3d3b6531.js';
|
|
38
41
|
import 'loglevel';
|
|
39
42
|
import '@redux-saga/core/effects';
|
|
40
43
|
import 'redux';
|
|
@@ -43,12 +46,10 @@ import 'redux-saga';
|
|
|
43
46
|
import 'redux-injectors';
|
|
44
47
|
import './reducers-3d5c37d1.js';
|
|
45
48
|
import 'history';
|
|
46
|
-
import './login-4d07c2de.js';
|
|
47
|
-
import './ToJs-0066e629.js';
|
|
48
49
|
import 'await-to-js';
|
|
49
|
-
import 'js
|
|
50
|
-
import '
|
|
51
|
-
import './RouteLoader-
|
|
50
|
+
import './ChangePassword.container-ae0f9ce4.js';
|
|
51
|
+
import './ToJs-ae860aad.js';
|
|
52
|
+
import './RouteLoader-e3c5505f.js';
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
55
|
* Util class holds our search results helper boilerplate methods
|
|
@@ -630,8 +631,8 @@ const makeLinkDepthMiddleware = ({
|
|
|
630
631
|
|
|
631
632
|
const servers$1 = SERVERS; /* global SERVERS */
|
|
632
633
|
const project = PROJECT; /* global PROJECT */
|
|
633
|
-
const alias = ALIAS; /* global ALIAS */
|
|
634
|
-
const deliveryApiHostname = url(alias, project).api;
|
|
634
|
+
const alias$1 = ALIAS; /* global ALIAS */
|
|
635
|
+
const deliveryApiHostname = url(alias$1, project).api;
|
|
635
636
|
const assetProxy = httpProxy.createProxyServer();
|
|
636
637
|
const deliveryProxy = httpProxy.createProxyServer();
|
|
637
638
|
const reverseProxies = (app, reverseProxyPaths = []) => {
|
|
@@ -795,8 +796,6 @@ const DisplayStartupConfiguration = config => {
|
|
|
795
796
|
/* eslint-enable no-console */
|
|
796
797
|
};
|
|
797
798
|
|
|
798
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
799
|
-
|
|
800
799
|
/**
|
|
801
800
|
* Removes all key-value entries from the list cache.
|
|
802
801
|
*
|
|
@@ -3579,332 +3578,6 @@ function cloneDeep(value) {
|
|
|
3579
3578
|
|
|
3580
3579
|
var cloneDeep_1 = cloneDeep;
|
|
3581
3580
|
|
|
3582
|
-
/*!
|
|
3583
|
-
* cookie
|
|
3584
|
-
* Copyright(c) 2012-2014 Roman Shtylman
|
|
3585
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
3586
|
-
* MIT Licensed
|
|
3587
|
-
*/
|
|
3588
|
-
|
|
3589
|
-
/**
|
|
3590
|
-
* Module exports.
|
|
3591
|
-
* @public
|
|
3592
|
-
*/
|
|
3593
|
-
|
|
3594
|
-
var parse_1 = parse;
|
|
3595
|
-
var serialize_1 = serialize;
|
|
3596
|
-
|
|
3597
|
-
/**
|
|
3598
|
-
* Module variables.
|
|
3599
|
-
* @private
|
|
3600
|
-
*/
|
|
3601
|
-
|
|
3602
|
-
var decode = decodeURIComponent;
|
|
3603
|
-
var encode = encodeURIComponent;
|
|
3604
|
-
|
|
3605
|
-
/**
|
|
3606
|
-
* RegExp to match field-content in RFC 7230 sec 3.2
|
|
3607
|
-
*
|
|
3608
|
-
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
|
3609
|
-
* field-vchar = VCHAR / obs-text
|
|
3610
|
-
* obs-text = %x80-FF
|
|
3611
|
-
*/
|
|
3612
|
-
|
|
3613
|
-
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
3614
|
-
|
|
3615
|
-
/**
|
|
3616
|
-
* Parse a cookie header.
|
|
3617
|
-
*
|
|
3618
|
-
* Parse the given cookie header string into an object
|
|
3619
|
-
* The object has the various cookies as keys(names) => values
|
|
3620
|
-
*
|
|
3621
|
-
* @param {string} str
|
|
3622
|
-
* @param {object} [options]
|
|
3623
|
-
* @return {object}
|
|
3624
|
-
* @public
|
|
3625
|
-
*/
|
|
3626
|
-
|
|
3627
|
-
function parse(str, options) {
|
|
3628
|
-
if (typeof str !== 'string') {
|
|
3629
|
-
throw new TypeError('argument str must be a string');
|
|
3630
|
-
}
|
|
3631
|
-
|
|
3632
|
-
var obj = {};
|
|
3633
|
-
var opt = options || {};
|
|
3634
|
-
var pairs = str.split(';');
|
|
3635
|
-
var dec = opt.decode || decode;
|
|
3636
|
-
|
|
3637
|
-
for (var i = 0; i < pairs.length; i++) {
|
|
3638
|
-
var pair = pairs[i];
|
|
3639
|
-
var index = pair.indexOf('=');
|
|
3640
|
-
|
|
3641
|
-
// skip things that don't look like key=value
|
|
3642
|
-
if (index < 0) {
|
|
3643
|
-
continue;
|
|
3644
|
-
}
|
|
3645
|
-
|
|
3646
|
-
var key = pair.substring(0, index).trim();
|
|
3647
|
-
|
|
3648
|
-
// only assign once
|
|
3649
|
-
if (undefined == obj[key]) {
|
|
3650
|
-
var val = pair.substring(index + 1, pair.length).trim();
|
|
3651
|
-
|
|
3652
|
-
// quoted values
|
|
3653
|
-
if (val[0] === '"') {
|
|
3654
|
-
val = val.slice(1, -1);
|
|
3655
|
-
}
|
|
3656
|
-
|
|
3657
|
-
obj[key] = tryDecode(val, dec);
|
|
3658
|
-
}
|
|
3659
|
-
}
|
|
3660
|
-
|
|
3661
|
-
return obj;
|
|
3662
|
-
}
|
|
3663
|
-
|
|
3664
|
-
/**
|
|
3665
|
-
* Serialize data into a cookie header.
|
|
3666
|
-
*
|
|
3667
|
-
* Serialize the a name value pair into a cookie string suitable for
|
|
3668
|
-
* http headers. An optional options object specified cookie parameters.
|
|
3669
|
-
*
|
|
3670
|
-
* serialize('foo', 'bar', { httpOnly: true })
|
|
3671
|
-
* => "foo=bar; httpOnly"
|
|
3672
|
-
*
|
|
3673
|
-
* @param {string} name
|
|
3674
|
-
* @param {string} val
|
|
3675
|
-
* @param {object} [options]
|
|
3676
|
-
* @return {string}
|
|
3677
|
-
* @public
|
|
3678
|
-
*/
|
|
3679
|
-
|
|
3680
|
-
function serialize(name, val, options) {
|
|
3681
|
-
var opt = options || {};
|
|
3682
|
-
var enc = opt.encode || encode;
|
|
3683
|
-
|
|
3684
|
-
if (typeof enc !== 'function') {
|
|
3685
|
-
throw new TypeError('option encode is invalid');
|
|
3686
|
-
}
|
|
3687
|
-
|
|
3688
|
-
if (!fieldContentRegExp.test(name)) {
|
|
3689
|
-
throw new TypeError('argument name is invalid');
|
|
3690
|
-
}
|
|
3691
|
-
|
|
3692
|
-
var value = enc(val);
|
|
3693
|
-
|
|
3694
|
-
if (value && !fieldContentRegExp.test(value)) {
|
|
3695
|
-
throw new TypeError('argument val is invalid');
|
|
3696
|
-
}
|
|
3697
|
-
|
|
3698
|
-
var str = name + '=' + value;
|
|
3699
|
-
|
|
3700
|
-
if (null != opt.maxAge) {
|
|
3701
|
-
var maxAge = opt.maxAge - 0;
|
|
3702
|
-
|
|
3703
|
-
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
|
3704
|
-
throw new TypeError('option maxAge is invalid')
|
|
3705
|
-
}
|
|
3706
|
-
|
|
3707
|
-
str += '; Max-Age=' + Math.floor(maxAge);
|
|
3708
|
-
}
|
|
3709
|
-
|
|
3710
|
-
if (opt.domain) {
|
|
3711
|
-
if (!fieldContentRegExp.test(opt.domain)) {
|
|
3712
|
-
throw new TypeError('option domain is invalid');
|
|
3713
|
-
}
|
|
3714
|
-
|
|
3715
|
-
str += '; Domain=' + opt.domain;
|
|
3716
|
-
}
|
|
3717
|
-
|
|
3718
|
-
if (opt.path) {
|
|
3719
|
-
if (!fieldContentRegExp.test(opt.path)) {
|
|
3720
|
-
throw new TypeError('option path is invalid');
|
|
3721
|
-
}
|
|
3722
|
-
|
|
3723
|
-
str += '; Path=' + opt.path;
|
|
3724
|
-
}
|
|
3725
|
-
|
|
3726
|
-
if (opt.expires) {
|
|
3727
|
-
if (typeof opt.expires.toUTCString !== 'function') {
|
|
3728
|
-
throw new TypeError('option expires is invalid');
|
|
3729
|
-
}
|
|
3730
|
-
|
|
3731
|
-
str += '; Expires=' + opt.expires.toUTCString();
|
|
3732
|
-
}
|
|
3733
|
-
|
|
3734
|
-
if (opt.httpOnly) {
|
|
3735
|
-
str += '; HttpOnly';
|
|
3736
|
-
}
|
|
3737
|
-
|
|
3738
|
-
if (opt.secure) {
|
|
3739
|
-
str += '; Secure';
|
|
3740
|
-
}
|
|
3741
|
-
|
|
3742
|
-
if (opt.sameSite) {
|
|
3743
|
-
var sameSite = typeof opt.sameSite === 'string'
|
|
3744
|
-
? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
3745
|
-
|
|
3746
|
-
switch (sameSite) {
|
|
3747
|
-
case true:
|
|
3748
|
-
str += '; SameSite=Strict';
|
|
3749
|
-
break;
|
|
3750
|
-
case 'lax':
|
|
3751
|
-
str += '; SameSite=Lax';
|
|
3752
|
-
break;
|
|
3753
|
-
case 'strict':
|
|
3754
|
-
str += '; SameSite=Strict';
|
|
3755
|
-
break;
|
|
3756
|
-
case 'none':
|
|
3757
|
-
str += '; SameSite=None';
|
|
3758
|
-
break;
|
|
3759
|
-
default:
|
|
3760
|
-
throw new TypeError('option sameSite is invalid');
|
|
3761
|
-
}
|
|
3762
|
-
}
|
|
3763
|
-
|
|
3764
|
-
return str;
|
|
3765
|
-
}
|
|
3766
|
-
|
|
3767
|
-
/**
|
|
3768
|
-
* Try decoding a string using a decoding function.
|
|
3769
|
-
*
|
|
3770
|
-
* @param {string} str
|
|
3771
|
-
* @param {function} decode
|
|
3772
|
-
* @private
|
|
3773
|
-
*/
|
|
3774
|
-
|
|
3775
|
-
function tryDecode(str, decode) {
|
|
3776
|
-
try {
|
|
3777
|
-
return decode(str);
|
|
3778
|
-
} catch (e) {
|
|
3779
|
-
return str;
|
|
3780
|
-
}
|
|
3781
|
-
}
|
|
3782
|
-
|
|
3783
|
-
function hasDocumentCookie() {
|
|
3784
|
-
// Can we get/set cookies on document.cookie?
|
|
3785
|
-
return typeof document === 'object' && typeof document.cookie === 'string';
|
|
3786
|
-
}
|
|
3787
|
-
function parseCookies(cookies, options) {
|
|
3788
|
-
if (typeof cookies === 'string') {
|
|
3789
|
-
return parse_1(cookies, options);
|
|
3790
|
-
}
|
|
3791
|
-
else if (typeof cookies === 'object' && cookies !== null) {
|
|
3792
|
-
return cookies;
|
|
3793
|
-
}
|
|
3794
|
-
else {
|
|
3795
|
-
return {};
|
|
3796
|
-
}
|
|
3797
|
-
}
|
|
3798
|
-
function isParsingCookie(value, doNotParse) {
|
|
3799
|
-
if (typeof doNotParse === 'undefined') {
|
|
3800
|
-
// We guess if the cookie start with { or [, it has been serialized
|
|
3801
|
-
doNotParse =
|
|
3802
|
-
!value || (value[0] !== '{' && value[0] !== '[' && value[0] !== '"');
|
|
3803
|
-
}
|
|
3804
|
-
return !doNotParse;
|
|
3805
|
-
}
|
|
3806
|
-
function readCookie(value, options) {
|
|
3807
|
-
if (options === void 0) { options = {}; }
|
|
3808
|
-
var cleanValue = cleanupCookieValue(value);
|
|
3809
|
-
if (isParsingCookie(cleanValue, options.doNotParse)) {
|
|
3810
|
-
try {
|
|
3811
|
-
return JSON.parse(cleanValue);
|
|
3812
|
-
}
|
|
3813
|
-
catch (e) {
|
|
3814
|
-
// At least we tried
|
|
3815
|
-
}
|
|
3816
|
-
}
|
|
3817
|
-
// Ignore clean value if we failed the deserialization
|
|
3818
|
-
// It is not relevant anymore to trim those values
|
|
3819
|
-
return value;
|
|
3820
|
-
}
|
|
3821
|
-
function cleanupCookieValue(value) {
|
|
3822
|
-
// express prepend j: before serializing a cookie
|
|
3823
|
-
if (value && value[0] === 'j' && value[1] === ':') {
|
|
3824
|
-
return value.substr(2);
|
|
3825
|
-
}
|
|
3826
|
-
return value;
|
|
3827
|
-
}
|
|
3828
|
-
|
|
3829
|
-
var __assign = (undefined && undefined.__assign) || function () {
|
|
3830
|
-
__assign = Object.assign || function(t) {
|
|
3831
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3832
|
-
s = arguments[i];
|
|
3833
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
3834
|
-
t[p] = s[p];
|
|
3835
|
-
}
|
|
3836
|
-
return t;
|
|
3837
|
-
};
|
|
3838
|
-
return __assign.apply(this, arguments);
|
|
3839
|
-
};
|
|
3840
|
-
var Cookies = /** @class */ (function () {
|
|
3841
|
-
function Cookies(cookies, options) {
|
|
3842
|
-
var _this = this;
|
|
3843
|
-
this.changeListeners = [];
|
|
3844
|
-
this.HAS_DOCUMENT_COOKIE = false;
|
|
3845
|
-
this.cookies = parseCookies(cookies, options);
|
|
3846
|
-
new Promise(function () {
|
|
3847
|
-
_this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
|
|
3848
|
-
}).catch(function () { });
|
|
3849
|
-
}
|
|
3850
|
-
Cookies.prototype._updateBrowserValues = function (parseOptions) {
|
|
3851
|
-
if (!this.HAS_DOCUMENT_COOKIE) {
|
|
3852
|
-
return;
|
|
3853
|
-
}
|
|
3854
|
-
this.cookies = parse_1(document.cookie, parseOptions);
|
|
3855
|
-
};
|
|
3856
|
-
Cookies.prototype._emitChange = function (params) {
|
|
3857
|
-
for (var i = 0; i < this.changeListeners.length; ++i) {
|
|
3858
|
-
this.changeListeners[i](params);
|
|
3859
|
-
}
|
|
3860
|
-
};
|
|
3861
|
-
Cookies.prototype.get = function (name, options, parseOptions) {
|
|
3862
|
-
if (options === void 0) { options = {}; }
|
|
3863
|
-
this._updateBrowserValues(parseOptions);
|
|
3864
|
-
return readCookie(this.cookies[name], options);
|
|
3865
|
-
};
|
|
3866
|
-
Cookies.prototype.getAll = function (options, parseOptions) {
|
|
3867
|
-
if (options === void 0) { options = {}; }
|
|
3868
|
-
this._updateBrowserValues(parseOptions);
|
|
3869
|
-
var result = {};
|
|
3870
|
-
for (var name_1 in this.cookies) {
|
|
3871
|
-
result[name_1] = readCookie(this.cookies[name_1], options);
|
|
3872
|
-
}
|
|
3873
|
-
return result;
|
|
3874
|
-
};
|
|
3875
|
-
Cookies.prototype.set = function (name, value, options) {
|
|
3876
|
-
var _a;
|
|
3877
|
-
if (typeof value === 'object') {
|
|
3878
|
-
value = JSON.stringify(value);
|
|
3879
|
-
}
|
|
3880
|
-
this.cookies = __assign(__assign({}, this.cookies), (_a = {}, _a[name] = value, _a));
|
|
3881
|
-
if (this.HAS_DOCUMENT_COOKIE) {
|
|
3882
|
-
document.cookie = serialize_1(name, value, options);
|
|
3883
|
-
}
|
|
3884
|
-
this._emitChange({ name: name, value: value, options: options });
|
|
3885
|
-
};
|
|
3886
|
-
Cookies.prototype.remove = function (name, options) {
|
|
3887
|
-
var finalOptions = (options = __assign(__assign({}, options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
|
|
3888
|
-
this.cookies = __assign({}, this.cookies);
|
|
3889
|
-
delete this.cookies[name];
|
|
3890
|
-
if (this.HAS_DOCUMENT_COOKIE) {
|
|
3891
|
-
document.cookie = serialize_1(name, '', finalOptions);
|
|
3892
|
-
}
|
|
3893
|
-
this._emitChange({ name: name, value: undefined, options: options });
|
|
3894
|
-
};
|
|
3895
|
-
Cookies.prototype.addChangeListener = function (callback) {
|
|
3896
|
-
this.changeListeners.push(callback);
|
|
3897
|
-
};
|
|
3898
|
-
Cookies.prototype.removeChangeListener = function (callback) {
|
|
3899
|
-
var idx = this.changeListeners.indexOf(callback);
|
|
3900
|
-
if (idx >= 0) {
|
|
3901
|
-
this.changeListeners.splice(idx, 1);
|
|
3902
|
-
}
|
|
3903
|
-
};
|
|
3904
|
-
return Cookies;
|
|
3905
|
-
}());
|
|
3906
|
-
var Cookies$1 = Cookies;
|
|
3907
|
-
|
|
3908
3581
|
var stringifyAttributes = ((attributes = {}) => Object.entries(attributes).map(([key, value], idx) => `${idx !== 0 ? ' ' : ''}${key}${value ? `="${value}"` : ''}`).join(' '));
|
|
3909
3582
|
|
|
3910
3583
|
/* eslint-disable no-console */
|
|
@@ -3994,7 +3667,7 @@ const getBundleData = (config, staticRoutePath) => {
|
|
|
3994
3667
|
legacy: loadableBundleData(config, staticRoutePath, 'legacy'),
|
|
3995
3668
|
modern: loadableBundleData(config, staticRoutePath, 'modern')
|
|
3996
3669
|
};
|
|
3997
|
-
if (!bundleData.default || bundleData.default
|
|
3670
|
+
if (!bundleData.default || Object.keys(bundleData.default || {}).length === 0) bundleData.default = bundleData.legacy || bundleData.modern;
|
|
3998
3671
|
return bundleData;
|
|
3999
3672
|
};
|
|
4000
3673
|
|
|
@@ -4047,15 +3720,22 @@ const getBundleTags = (loadableExtractor, scripts, staticRoutePath = 'static') =
|
|
|
4047
3720
|
return startupTag;
|
|
4048
3721
|
};
|
|
4049
3722
|
|
|
3723
|
+
const alias = ALIAS; /* global ALIAS */
|
|
3724
|
+
|
|
4050
3725
|
const addStandardHeaders = (state, response, packagejson, groups) => {
|
|
4051
3726
|
if (state) {
|
|
4052
3727
|
try {
|
|
4053
3728
|
console.info('About to add headers');
|
|
4054
3729
|
const routingSurrogateKeys = selectSurrogateKeys(state);
|
|
4055
|
-
|
|
4056
|
-
|
|
3730
|
+
|
|
3731
|
+
// Check length of surrogate keys and prevent potential header overflow
|
|
3732
|
+
// errors in prod by replacing with `any-update` header that will indiscriminately
|
|
3733
|
+
// invalidate the SSR page cache when any content is updated
|
|
3734
|
+
const surrogateKeys = routingSurrogateKeys.length >= 2000 ? `${alias}_any-update` : routingSurrogateKeys.join(' ');
|
|
3735
|
+
const surrogateKeyHeader = `${packagejson.name}-app ${surrogateKeys}`;
|
|
3736
|
+
response.setHeader('surrogate-key', surrogateKeyHeader);
|
|
4057
3737
|
addVarnishAuthenticationHeaders(state, response, groups);
|
|
4058
|
-
response.setHeader('
|
|
3738
|
+
response.setHeader('surrogate-control', `max-age=${getCacheDuration(response.statusCode)}`);
|
|
4059
3739
|
} catch (e) {
|
|
4060
3740
|
console.info('Error Adding headers', e.message);
|
|
4061
3741
|
}
|
|
@@ -4094,10 +3774,11 @@ const getVersionInfo = staticFolderPath => {
|
|
|
4094
3774
|
};
|
|
4095
3775
|
|
|
4096
3776
|
/* eslint-disable no-console */
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
3777
|
+
|
|
3778
|
+
// Default exception types to add event listeners for
|
|
3779
|
+
const handleDefaultEvents = ['uncaughtException', 'unhandledRejection'];
|
|
3780
|
+
const unhandledExceptionHandler = (handleExceptions = handleDefaultEvents) => {
|
|
3781
|
+
const exceptionTypes = Array.isArray(handleExceptions) ? handleExceptions : handleExceptions === false ? [] : handleDefaultEvents;
|
|
4101
3782
|
for (const type of exceptionTypes) {
|
|
4102
3783
|
process.on(type, err => {
|
|
4103
3784
|
if (err && err instanceof Error) {
|
|
@@ -4133,14 +3814,13 @@ const webApp = (app, ReactApp, config) => {
|
|
|
4133
3814
|
const attributes = stringifyAttributes(scripts.attributes);
|
|
4134
3815
|
scripts.startup = scripts.startup || startupScriptFilename;
|
|
4135
3816
|
const responseHandler = typeof handleResponses === 'function' ? handleResponses : handleResponse;
|
|
4136
|
-
if (handleExceptions !== false) unhandledExceptionHandler(); // Create `process.on` event handlers for unhandled exceptions (Node v15+)
|
|
3817
|
+
if (handleExceptions !== false) unhandledExceptionHandler(handleExceptions); // Create `process.on` event handlers for unhandled exceptions (Node v15+)
|
|
4137
3818
|
|
|
4138
3819
|
const versionInfo = getVersionInfo(staticFolderPath);
|
|
4139
|
-
app.get('/*', async (request, response) => {
|
|
3820
|
+
app.get('/*', cookiesMiddleware(), async (request, response) => {
|
|
4140
3821
|
const {
|
|
4141
3822
|
url
|
|
4142
3823
|
} = request;
|
|
4143
|
-
const cookies = new Cookies$1(request.headers.cookie);
|
|
4144
3824
|
const matchedStaticRoute = () => matchRoutes(routes.StaticRoutes, request.path);
|
|
4145
3825
|
const isStaticRoute = () => matchedStaticRoute().length > 0;
|
|
4146
3826
|
const staticRoute = isStaticRoute() && matchedStaticRoute()[0];
|
|
@@ -4176,17 +3856,23 @@ const webApp = (app, ReactApp, config) => {
|
|
|
4176
3856
|
|
|
4177
3857
|
// dispatch any global and non-saga related actions before calling our JSX
|
|
4178
3858
|
const versionStatus = deliveryApi.getServerSideVersionStatus(request);
|
|
4179
|
-
|
|
3859
|
+
|
|
3860
|
+
// In server-side blocks world, the hostname requested by the client resides in the x-orig-host header
|
|
3861
|
+
// Because of this, we prioritize x-orig-host when setting our hostname
|
|
3862
|
+
const hostname = request.headers['x-orig-host'] || request.hostname;
|
|
3863
|
+
console.info(`Request for ${request.path} hostname: ${hostname} versionStatus: ${versionStatus}`);
|
|
4180
3864
|
store.dispatch(setVersionStatus(versionStatus));
|
|
4181
3865
|
store.dispatch(setVersion(versionInfo.commitRef, versionInfo.buildNo));
|
|
4182
|
-
const project = pickProject(
|
|
3866
|
+
const project = pickProject(hostname, request.query);
|
|
4183
3867
|
const groups = allowedGroups && allowedGroups[project];
|
|
4184
|
-
store.dispatch(setCurrentProject(project, groups,
|
|
3868
|
+
store.dispatch(setCurrentProject(project, groups, hostname));
|
|
4185
3869
|
const loadableExtractor = loadableChunkExtractors();
|
|
4186
|
-
|
|
3870
|
+
// Recast ChunkExtractorManager to avoid TS error `Property 'children' does not exist on type...`
|
|
3871
|
+
const ChunkExtractor = ChunkExtractorManager;
|
|
3872
|
+
const jsx = /*#__PURE__*/React.createElement(ChunkExtractor, {
|
|
4187
3873
|
extractor: loadableExtractor.commonLoadableExtractor
|
|
4188
3874
|
}, /*#__PURE__*/React.createElement(CookiesProvider, {
|
|
4189
|
-
cookies:
|
|
3875
|
+
cookies: request.universalCookies
|
|
4190
3876
|
}, /*#__PURE__*/React.createElement(Provider, {
|
|
4191
3877
|
store: store
|
|
4192
3878
|
}, /*#__PURE__*/React.createElement(StaticRouter, {
|
|
@@ -4237,7 +3923,7 @@ const webApp = (app, ReactApp, config) => {
|
|
|
4237
3923
|
// After running rootSaga there should be an additional react-loadable
|
|
4238
3924
|
// code-split bundles for any page components as well as core app bundles
|
|
4239
3925
|
const bundleTags = getBundleTags(loadableExtractor, scripts, staticRoutePath);
|
|
4240
|
-
let serialisedReduxData = serialize
|
|
3926
|
+
let serialisedReduxData = serialize(buildCleaner({
|
|
4241
3927
|
isArray: identity,
|
|
4242
3928
|
isBoolean: identity,
|
|
4243
3929
|
isDate: identity,
|
|
@@ -4264,7 +3950,7 @@ const webApp = (app, ReactApp, config) => {
|
|
|
4264
3950
|
serialisedReduxData = `<script ${attributes}>window.versionStatus = "${versionStatus}"; window.REDUX_DATA = ${serialisedReduxData}</script>`;
|
|
4265
3951
|
}
|
|
4266
3952
|
}
|
|
4267
|
-
if ((context.statusCode || 200)
|
|
3953
|
+
if ((context.statusCode || 200) >= 404) {
|
|
4268
3954
|
accessMethod.STATIC = true;
|
|
4269
3955
|
}
|
|
4270
3956
|
|
|
@@ -4330,7 +4016,6 @@ const start = (ReactApp, config, ServerFeatures) => {
|
|
|
4330
4016
|
global.PROXY_DELIVERY_API = config.proxyDeliveryApi;
|
|
4331
4017
|
global.REVERSE_PROXY_PATHS = Object(config.reverseProxyPaths);
|
|
4332
4018
|
app.disable('x-powered-by');
|
|
4333
|
-
|
|
4334
4019
|
// Output some information about the used build/startup configuration
|
|
4335
4020
|
DisplayStartupConfiguration(config);
|
|
4336
4021
|
ServerFeatures(app);
|
|
@@ -4349,6 +4034,7 @@ const start = (ReactApp, config, ServerFeatures) => {
|
|
|
4349
4034
|
app.on('stop', () => {
|
|
4350
4035
|
server.close(function () {
|
|
4351
4036
|
console.info('GoodBye :(');
|
|
4037
|
+
process.exit();
|
|
4352
4038
|
});
|
|
4353
4039
|
});
|
|
4354
4040
|
});
|