@zengenti/contensis-react-base 3.0.2-beta.9 → 3.1.1-beta.0

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.
Files changed (141) hide show
  1. package/README.md +38 -2
  2. package/cjs/{App-81a45001.js → App-555eebb0.js} +70 -34
  3. package/cjs/App-555eebb0.js.map +1 -0
  4. package/cjs/{login-51b66359.js → ChangePassword.container-f3f94d8f.js} +246 -84
  5. package/cjs/ChangePassword.container-f3f94d8f.js.map +1 -0
  6. package/cjs/{ContensisDeliveryApi-de88df2a.js → ContensisDeliveryApi-ea5ffdc2.js} +162 -122
  7. package/cjs/ContensisDeliveryApi-ea5ffdc2.js.map +1 -0
  8. package/cjs/CookieConstants-000427db.js +10 -0
  9. package/cjs/CookieConstants-000427db.js.map +1 -0
  10. package/cjs/{RouteLoader-47d70a26.js → RouteLoader-014a95b9.js} +8 -5
  11. package/cjs/RouteLoader-014a95b9.js.map +1 -0
  12. package/cjs/{ToJs-61c03582.js → ToJs-64970869.js} +49 -2
  13. package/cjs/ToJs-64970869.js.map +1 -0
  14. package/cjs/_commonjsHelpers-b3309d7b.js +11 -0
  15. package/cjs/_commonjsHelpers-b3309d7b.js.map +1 -0
  16. package/cjs/client.js +14 -12
  17. package/cjs/client.js.map +1 -1
  18. package/cjs/contensis-react-base.js +47 -361
  19. package/cjs/contensis-react-base.js.map +1 -1
  20. package/cjs/forms.js +3495 -127
  21. package/cjs/forms.js.map +1 -1
  22. package/cjs/redux.js +3 -4
  23. package/cjs/redux.js.map +1 -1
  24. package/cjs/routing.js +4 -3
  25. package/cjs/routing.js.map +1 -1
  26. package/cjs/{sagas-6d12e7ca.js → sagas-e04b94c1.js} +44 -20
  27. package/cjs/sagas-e04b94c1.js.map +1 -0
  28. package/cjs/search.js +13 -13
  29. package/cjs/search.js.map +1 -1
  30. package/cjs/{selectors-c76c2676.js → selectors-8e56cc34.js} +14 -13
  31. package/cjs/selectors-8e56cc34.js.map +1 -0
  32. package/cjs/user.js +33 -159
  33. package/cjs/user.js.map +1 -1
  34. package/cjs/util.js +6 -4
  35. package/cjs/util.js.map +1 -1
  36. package/cjs/{version-886f49d8.js → version-91b90ee8.js} +3 -3
  37. package/cjs/{version-886f49d8.js.map → version-91b90ee8.js.map} +1 -1
  38. package/cjs/{version-38afaf2a.js → version-fb4ba30b.js} +16 -24
  39. package/cjs/version-fb4ba30b.js.map +1 -0
  40. package/esm/{App-5f914483.js → App-aaea6310.js} +64 -29
  41. package/esm/App-aaea6310.js.map +1 -0
  42. package/esm/{login-4d07c2de.js → ChangePassword.container-724c8e0a.js} +229 -78
  43. package/esm/ChangePassword.container-724c8e0a.js.map +1 -0
  44. package/esm/ContensisDeliveryApi-fe53fa10.js +265 -0
  45. package/esm/ContensisDeliveryApi-fe53fa10.js.map +1 -0
  46. package/esm/CookieConstants-3d3b6531.js +6 -0
  47. package/esm/CookieConstants-3d3b6531.js.map +1 -0
  48. package/esm/{RouteLoader-f5d5f733.js → RouteLoader-fe64ca81.js} +8 -5
  49. package/esm/RouteLoader-fe64ca81.js.map +1 -0
  50. package/esm/{ToJs-0066e629.js → ToJs-c75473e9.js} +49 -3
  51. package/esm/ToJs-c75473e9.js.map +1 -0
  52. package/esm/_commonjsHelpers-1789f0cf.js +8 -0
  53. package/esm/_commonjsHelpers-1789f0cf.js.map +1 -0
  54. package/esm/client.js +15 -13
  55. package/esm/client.js.map +1 -1
  56. package/esm/contensis-react-base.js +46 -361
  57. package/esm/contensis-react-base.js.map +1 -1
  58. package/esm/forms.js +3497 -129
  59. package/esm/forms.js.map +1 -1
  60. package/esm/redux.js +6 -7
  61. package/esm/redux.js.map +1 -1
  62. package/esm/routing.js +4 -3
  63. package/esm/routing.js.map +1 -1
  64. package/esm/{sagas-53d2aefb.js → sagas-933a8fc8.js} +44 -20
  65. package/esm/sagas-933a8fc8.js.map +1 -0
  66. package/esm/search.js +14 -14
  67. package/esm/search.js.map +1 -1
  68. package/esm/{selectors-3f0d804d.js → selectors-0fe67d47.js} +14 -14
  69. package/esm/selectors-0fe67d47.js.map +1 -0
  70. package/esm/user.js +21 -151
  71. package/esm/user.js.map +1 -1
  72. package/esm/util.js +4 -4
  73. package/esm/{version-dd31c7f0.js → version-7ea8bea8.js} +17 -24
  74. package/esm/version-7ea8bea8.js.map +1 -0
  75. package/esm/{version-f4629693.js → version-f42f7bdc.js} +3 -3
  76. package/esm/{version-f4629693.js.map → version-f42f7bdc.js.map} +1 -1
  77. package/models/client/client.d.ts +1 -1
  78. package/models/config.d.ts +4 -4
  79. package/models/redux/appstate.d.ts +2 -1
  80. package/models/routing/redux/actions.d.ts +10 -6
  81. package/models/routing/redux/selectors.d.ts +5 -4
  82. package/models/routing/redux/types.d.ts +0 -1
  83. package/models/routing/routes.d.ts +20 -17
  84. package/models/routing/util/queries.d.ts +3 -2
  85. package/models/search/models/Queries.d.ts +9 -10
  86. package/models/search/models/Search.d.ts +26 -24
  87. package/models/search/models/SearchActions.d.ts +36 -36
  88. package/models/search/models/SearchState.d.ts +11 -11
  89. package/models/search/models/SearchUtil.d.ts +1 -1
  90. package/models/search/models/WithSearch.d.ts +1 -1
  91. package/models/search/redux/actions.d.ts +7 -7
  92. package/models/search/redux/selectors.d.ts +27 -27
  93. package/models/search/redux/types.d.ts +21 -21
  94. package/models/search/redux/util.d.ts +2 -2
  95. package/models/search/search/ContensisDeliveryApi.d.ts +1 -1
  96. package/models/search/search/expressions.d.ts +4 -4
  97. package/models/search/search/util.d.ts +2 -2
  98. package/models/search/transformations/state-to-queryparams.mapper.d.ts +1 -1
  99. package/models/server/features/linkdepth-api/LinkDepthSearchService.d.ts +1 -1
  100. package/models/server/features/linkdepth-api/search.d.ts +3 -3
  101. package/models/server/internalServer.d.ts +7 -5
  102. package/models/server/util/bundles.d.ts +2 -2
  103. package/models/server/util/handleExceptions.d.ts +1 -1
  104. package/models/testImmer/redux/reducer.d.ts +1 -1
  105. package/models/user/components/Login.d.ts +2 -3
  106. package/models/user/containers/ChangePassword.container.d.ts +2 -2
  107. package/models/user/containers/ForgotPassword.container.d.ts +2 -2
  108. package/models/user/containers/Login.container.d.ts +2 -2
  109. package/models/user/containers/Registration.container.d.ts +2 -2
  110. package/models/user/hocs/withLogin.d.ts +5 -11
  111. package/models/user/hocs/withRegistration.d.ts +2 -8
  112. package/models/user/redux/actions.d.ts +2 -2
  113. package/models/user/redux/sagas/login.d.ts +9 -8
  114. package/models/user/redux/selectors.d.ts +4 -4
  115. package/models/user/util/CookieConstants.d.ts +8 -0
  116. package/models/user/util/CookieHelper.class.d.ts +15 -3
  117. package/models/user/util/LoginHelper.class.d.ts +27 -23
  118. package/models/util/CachedDeliveryApi.d.ts +25 -0
  119. package/models/util/ContensisDeliveryApi.d.ts +20 -44
  120. package/models/util/LruCache.d.ts +12 -0
  121. package/models/util/ToJs.d.ts +1 -1
  122. package/models/util/index.d.ts +1 -1
  123. package/models/util/json-mapper.d.ts +1 -1
  124. package/package.json +10 -11
  125. package/cjs/App-81a45001.js.map +0 -1
  126. package/cjs/ContensisDeliveryApi-de88df2a.js.map +0 -1
  127. package/cjs/RouteLoader-47d70a26.js.map +0 -1
  128. package/cjs/ToJs-61c03582.js.map +0 -1
  129. package/cjs/login-51b66359.js.map +0 -1
  130. package/cjs/sagas-6d12e7ca.js.map +0 -1
  131. package/cjs/selectors-c76c2676.js.map +0 -1
  132. package/cjs/version-38afaf2a.js.map +0 -1
  133. package/esm/App-5f914483.js.map +0 -1
  134. package/esm/ContensisDeliveryApi-ad06857d.js +0 -227
  135. package/esm/ContensisDeliveryApi-ad06857d.js.map +0 -1
  136. package/esm/RouteLoader-f5d5f733.js.map +0 -1
  137. package/esm/ToJs-0066e629.js.map +0 -1
  138. package/esm/login-4d07c2de.js.map +0 -1
  139. package/esm/sagas-53d2aefb.js.map +0 -1
  140. package/esm/selectors-3f0d804d.js.map +0 -1
  141. package/esm/version-dd31c7f0.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ContensisDeliveryApi = require('./ContensisDeliveryApi-de88df2a.js');
