@zengenti/contensis-react-base 3.0.2-beta.23 → 3.0.2-beta.25

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 (96) hide show
  1. package/cjs/{App-21a7d836.js → App-ad6f7fa7.js} +48 -21
  2. package/cjs/App-ad6f7fa7.js.map +1 -0
  3. package/cjs/{ContensisDeliveryApi-c079b03a.js → ContensisDeliveryApi-98c0016f.js} +57 -34
  4. package/cjs/ContensisDeliveryApi-98c0016f.js.map +1 -0
  5. package/cjs/CookieConstants-000427db.js +10 -0
  6. package/cjs/CookieConstants-000427db.js.map +1 -0
  7. package/cjs/CookieHelper.class-daeb09dd.js +52 -0
  8. package/cjs/CookieHelper.class-daeb09dd.js.map +1 -0
  9. package/cjs/{RouteLoader-7f0d107a.js → RouteLoader-005d7f4e.js} +9 -5
  10. package/cjs/RouteLoader-005d7f4e.js.map +1 -0
  11. package/cjs/{ToJs-6e9cfa69.js → ToJs-5169fe56.js} +2 -2
  12. package/cjs/{ToJs-6e9cfa69.js.map → ToJs-5169fe56.js.map} +1 -1
  13. package/cjs/client.js +11 -10
  14. package/cjs/client.js.map +1 -1
  15. package/cjs/contensis-react-base.js +17 -341
  16. package/cjs/contensis-react-base.js.map +1 -1
  17. package/cjs/{login-2a6b5be0.js → login-c94a3369.js} +86 -80
  18. package/cjs/login-c94a3369.js.map +1 -0
  19. package/cjs/redux.js +3 -3
  20. package/cjs/routing.js +5 -3
  21. package/cjs/routing.js.map +1 -1
  22. package/cjs/{selectors-bcca60f4.js → selectors-bb991331.js} +4 -9
  23. package/cjs/selectors-bb991331.js.map +1 -0
  24. package/cjs/user.js +30 -15
  25. package/cjs/user.js.map +1 -1
  26. package/cjs/util.js +7 -3
  27. package/cjs/util.js.map +1 -1
  28. package/cjs/{version-4077e706.js → version-153ec9ef.js} +2 -2
  29. package/cjs/{version-4077e706.js.map → version-153ec9ef.js.map} +1 -1
  30. package/cjs/{version-fe28099e.js → version-963a7634.js} +3 -3
  31. package/cjs/{version-fe28099e.js.map → version-963a7634.js.map} +1 -1
  32. package/esm/{App-2af18a99.js → App-f7ef3cb9.js} +47 -21
  33. package/esm/App-f7ef3cb9.js.map +1 -0
  34. package/esm/{ContensisDeliveryApi-5660ee0e.js → ContensisDeliveryApi-137270c0.js} +56 -35
  35. package/esm/ContensisDeliveryApi-137270c0.js.map +1 -0
  36. package/esm/CookieConstants-3d3b6531.js +6 -0
  37. package/esm/CookieConstants-3d3b6531.js.map +1 -0
  38. package/esm/CookieHelper.class-4d6ee27b.js +49 -0
  39. package/esm/CookieHelper.class-4d6ee27b.js.map +1 -0
  40. package/esm/{RouteLoader-6eac364e.js → RouteLoader-d36840dd.js} +9 -5
  41. package/esm/RouteLoader-d36840dd.js.map +1 -0
  42. package/esm/{ToJs-9b30636a.js → ToJs-e1af7030.js} +2 -2
  43. package/esm/{ToJs-9b30636a.js.map → ToJs-e1af7030.js.map} +1 -1
  44. package/esm/client.js +12 -11
  45. package/esm/client.js.map +1 -1
  46. package/esm/contensis-react-base.js +17 -342
  47. package/esm/contensis-react-base.js.map +1 -1
  48. package/esm/{login-71ff3fcb.js → login-950e0b92.js} +79 -72
  49. package/esm/login-950e0b92.js.map +1 -0
  50. package/esm/redux.js +6 -6
  51. package/esm/routing.js +5 -3
  52. package/esm/routing.js.map +1 -1
  53. package/esm/{selectors-74de49a3.js → selectors-1a3c1725.js} +4 -9
  54. package/esm/selectors-1a3c1725.js.map +1 -0
  55. package/esm/user.js +27 -16
  56. package/esm/user.js.map +1 -1
  57. package/esm/util.js +5 -3
  58. package/esm/util.js.map +1 -1
  59. package/esm/{version-ef107106.js → version-6cc0418c.js} +2 -2
  60. package/esm/{version-ef107106.js.map → version-6cc0418c.js.map} +1 -1
  61. package/esm/{version-b15807c5.js → version-ec722079.js} +3 -3
  62. package/esm/{version-b15807c5.js.map → version-ec722079.js.map} +1 -1
  63. package/models/routing/redux/actions.d.ts +10 -6
  64. package/models/routing/redux/types.d.ts +0 -1
  65. package/models/routing/routes.d.ts +3 -0
  66. package/models/search/models/Queries.d.ts +8 -10
  67. package/models/search/models/Search.d.ts +24 -24
  68. package/models/search/models/SearchActions.d.ts +33 -33
  69. package/models/search/models/SearchState.d.ts +11 -11
  70. package/models/search/models/SearchUtil.d.ts +1 -1
  71. package/models/search/models/WithSearch.d.ts +1 -1
  72. package/models/search/redux/actions.d.ts +4 -4
  73. package/models/search/redux/selectors.d.ts +27 -27
  74. package/models/search/redux/util.d.ts +1 -1
  75. package/models/search/search/expressions.d.ts +4 -4
  76. package/models/search/search/util.d.ts +2 -2
  77. package/models/search/transformations/state-to-queryparams.mapper.d.ts +1 -1
  78. package/models/user/hocs/withLogin.d.ts +5 -5
  79. package/models/user/redux/actions.d.ts +2 -2
  80. package/models/user/redux/sagas/login.d.ts +9 -8
  81. package/models/user/util/CookieConstants.d.ts +7 -0
  82. package/models/user/util/CookieHelper.class.d.ts +15 -3
  83. package/models/user/util/LoginHelper.class.d.ts +26 -23
  84. package/models/util/ContensisDeliveryApi.d.ts +21 -14
  85. package/models/util/index.d.ts +1 -1
  86. package/package.json +4 -5
  87. package/cjs/App-21a7d836.js.map +0 -1
  88. package/cjs/ContensisDeliveryApi-c079b03a.js.map +0 -1
  89. package/cjs/RouteLoader-7f0d107a.js.map +0 -1
  90. package/cjs/login-2a6b5be0.js.map +0 -1
  91. package/cjs/selectors-bcca60f4.js.map +0 -1
  92. package/esm/App-2af18a99.js.map +0 -1
  93. package/esm/ContensisDeliveryApi-5660ee0e.js.map +0 -1
  94. package/esm/RouteLoader-6eac364e.js.map +0 -1
  95. package/esm/login-71ff3fcb.js.map +0 -1
  96. package/esm/selectors-74de49a3.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-c079b03a.js');