5
+ var ContensisDeliveryApi = require('./ContensisDeliveryApi-ea5ffdc2.js');
6
6
  var contensisDeliveryApi = require('contensis-delivery-api');
7
7
  var React = require('react');
8
8
  var reactRedux = require('react-redux');
@@ -10,7 +10,7 @@ var mapJson = require('jsonpath-mapper');
10
10
  require('reselect');
11
11
  require('deepmerge');
12
12
  require('query-string');
13
- var sagas = require('./sagas-6d12e7ca.js');
13
+ var sagas = require('./sagas-e04b94c1.js');
14
14
  require('immer');
15
15
  require('deep-equal');
16
16
  var contensisCoreApi = require('contensis-core-api');
@@ -27,17 +27,20 @@ var reactRouterDom = require('react-router-dom');
27
27
  var reactRouterConfig = require('react-router-config');
28
28
  var reactHelmet = require('react-helmet');
29
29
  var styled = require('styled-components');
30
- var serialize$1 = require('serialize-javascript');
30
+ var serialize = require('serialize-javascript');
31
31
  var minifyCssString = require('minify-css-string');
32
32
  var server$1 = require('@loadable/server');
33
33
  var lodash = require('lodash');
34
+ var _commonjsHelpers = require('./_commonjsHelpers-b3309d7b.js');
34
35
  var lodashClean = require('lodash-clean');
35
36
  var reactCookie = require('react-cookie');
36
- var version = require('./version-38afaf2a.js');
37
- var App = require('./App-81a45001.js');
38
- var version$1 = require('./version-886f49d8.js');
39
- var selectors = require('./selectors-c76c2676.js');
37
+ var cookiesMiddleware = require('universal-cookie-express');
38
+ var version = require('./version-fb4ba30b.js');
39
+ var App = require('./App-555eebb0.js');
40
+ var version$1 = require('./version-91b90ee8.js');
41
+ var selectors = require('./selectors-8e56cc34.js');
40
42
  var chalk = require('chalk');
43
+ require('./CookieConstants-000427db.js');
41
44
  require('loglevel');
42
45
  require('@redux-saga/core/effects');
43
46
  require('redux');
@@ -46,12 +49,11 @@ require('redux-saga');
46
49
  require('redux-injectors');
47
50
  require('./reducers-9afb5f89.js');
48
51
  require('history');
49
- require('./login-51b66359.js');
50
- require('./ToJs-61c03582.js');
51
52
  require('await-to-js');
52
- require('js-cookie');
53
+ require('./ChangePassword.container-f3f94d8f.js');
54
+ require('./ToJs-64970869.js');
53
55
  require('react-hot-loader');
54
- require('./RouteLoader-47d70a26.js');
56
+ require('./RouteLoader-014a95b9.js');
55
57
 
56
58
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
57
59
 
@@ -62,8 +64,9 @@ var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
62
64
  var httpProxy__default = /*#__PURE__*/_interopDefaultLegacy(httpProxy);