5
+ var ContensisDeliveryApi = require('./ContensisDeliveryApi-98c0016f.js');
6
6
  var contensisDeliveryApi = require('contensis-delivery-api');
7
7
  var React = require('react');
8
8
  var reactRedux = require('react-redux');
@@ -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
34
  var lodashClean = require('lodash-clean');
35
35
  var reactCookie = require('react-cookie');
36
- var version = require('./version-4077e706.js');
37
- var App = require('./App-21a7d836.js');
38
- var version$1 = require('./version-fe28099e.js');
39
- var selectors = require('./selectors-bcca60f4.js');
36
+ var cookiesMiddleware = require('universal-cookie-express');
37
+ var version = require('./version-153ec9ef.js');
38
+ var App = require('./App-ad6f7fa7.js');
39
+ var version$1 = require('./version-963a7634.js');
40
+ var selectors = require('./selectors-bb991331.js');
40
41
  var chalk = require('chalk');
42
+ require('./CookieConstants-000427db.js');
43
+ require('./CookieHelper.class-daeb09dd.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-2a6b5be0.js');
50
- require('./ToJs-6e9cfa69.js');
51
52
  require('await-to-js');
52
- require('js-cookie');
53
+ require('./login-c94a3369.js');
54
+ require('./ToJs-5169fe56.js');
53
55
  require('react-hot-loader');
54
- require('./RouteLoader-7f0d107a.js');
56
+ require('./RouteLoader-005d7f4e.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
  /**
@@ -3595,332 +3598,6 @@ function cloneDeep(value) {
3595
3598
 
3596
3599
  var cloneDeep_1 = cloneDeep;
3597
3600
 
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
3601
  var stringifyAttributes = ((attributes = {}) => Object.entries(attributes).map(([key, value], idx) => `${idx !== 0 ? ' ' : ''}${key}${value ? `="${value}"` : ''}`).join(' '));
3925
3602
 
3926
3603
  /* eslint-disable no-console */
@@ -4152,11 +3829,10 @@ const webApp = (app, ReactApp, config) => {
4152
3829
  if (handleExceptions !== false) unhandledExceptionHandler(); // Create `process.on` event handlers for unhandled exceptions (Node v15+)
4153
3830
 
4154
3831
  const versionInfo = getVersionInfo(staticFolderPath);
4155
- app.get('/*', async (request, response) => {
3832
+ app.get('/*', cookiesMiddleware__default["default"](), async (request, response) => {
4156
3833
  const {
4157
3834
  url
4158
3835
  } = request;
4159
- const cookies = new Cookies$1(request.headers.cookie);
4160
3836
  const matchedStaticRoute = () => reactRouterConfig.matchRoutes(routes.StaticRoutes, request.path);
4161
3837
  const isStaticRoute = () => matchedStaticRoute().length > 0;
4162
3838
  const staticRoute = isStaticRoute() && matchedStaticRoute()[0];
@@ -4206,7 +3882,7 @@ const webApp = (app, ReactApp, config) => {
4206
3882
  const jsx = /*#__PURE__*/React__default["default"].createElement(server$1.ChunkExtractorManager, {
4207
3883
  extractor: loadableExtractor.commonLoadableExtractor
4208
3884
  }, /*#__PURE__*/React__default["default"].createElement(reactCookie.CookiesProvider, {
4209
- cookies: cookies
3885
+ cookies: request.universalCookies
4210
3886
  }, /*#__PURE__*/React__default["default"].createElement(reactRedux.Provider, {
4211
3887
  store: store
4212
3888
  }, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.StaticRouter, {
@@ -4284,7 +3960,7 @@ const webApp = (app, ReactApp, config) => {
4284
3960
  serialisedReduxData = `<script ${attributes}>window.versionStatus = "${versionStatus}"; window.REDUX_DATA = ${serialisedReduxData}</script>`;
4285
3961
  }
4286
3962
  }
4287
- if ((context.statusCode || 200) > 400) {
3963
+ if ((context.statusCode || 200) >= 404) {
4288
3964
  accessMethod.STATIC = true;
4289
3965
  }
4290
3966