63
65
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
64
66
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
65
- var serialize__default = /*#__PURE__*/_interopDefaultLegacy(serialize$1);
67
+ var serialize__default = /*#__PURE__*/_interopDefaultLegacy(serialize);
66
68
  var minifyCssString__default = /*#__PURE__*/_interopDefaultLegacy(minifyCssString);
69
+ var cookiesMiddleware__default = /*#__PURE__*/_interopDefaultLegacy(cookiesMiddleware);
67
70
  var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
68
71
 
69
72
  /**
@@ -646,8 +649,8 @@ const makeLinkDepthMiddleware = ({
646
649
 
647
650
  const servers$1 = SERVERS; /* global SERVERS */
648
651
  const project = PROJECT; /* global PROJECT */
649
- const alias = ALIAS; /* global ALIAS */
650
- const deliveryApiHostname = urls.url(alias, project).api;
652
+ const alias$1 = ALIAS; /* global ALIAS */
653
+ const deliveryApiHostname = urls.url(alias$1, project).api;
651
654
  const assetProxy = httpProxy__default["default"].createProxyServer();
652
655
  const deliveryProxy = httpProxy__default["default"].createProxyServer();
653
656
  const reverseProxies = (app, reverseProxyPaths = []) => {
@@ -811,8 +814,6 @@ const DisplayStartupConfiguration = config => {
811
814
  /* eslint-enable no-console */
812
815
  };
813
816
 
814
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
815
-
816
817
  /**
817
818
  * Removes all key-value entries from the list cache.
818
819
  *
@@ -1092,7 +1093,7 @@ var _stackHas = stackHas$1;
1092
1093
 
1093
1094
  /** Detect free variable `global` from Node.js. */
1094
1095
 
1095
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
1096
+ var freeGlobal$1 = typeof _commonjsHelpers.commonjsGlobal == 'object' && _commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.Object === Object && _commonjsHelpers.commonjsGlobal;
1096
1097
 
1097
1098
  var _freeGlobal = freeGlobal$1;
1098
1099
 
@@ -3595,332 +3596,6 @@ function cloneDeep(value) {
3595
3596
 
3596
3597
  var cloneDeep_1 = cloneDeep;
3597
3598
 
3598
- /*!
3599
- * cookie
3600
- * Copyright(c) 2012-2014 Roman Shtylman
3601
- * Copyright(c) 2015 Douglas Christopher Wilson
3602
- * MIT Licensed
3603
- */
3604
-
3605
- /**
3606
- * Module exports.
3607
- * @public
3608
- */
3609
-
3610
- var parse_1 = parse;
3611
- var serialize_1 = serialize;
3612
-
3613
- /**
3614
- * Module variables.
3615
- * @private
3616
- */
3617
-
3618
- var decode = decodeURIComponent;
3619
- var encode = encodeURIComponent;
3620
-
3621
- /**
3622
- * RegExp to match field-content in RFC 7230 sec 3.2
3623
- *
3624
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
3625
- * field-vchar = VCHAR / obs-text
3626
- * obs-text = %x80-FF
3627
- */
3628
-
3629
- var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
3630
-
3631
- /**
3632
- * Parse a cookie header.
3633
- *
3634
- * Parse the given cookie header string into an object
3635
- * The object has the various cookies as keys(names) => values
3636
- *
3637
- * @param {string} str
3638
- * @param {object} [options]
3639
- * @return {object}
3640
- * @public
3641
- */
3642
-
3643
- function parse(str, options) {
3644
- if (typeof str !== 'string') {
3645
- throw new TypeError('argument str must be a string');
3646
- }
3647
-
3648
- var obj = {};
3649
- var opt = options || {};
3650
- var pairs = str.split(';');
3651
- var dec = opt.decode || decode;
3652
-
3653
- for (var i = 0; i < pairs.length; i++) {
3654
- var pair = pairs[i];
3655
- var index = pair.indexOf('=');
3656
-
3657
- // skip things that don't look like key=value
3658
- if (index < 0) {
3659
- continue;
3660
- }
3661
-
3662
- var key = pair.substring(0, index).trim();
3663
-
3664
- // only assign once
3665
- if (undefined == obj[key]) {
3666
- var val = pair.substring(index + 1, pair.length).trim();
3667
-
3668
- // quoted values
3669
- if (val[0] === '"') {
3670
- val = val.slice(1, -1);
3671
- }
3672
-
3673
- obj[key] = tryDecode(val, dec);
3674
- }
3675
- }
3676
-
3677
- return obj;
3678
- }
3679
-
3680
- /**
3681
- * Serialize data into a cookie header.
3682
- *
3683
- * Serialize the a name value pair into a cookie string suitable for
3684
- * http headers. An optional options object specified cookie parameters.
3685
- *
3686
- * serialize('foo', 'bar', { httpOnly: true })
3687
- * => "foo=bar; httpOnly"
3688
- *
3689
- * @param {string} name
3690
- * @param {string} val
3691
- * @param {object} [options]
3692
- * @return {string}
3693
- * @public
3694
- */
3695
-
3696
- function serialize(name, val, options) {
3697
- var opt = options || {};
3698
- var enc = opt.encode || encode;
3699
-
3700
- if (typeof enc !== 'function') {
3701
- throw new TypeError('option encode is invalid');
3702
- }
3703
-
3704
- if (!fieldContentRegExp.test(name)) {
3705
- throw new TypeError('argument name is invalid');
3706
- }
3707
-
3708
- var value = enc(val);
3709
-
3710
- if (value && !fieldContentRegExp.test(value)) {
3711
- throw new TypeError('argument val is invalid');
3712
- }
3713
-
3714
- var str = name + '=' + value;
3715
-
3716
- if (null != opt.maxAge) {
3717
- var maxAge = opt.maxAge - 0;
3718
-
3719
- if (isNaN(maxAge) || !isFinite(maxAge)) {
3720
- throw new TypeError('option maxAge is invalid')
3721
- }
3722
-
3723
- str += '; Max-Age=' + Math.floor(maxAge);
3724
- }
3725
-
3726
- if (opt.domain) {
3727
- if (!fieldContentRegExp.test(opt.domain)) {
3728
- throw new TypeError('option domain is invalid');
3729
- }
3730
-
3731
- str += '; Domain=' + opt.domain;
3732
- }
3733
-
3734
- if (opt.path) {
3735
- if (!fieldContentRegExp.test(opt.path)) {
3736
- throw new TypeError('option path is invalid');
3737
- }
3738
-
3739
- str += '; Path=' + opt.path;
3740
- }
3741
-
3742
- if (opt.expires) {
3743
- if (typeof opt.expires.toUTCString !== 'function') {
3744
- throw new TypeError('option expires is invalid');
3745
- }
3746
-
3747
- str += '; Expires=' + opt.expires.toUTCString();
3748
- }
3749
-
3750
- if (opt.httpOnly) {
3751
- str += '; HttpOnly';
3752
- }
3753
-
3754
- if (opt.secure) {
3755
- str += '; Secure';
3756
- }
3757
-
3758
- if (opt.sameSite) {
3759
- var sameSite = typeof opt.sameSite === 'string'
3760
- ? opt.sameSite.toLowerCase() : opt.sameSite;
3761
-
3762
- switch (sameSite) {
3763
- case true:
3764
- str += '; SameSite=Strict';
3765
- break;
3766
- case 'lax':
3767
- str += '; SameSite=Lax';
3768
- break;
3769
- case 'strict':
3770
- str += '; SameSite=Strict';
3771
- break;
3772
- case 'none':
3773
- str += '; SameSite=None';
3774
- break;
3775
- default:
3776
- throw new TypeError('option sameSite is invalid');
3777
- }
3778
- }
3779
-
3780
- return str;
3781
- }
3782
-
3783
- /**
3784
- * Try decoding a string using a decoding function.
3785
- *
3786
- * @param {string} str
3787
- * @param {function} decode
3788
- * @private
3789
- */
3790
-
3791
- function tryDecode(str, decode) {
3792
- try {
3793
- return decode(str);
3794
- } catch (e) {
3795
- return str;
3796
- }
3797
- }
3798
-
3799
- function hasDocumentCookie() {
3800
- // Can we get/set cookies on document.cookie?
3801
- return typeof document === 'object' && typeof document.cookie === 'string';
3802
- }
3803
- function parseCookies(cookies, options) {
3804
- if (typeof cookies === 'string') {
3805
- return parse_1(cookies, options);
3806
- }
3807
- else if (typeof cookies === 'object' && cookies !== null) {
3808
- return cookies;
3809
- }
3810
- else {
3811
- return {};
3812
- }
3813
- }
3814
- function isParsingCookie(value, doNotParse) {
3815
- if (typeof doNotParse === 'undefined') {
3816
- // We guess if the cookie start with { or [, it has been serialized
3817
- doNotParse =
3818
- !value || (value[0] !== '{' && value[0] !== '[' && value[0] !== '"');
3819
- }
3820
- return !doNotParse;
3821
- }
3822
- function readCookie(value, options) {
3823
- if (options === void 0) { options = {}; }
3824
- var cleanValue = cleanupCookieValue(value);
3825
- if (isParsingCookie(cleanValue, options.doNotParse)) {
3826
- try {
3827
- return JSON.parse(cleanValue);
3828
- }
3829
- catch (e) {
3830
- // At least we tried
3831
- }
3832
- }
3833
- // Ignore clean value if we failed the deserialization
3834
- // It is not relevant anymore to trim those values
3835
- return value;
3836
- }
3837
- function cleanupCookieValue(value) {
3838
- // express prepend j: before serializing a cookie
3839
- if (value && value[0] === 'j' && value[1] === ':') {
3840
- return value.substr(2);
3841
- }
3842
- return value;
3843
- }
3844
-
3845
- var __assign = (undefined && undefined.__assign) || function () {
3846
- __assign = Object.assign || function(t) {
3847
- for (var s, i = 1, n = arguments.length; i < n; i++) {
3848
- s = arguments[i];
3849
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
3850
- t[p] = s[p];
3851
- }
3852
- return t;
3853
- };
3854
- return __assign.apply(this, arguments);
3855
- };
3856
- var Cookies = /** @class */ (function () {
3857
- function Cookies(cookies, options) {
3858
- var _this = this;
3859
- this.changeListeners = [];
3860
- this.HAS_DOCUMENT_COOKIE = false;
3861
- this.cookies = parseCookies(cookies, options);
3862
- new Promise(function () {
3863
- _this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
3864
- }).catch(function () { });
3865
- }
3866
- Cookies.prototype._updateBrowserValues = function (parseOptions) {
3867
- if (!this.HAS_DOCUMENT_COOKIE) {
3868
- return;
3869
- }
3870
- this.cookies = parse_1(document.cookie, parseOptions);
3871
- };
3872
- Cookies.prototype._emitChange = function (params) {
3873
- for (var i = 0; i < this.changeListeners.length; ++i) {
3874
- this.changeListeners[i](params);
3875
- }
3876
- };
3877
- Cookies.prototype.get = function (name, options, parseOptions) {
3878
- if (options === void 0) { options = {}; }
3879
- this._updateBrowserValues(parseOptions);
3880
- return readCookie(this.cookies[name], options);
3881
- };
3882
- Cookies.prototype.getAll = function (options, parseOptions) {
3883
- if (options === void 0) { options = {}; }
3884
- this._updateBrowserValues(parseOptions);
3885
- var result = {};
3886
- for (var name_1 in this.cookies) {
3887
- result[name_1] = readCookie(this.cookies[name_1], options);
3888
- }
3889
- return result;
3890
- };
3891
- Cookies.prototype.set = function (name, value, options) {
3892
- var _a;
3893
- if (typeof value === 'object') {
3894
- value = JSON.stringify(value);
3895
- }
3896
- this.cookies = __assign(__assign({}, this.cookies), (_a = {}, _a[name] = value, _a));
3897
- if (this.HAS_DOCUMENT_COOKIE) {
3898
- document.cookie = serialize_1(name, value, options);
3899
- }
3900
- this._emitChange({ name: name, value: value, options: options });
3901
- };
3902
- Cookies.prototype.remove = function (name, options) {
3903
- var finalOptions = (options = __assign(__assign({}, options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
3904
- this.cookies = __assign({}, this.cookies);
3905
- delete this.cookies[name];
3906
- if (this.HAS_DOCUMENT_COOKIE) {
3907
- document.cookie = serialize_1(name, '', finalOptions);
3908
- }
3909
- this._emitChange({ name: name, value: undefined, options: options });
3910
- };
3911
- Cookies.prototype.addChangeListener = function (callback) {
3912
- this.changeListeners.push(callback);
3913
- };
3914
- Cookies.prototype.removeChangeListener = function (callback) {
3915
- var idx = this.changeListeners.indexOf(callback);
3916
- if (idx >= 0) {
3917
- this.changeListeners.splice(idx, 1);
3918
- }
3919
- };
3920
- return Cookies;
3921
- }());
3922
- var Cookies$1 = Cookies;
3923
-
3924
3599
  var stringifyAttributes = ((attributes = {}) => Object.entries(attributes).map(([key, value], idx) => `${idx !== 0 ? ' ' : ''}${key}${value ? `="${value}"` : ''}`).join(' '));
3925
3600
 
3926
3601
  /* eslint-disable no-console */
@@ -4010,7 +3685,7 @@ const getBundleData = (config, staticRoutePath) => {
4010
3685
  legacy: loadableBundleData(config, staticRoutePath, 'legacy'),
4011
3686
  modern: loadableBundleData(config, staticRoutePath, 'modern')
4012
3687
  };
4013
- if (!bundleData.default || bundleData.default === {}) bundleData.default = bundleData.legacy || bundleData.modern;
3688
+ if (!bundleData.default || Object.keys(bundleData.default || {}).length === 0) bundleData.default = bundleData.legacy || bundleData.modern;
4014
3689
  return bundleData;
4015
3690
  };
4016
3691
 
@@ -4063,17 +3738,24 @@ const getBundleTags = (loadableExtractor, scripts, staticRoutePath = 'static') =
4063
3738
  return startupTag;
4064
3739
  };
4065
3740
 
3741
+ const alias = ALIAS; /* global ALIAS */
3742
+
4066
3743
  const addStandardHeaders = (state, response, packagejson, groups) => {
4067
3744
  if (state) {
4068
3745
  try {
4069
3746
  console.info('About to add headers');
4070
3747
  const routingSurrogateKeys = selectors.selectSurrogateKeys(state);
4071
- const surrogateKeyHeader = ` ${packagejson.name}-app ${routingSurrogateKeys}`;
4072
- response.header('surrogate-key', surrogateKeyHeader);
3748
+ console.info(`[addStandardHeaders] ${routingSurrogateKeys.length} surrogate keys for ${response.req.url}`);
3749
+ // Check length of surrogate keys and prevent potential header overflow
3750
+ // errors in prod by replacing with `any-update` header that will indiscriminately
3751
+ // invalidate the SSR page cache when any content is updated
3752
+ const surrogateKeys = routingSurrogateKeys.length >= 2000 ? `${alias}_any-update` : routingSurrogateKeys.join(' ');
3753
+ const surrogateKeyHeader = `${packagejson.name}-app ${surrogateKeys}`;
3754
+ response.setHeader('surrogate-key', surrogateKeyHeader);
4073
3755
  addVarnishAuthenticationHeaders(state, response, groups);
4074
- response.setHeader('Surrogate-Control', `max-age=${getCacheDuration(response.statusCode)}`);
3756
+ response.setHeader('surrogate-control', `max-age=${getCacheDuration(response.statusCode)}`);
4075
3757
  } catch (e) {
4076
- console.info('Error Adding headers', e.message);
3758
+ console.info('Error adding headers', e.message);
4077
3759
  }
4078
3760
  }
4079
3761
  };
@@ -4110,10 +3792,11 @@ const getVersionInfo = staticFolderPath => {
4110
3792
  };
4111
3793
 
4112
3794
  /* eslint-disable no-console */
4113
- const unhandledExceptionHandler = (handleExceptions = true) => {
4114
- const exceptionTypes = handleExceptions === true ? ['uncaughtException', 'unhandledRejection', 'SIGTERM', 'SIGINT'] // Default exception types to add event listeners for
4115
- : Array.isArray(handleExceptions) // In future we could accept an array of specific exception types to handle for a specific application?
4116
- ? handleExceptions : [];
3795
+
3796
+ // Default exception types to add event listeners for
3797
+ const handleDefaultEvents = ['uncaughtException', 'unhandledRejection'];
3798
+ const unhandledExceptionHandler = (handleExceptions = handleDefaultEvents) => {
3799
+ const exceptionTypes = Array.isArray(handleExceptions) ? handleExceptions : handleExceptions === false ? [] : handleDefaultEvents;
4117
3800
  for (const type of exceptionTypes) {
4118
3801
  process.on(type, err => {
4119
3802
  if (err && err instanceof Error) {
@@ -4149,14 +3832,13 @@ const webApp = (app, ReactApp, config) => {
4149
3832
  const attributes = stringifyAttributes(scripts.attributes);
4150
3833
  scripts.startup = scripts.startup || startupScriptFilename;
4151
3834
  const responseHandler = typeof handleResponses === 'function' ? handleResponses : handleResponse;
4152
- if (handleExceptions !== false) unhandledExceptionHandler(); // Create `process.on` event handlers for unhandled exceptions (Node v15+)
3835
+ if (handleExceptions !== false) unhandledExceptionHandler(handleExceptions); // Create `process.on` event handlers for unhandled exceptions (Node v15+)
4153
3836
 
4154
3837
  const versionInfo = getVersionInfo(staticFolderPath);
4155
- app.get('/*', async (request, response) => {
3838
+ app.get('/*', cookiesMiddleware__default["default"](), async (request, response) => {
4156
3839
  const {
4157
3840
  url
4158
3841
  } = request;
4159
- const cookies = new Cookies$1(request.headers.cookie);
4160
3842
  const matchedStaticRoute = () => reactRouterConfig.matchRoutes(routes.StaticRoutes, request.path);
4161
3843
  const isStaticRoute = () => matchedStaticRoute().length > 0;
4162
3844
  const staticRoute = isStaticRoute() && matchedStaticRoute()[0];
@@ -4192,17 +3874,21 @@ const webApp = (app, ReactApp, config) => {
4192
3874
 
4193
3875
  // dispatch any global and non-saga related actions before calling our JSX
4194
3876
  const versionStatus = ContensisDeliveryApi.deliveryApi.getServerSideVersionStatus(request);
4195
- console.info(`Request for ${request.path} hostname: ${request.hostname} versionStatus: ${versionStatus}`);
3877
+
3878
+ // In server-side blocks world, the hostname requested by the client resides in the x-orig-host header
3879
+ // Because of this, we prioritize x-orig-host when setting our hostname
3880
+ const hostname = request.headers['x-orig-host'] || request.hostname;
3881
+ console.info(`Request for ${request.path} hostname: ${hostname} versionStatus: ${versionStatus}`);
4196
3882
  store.dispatch(version$1.setVersionStatus(versionStatus));
4197
3883
  store.dispatch(version$1.setVersion(versionInfo.commitRef, versionInfo.buildNo));
4198
- const project = App.pickProject(request.hostname, request.query);
3884
+ const project = App.pickProject(hostname, request.query);
4199
3885
  const groups = allowedGroups && allowedGroups[project];
4200
- store.dispatch(selectors.setCurrentProject(project, groups, request.hostname));
3886
+ store.dispatch(selectors.setCurrentProject(project, groups, hostname));
4201
3887
  const loadableExtractor = loadableChunkExtractors();
4202
3888
  const jsx = /*#__PURE__*/React__default["default"].createElement(server$1.ChunkExtractorManager, {
4203
3889
  extractor: loadableExtractor.commonLoadableExtractor
4204
3890
  }, /*#__PURE__*/React__default["default"].createElement(reactCookie.CookiesProvider, {
4205
- cookies: cookies
3891
+ cookies: request.universalCookies
4206
3892
  }, /*#__PURE__*/React__default["default"].createElement(reactRedux.Provider, {
4207
3893
  store: store
4208
3894
  }, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.StaticRouter, {
@@ -4280,7 +3966,7 @@ const webApp = (app, ReactApp, config) => {
4280
3966
  serialisedReduxData = `<script ${attributes}>window.versionStatus = "${versionStatus}"; window.REDUX_DATA = ${serialisedReduxData}</script>`;
4281
3967
  }
4282
3968
  }
4283
- if ((context.statusCode || 200) > 400) {
3969
+ if ((context.statusCode || 200) >= 404) {
4284
3970
  accessMethod.STATIC = true;
4285
3971
  }
4286
3972
 
@@ -4346,7 +4032,6 @@ const start = (ReactApp, config, ServerFeatures) => {
4346
4032
  global.PROXY_DELIVERY_API = config.proxyDeliveryApi;
4347
4033
  global.REVERSE_PROXY_PATHS = Object(config.reverseProxyPaths);
4348
4034
  app.disable('x-powered-by');
4349
-
4350
4035
  // Output some information about the used build/startup configuration
4351
4036
  DisplayStartupConfiguration(config);
4352
4037
  ServerFeatures(app);
@@ -4365,6 +4050,7 @@ const start = (ReactApp, config, ServerFeatures) => {
4365
4050
  app.on('stop', () => {
4366
4051
  server.close(function () {
4367
4052
  console.info('GoodBye :(');
4053
+ process.exit();
4368
4054
  });
4369
4055
  });
4370
4056
  });