@zengenti/contensis-react-base 3.0.2-beta.5 → 3.0.2-beta.6

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 (84) hide show
  1. package/cjs/{App-48706fde.js → App-2a7a16ad.js} +89 -133
  2. package/{esm/App-e058aa68.js.map → cjs/App-2a7a16ad.js.map} +1 -1
  3. package/cjs/{ContensisDeliveryApi-cfdefe17.js → ContensisDeliveryApi-de88df2a.js} +13 -66
  4. package/cjs/ContensisDeliveryApi-de88df2a.js.map +1 -0
  5. package/cjs/{RouteLoader-fcd1e4f1.js → RouteLoader-47d70a26.js} +22 -35
  6. package/{esm/RouteLoader-e46234cc.js.map → cjs/RouteLoader-47d70a26.js.map} +1 -1
  7. package/cjs/{ToJs-d962c80f.js → ToJs-61c03582.js} +3 -4
  8. package/cjs/{ToJs-d962c80f.js.map → ToJs-61c03582.js.map} +1 -1
  9. package/cjs/client.js +11 -18
  10. package/cjs/client.js.map +1 -1
  11. package/cjs/contensis-react-base.js +113 -177
  12. package/cjs/contensis-react-base.js.map +1 -1
  13. package/cjs/forms.js +11 -153
  14. package/cjs/forms.js.map +1 -1
  15. package/cjs/{fromJSLeaveImmer-e74c673c.js → fromJSLeaveImmer-7c363211.js} +1 -4
  16. package/cjs/{fromJSLeaveImmer-e74c673c.js.map → fromJSLeaveImmer-7c363211.js.map} +1 -1
  17. package/cjs/{login-dfcea036.js → login-2ea569cc.js} +59 -110
  18. package/cjs/{login-dfcea036.js.map → login-2ea569cc.js.map} +1 -1
  19. package/cjs/{reducers-73a03ef4.js → reducers-9afb5f89.js} +10 -31
  20. package/{esm/reducers-aa8cef1e.js.map → cjs/reducers-9afb5f89.js.map} +1 -1
  21. package/cjs/redux.js +5 -4
  22. package/cjs/redux.js.map +1 -1
  23. package/cjs/routing.js +3 -3
  24. package/cjs/{sagas-8a20e424.js → sagas-6d12e7ca.js} +182 -282
  25. package/{esm/sagas-e576b6f6.js.map → cjs/sagas-6d12e7ca.js.map} +1 -1
  26. package/cjs/search.js +56 -82
  27. package/cjs/search.js.map +1 -1
  28. package/cjs/{selectors-fa607198.js → selectors-c76c2676.js} +1 -6
  29. package/cjs/selectors-c76c2676.js.map +1 -0
  30. package/cjs/urls-6fcaf4c6.js.map +1 -1
  31. package/cjs/user.js +4 -12
  32. package/cjs/user.js.map +1 -1
  33. package/cjs/util.js +35 -55
  34. package/cjs/util.js.map +1 -1
  35. package/cjs/{version-7ce96442.js → version-38afaf2a.js} +24 -58
  36. package/{esm/version-03d555b7.js.map → cjs/version-38afaf2a.js.map} +1 -1
  37. package/cjs/{version-d6e26cc4.js → version-886f49d8.js} +3 -6
  38. package/cjs/{version-d6e26cc4.js.map → version-886f49d8.js.map} +1 -1
  39. package/esm/{App-e058aa68.js → App-4fb1fc44.js} +89 -133
  40. package/{cjs/App-48706fde.js.map → esm/App-4fb1fc44.js.map} +1 -1
  41. package/esm/{ContensisDeliveryApi-8abcf222.js → ContensisDeliveryApi-ad06857d.js} +13 -66
  42. package/esm/ContensisDeliveryApi-ad06857d.js.map +1 -0
  43. package/esm/{RouteLoader-e46234cc.js → RouteLoader-f5d5f733.js} +22 -35
  44. package/{cjs/RouteLoader-fcd1e4f1.js.map → esm/RouteLoader-f5d5f733.js.map} +1 -1
  45. package/esm/{ToJs-502f7a11.js → ToJs-0066e629.js} +3 -4
  46. package/esm/{ToJs-502f7a11.js.map → ToJs-0066e629.js.map} +1 -1
  47. package/esm/client.js +12 -19
  48. package/esm/client.js.map +1 -1
  49. package/esm/contensis-react-base.js +114 -178
  50. package/esm/contensis-react-base.js.map +1 -1
  51. package/esm/forms.js +11 -153
  52. package/esm/forms.js.map +1 -1
  53. package/esm/{fromJSLeaveImmer-0114ffcf.js → fromJSLeaveImmer-e2dacd63.js} +1 -4
  54. package/esm/{fromJSLeaveImmer-0114ffcf.js.map → fromJSLeaveImmer-e2dacd63.js.map} +1 -1
  55. package/esm/{login-a950263f.js → login-bffb081f.js} +59 -110
  56. package/esm/{login-a950263f.js.map → login-bffb081f.js.map} +1 -1
  57. package/esm/{reducers-aa8cef1e.js → reducers-3d5c37d1.js} +10 -31
  58. package/{cjs/reducers-73a03ef4.js.map → esm/reducers-3d5c37d1.js.map} +1 -1
  59. package/esm/redux.js +8 -7
  60. package/esm/redux.js.map +1 -1
  61. package/esm/routing.js +3 -3
  62. package/esm/{sagas-e576b6f6.js → sagas-53d2aefb.js} +134 -235
  63. package/{cjs/sagas-8a20e424.js.map → esm/sagas-53d2aefb.js.map} +1 -1
  64. package/esm/search.js +57 -83
  65. package/esm/search.js.map +1 -1
  66. package/esm/{selectors-78355a01.js → selectors-3f0d804d.js} +1 -6
  67. package/esm/selectors-3f0d804d.js.map +1 -0
  68. package/esm/urls-eac9a747.js.map +1 -1
  69. package/esm/user.js +6 -14
  70. package/esm/user.js.map +1 -1
  71. package/esm/util.js +35 -55
  72. package/esm/util.js.map +1 -1
  73. package/esm/{version-03d555b7.js → version-dd31c7f0.js} +24 -58
  74. package/{cjs/version-7ce96442.js.map → esm/version-dd31c7f0.js.map} +1 -1
  75. package/esm/{version-5ce7dbce.js → version-f4629693.js} +3 -6
  76. package/esm/{version-5ce7dbce.js.map → version-f4629693.js.map} +1 -1
  77. package/models/app/pages/VersionInfo/components/VersionInfo.styled.d.ts +2 -1
  78. package/models/user/components.styled/Login.styled.d.ts +1 -1
  79. package/models/user/components.styled/LoginForm.styled.d.ts +1 -1
  80. package/package.json +2 -2
  81. package/cjs/ContensisDeliveryApi-cfdefe17.js.map +0 -1
  82. package/cjs/selectors-fa607198.js.map +0 -1
  83. package/esm/ContensisDeliveryApi-8abcf222.js.map +0 -1
  84. package/esm/selectors-78355a01.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContensisDeliveryApi-de88df2a.js","sources":["../src/util/ContensisDeliveryApi.js"],"sourcesContent":["import { Client } from 'contensis-delivery-api';\nimport { parse } from 'query-string';\nimport { setSurrogateKeys } from '../routing/redux/actions';\nimport { reduxStore } from '~/redux/store/store';\n\nconst storeSurrogateKeys = response => {\n const keys = response.headers.get\n ? response.headers.get('surrogate-key')\n : response.headers.map['surrogate-key'];\n if (keys) reduxStore?.dispatch(setSurrogateKeys(keys, response.url));\n};\n\nexport const getClientConfig = project => {\n let config = DELIVERY_API_CONFIG; /* global DELIVERY_API_CONFIG */\n config.responseHandler = {};\n\n if (project) {\n config.projectId = project;\n }\n\n // we only want the surrogate key header in a server context\n if (typeof window === 'undefined') {\n config.defaultHeaders = {\n 'x-require-surrogate-key': true,\n };\n config.responseHandler[200] = storeSurrogateKeys;\n }\n\n if (\n typeof window !== 'undefined' &&\n PROXY_DELIVERY_API /* global PROXY_DELIVERY_API */\n ) {\n // ensure a relative url is used to bypass the need for CORS (separate OPTIONS calls)\n config.rootUrl = '';\n config.responseHandler[404] = () => null;\n }\n return config;\n};\n\nexport * from 'contensis-delivery-api';\n\nclass DeliveryApi {\n getClientSideVersionStatus = () => {\n if (typeof window !== 'undefined') {\n // Allow overriding versionStatus with the querystring\n const { versionStatus } = parse(window.location.search);\n if (versionStatus) return versionStatus;\n // Client-side we will have a global variable set if rendered by SSR in production\n if (typeof window.versionStatus !== 'undefined')\n return window.versionStatus;\n // For localhost development we can only work out versionStatus from the current hostname\n const currentHostname = window.location.hostname;\n return this.getVersionStatusFromHostname(currentHostname);\n }\n return null;\n };\n getServerSideVersionStatus = request =>\n request.query.versionStatus ||\n deliveryApi.getVersionStatusFromHeaders(request.headers) ||\n deliveryApi.getVersionStatusFromHostname(request.hostname);\n getVersionStatusFromHeaders = headers => {\n const versionStatusHeader = headers['x-entry-versionstatus'];\n if (typeof versionStatusHeader !== 'undefined') return versionStatusHeader;\n return null;\n };\n getVersionStatusFromHostname = currentHostname => {\n if (currentHostname.indexOf('localhost') > -1) return 'latest';\n\n if (currentHostname.endsWith('contensis.cloud')) {\n if (currentHostname.indexOf('preview.') > -1) {\n return 'latest';\n } else {\n return 'published';\n }\n }\n\n if (currentHostname.endsWith('cloud.contensis.com')) {\n if (currentHostname.indexOf('preview-') > -1) {\n return 'latest';\n } else {\n return 'published';\n }\n }\n\n return 'published';\n };\n search = (query, linkDepth, project, env) => {\n const client = Client.create(getClientConfig(project, env));\n return client.entries.search(\n query,\n typeof linkDepth !== 'undefined' ? linkDepth : 1\n );\n };\n getClient = (deliveryApiStatus = 'published', project, env) => {\n const baseConfig = getClientConfig(project, env);\n baseConfig.versionStatus = deliveryApiStatus;\n return Client.create(baseConfig);\n };\n getEntry = (\n id,\n linkDepth = 0,\n deliveryApiStatus = 'published',\n project,\n env\n ) => {\n const baseConfig = getClientConfig(project, env);\n baseConfig.versionStatus = deliveryApiStatus;\n const client = Client.create(baseConfig);\n // return client.entries.get(id, linkDepth);\n return client.entries.get({ id, linkDepth });\n };\n}\n\nexport const deliveryApi = new DeliveryApi();\n\nclass CacheNode {\n constructor(key, value) {\n this.key = key;\n this.value = value;\n this.next = null;\n this.prev = null;\n }\n}\n\nclass LruCache {\n constructor(limit = 100) {\n this.map = {};\n this.head = null;\n this.tail = null;\n this.limit = limit || 100;\n this.size = 0;\n }\n\n get(key) {\n if (this.map[key]) {\n let value = this.map[key].value;\n let node = new CacheNode(key, value);\n this.remove(key);\n this.setHead(node);\n return value;\n }\n }\n\n set(key, value) {\n let node = new CacheNode(key, value);\n if (this.map[key]) {\n this.remove(key);\n } else {\n if (this.size >= this.limit) {\n delete this.map[this.tail.key];\n this.size--;\n this.tail = this.tail.prev;\n this.tail.next = null;\n }\n }\n this.setHead(node);\n }\n\n setHead(node) {\n node.next = this.head;\n node.prev = null;\n if (this.head) {\n this.head.prev = node;\n }\n this.head = node;\n if (!this.tail) {\n this.tail = node;\n }\n this.size++;\n this.map[node.key] = node;\n }\n\n remove(key) {\n let node = this.map[key];\n if (!node) return; // This is sometimes null and crashes the container without this check\n\n if (node.prev) {\n node.prev.next = node.next;\n } else {\n this.head = node.next;\n }\n if (node.next) {\n node.next.prev = node.prev;\n } else {\n this.tail = node.prev;\n }\n delete this.map[key];\n this.size--;\n }\n}\n\nclass CachedSearch {\n cache = new LruCache();\n taxonomyLookup = {};\n\n search(query, linkDepth, project, env) {\n const client = Client.create(getClientConfig(project, env));\n return this.request(\n project + JSON.stringify(query) + linkDepth.toString(),\n () => client.entries.search(query, linkDepth)\n );\n }\n\n searchUsingPost(query, linkDepth = 0, project = '', env) {\n const client = Client.create(getClientConfig(project, env));\n return this.request(\n project + JSON.stringify(query) + linkDepth.toString(),\n () => client.entries.searchUsingPost(query, linkDepth)\n );\n }\n\n get(id, linkDepth, versionStatus, project, env) {\n const client = Client.create(getClientConfig(project, env));\n client.clientConfig.versionStatus = versionStatus;\n return this.request(id, () => client.entries.get({ id, linkDepth }));\n }\n\n getContentType(id, project, env) {\n const client = Client.create(getClientConfig(project, env));\n return this.request(`[CONTENT TYPE] ${id} ${project}`, () =>\n client.contentTypes.get(id)\n );\n }\n\n getTaxonomyNode(key, project, env) {\n const client = Client.create(getClientConfig(project, env));\n return this.request(`[TAXONOMY NODE] ${key}`, () =>\n client.taxonomy\n .resolveChildren(key)\n .then(node => this.extendTaxonomyNode(node))\n );\n }\n\n getRootNode(options, project, env) {\n const client = Client.create(getClientConfig(project, env));\n return this.request(`${project} / ${JSON.stringify(options)}`, () =>\n client.nodes.getRoot(options)\n );\n }\n\n getNode(options, project, env) {\n const client = Client.create(getClientConfig(project, env));\n return this.request(\n `${project} ${(options && options.path) || options} ${JSON.stringify(\n options\n )}`,\n () => client.nodes.get(options)\n );\n }\n\n getAncestors(options, project, env) {\n const client = Client.create(getClientConfig(project, env));\n return this.request(\n `${project} [A] ${(options && options.id) || options} ${JSON.stringify(\n options\n )}`,\n () => client.nodes.getAncestors(options)\n );\n }\n\n getChildren(options, project, env) {\n const client = Client.create(getClientConfig(project, env));\n return this.request(\n `${project} [C] ${(options && options.id) || options} ${JSON.stringify(\n options\n )}`,\n () => client.nodes.getChildren(options)\n );\n }\n\n getSiblings(options, project, env) {\n const client = Client.create(getClientConfig(project, env));\n return this.request(\n `${project} [S] ${(options && options.id) || options} ${JSON.stringify(\n options\n )}`,\n () => client.nodes.getSiblings(options)\n );\n }\n\n request(key, execute) {\n if (!this.cache.get(key) || typeof window == 'undefined') {\n let promise = execute();\n this.cache.set(key, promise);\n promise.catch(() => {\n this.cache.remove(key);\n });\n }\n return this.cache.get(key);\n }\n}\n\nexport const cachedSearch = new CachedSearch();\n"],"names":["storeSurrogateKeys","response","keys","headers","get","map","reduxStore","dispatch","setSurrogateKeys","url","getClientConfig","project","config","DELIVERY_API_CONFIG","responseHandler","projectId","window","defaultHeaders","PROXY_DELIVERY_API","rootUrl","DeliveryApi","constructor","getClientSideVersionStatus","versionStatus","parse","location","search","currentHostname","hostname","getVersionStatusFromHostname","getServerSideVersionStatus","request","query","deliveryApi","getVersionStatusFromHeaders","versionStatusHeader","indexOf","endsWith","linkDepth","env","client","Client","create","entries","getClient","deliveryApiStatus","baseConfig","getEntry","id","CacheNode","key","value","next","prev","LruCache","limit","head","tail","size","node","remove","setHead","set","CachedSearch","cache","taxonomyLookup","JSON","stringify","toString","searchUsingPost","clientConfig","getContentType","contentTypes","getTaxonomyNode","taxonomy","resolveChildren","then","extendTaxonomyNode","getRootNode","options","nodes","getRoot","getNode","path","getAncestors","getChildren","getSiblings","execute","promise","catch","cachedSearch"],"mappings":";;;;;;;AAKA,MAAMA,kBAAkB,GAAGC,QAAQ,IAAI;EACrC,MAAMC,IAAI,GAAGD,QAAQ,CAACE,OAAO,CAACC,GAAG,GAC7BH,QAAQ,CAACE,OAAO,CAACC,GAAG,CAAC,eAAe,CAAC,GACrCH,QAAQ,CAACE,OAAO,CAACE,GAAG,CAAC,eAAe,CAAC,CAAA;AACzC,EAAA,IAAIH,IAAI,EAAEI,kBAAU,aAAVA,kBAAU,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAVA,kBAAU,CAAEC,QAAQ,CAACC,0BAAgB,CAACN,IAAI,EAAED,QAAQ,CAACQ,GAAG,CAAC,CAAC,CAAA;AACtE,CAAC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CAACZ,GAAG,EAAEsC,OAAO,CAAC,CAAA;MAC5BA,OAAO,CAACC,KAAK,CAAC,MAAM;AAClB,QAAA,IAAI,CAACzB,KAAK,CAACJ,MAAM,CAACV,GAAG,CAAC,CAAA;AACxB,OAAC,CAAC,CAAA;AACJ,KAAA;AACA,IAAA,OAAO,IAAI,CAACc,KAAK,CAAC5D,GAAG,CAAC8C,GAAG,CAAC,CAAA;AAC5B,GAAA;AACF,CAAA;AAEawC,MAAAA,YAAY,GAAG,IAAI3B,YAAY;;;;;;"}
@@ -6,8 +6,8 @@ var reactHotLoader = require('react-hot-loader');
6
6
  var reactRouterDom = require('react-router-dom');
7
7
  var reactRouterConfig = require('react-router-config');
8
8
  var reselect = require('reselect');
9
- var selectors = require('./selectors-fa607198.js');
10
- var ToJs = require('./ToJs-d962c80f.js');
9
+ var selectors = require('./selectors-c76c2676.js');
10
+ var ToJs = require('./ToJs-61c03582.js');
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13
 
@@ -41,27 +41,21 @@ const Status = ({
41
41
 
42
42
  const replaceDoubleSlashRecursive = path => {
43
43
  const nextPath = path.replace(/\/\//, '/');
44
-
45
44
  if (nextPath.match(/\/\//)) {
46
45
  return replaceDoubleSlashRecursive(nextPath);
47
46
  }
48
-
49
47
  return nextPath;
50
48
  };
51
-
52
49
  const getTrimmedPath = path => {
53
50
  if (path !== '/') {
54
51
  const nextPath = replaceDoubleSlashRecursive(path);
55
52
  const lastChar = nextPath[nextPath.length - 1];
56
-
57
53
  if (lastChar === '/') {
58
54
  return nextPath.substring(0, nextPath.length - 1);
59
55
  }
60
56
  }
61
-
62
57
  return path;
63
58
  };
64
-
65
59
  const RouteLoader = ({
66
60
  contentTypeId,
67
61
  entry,
@@ -82,28 +76,24 @@ const RouteLoader = ({
82
76
  withEvents,
83
77
  trailingSlashRedirectCode = 302
84
78
  }) => {
85
- const location = reactRouterDom.useLocation(); // Always ensure paths are trimmed of trailing slashes so urls are always unique
86
-
87
- const trimmedPath = getTrimmedPath(location.pathname); // Match any Static Routes a developer has defined
79
+ const location = reactRouterDom.useLocation();
80
+ // Always ensure paths are trimmed of trailing slashes so urls are always unique
81
+ const trimmedPath = getTrimmedPath(location.pathname);
88
82
 
83
+ // Match any Static Routes a developer has defined
89
84
  const matchedStaticRoute = () => reactRouterConfig.matchRoutes(routes.StaticRoutes, location.pathname);
90
-
91
85
  const isStaticRoute = () => matchedStaticRoute().length > 0;
92
-
93
86
  const staticRoute = isStaticRoute() && matchedStaticRoute()[0];
94
87
  const routeRequiresLogin = staticRoute && staticRoute.route.requireLogin;
95
88
  const setPath = React.useCallback(() => {
96
89
  // Use serverPath to control the path we send to siteview node api to resolve a route
97
90
  let serverPath = '';
98
-
99
91
  if (staticRoute && staticRoute.match && staticRoute.match.isExact) {
100
92
  var _route$path, _route$fetchNode;
101
-
102
93
  const {
103
94
  match,
104
95
  route
105
96
  } = staticRoute;
106
-
107
97
  if ((_route$path = route.path) !== null && _route$path !== void 0 && _route$path.includes('*')) {
108
98
  // Send the whole url to api if we have matched route containing wildcard
109
99
  serverPath = match.url;
@@ -120,30 +110,32 @@ const RouteLoader = ({
120
110
  }).replace(/\/$/, '');
121
111
  } else {
122
112
  var _route$path2;
123
-
124
113
  // Send all non-parameterised url parts to api
125
114
  serverPath = (_route$path2 = route.path) === null || _route$path2 === void 0 ? void 0 : _route$path2.split('/').filter(p => !p.startsWith(':')).join('/');
126
115
  }
127
116
  }
128
-
129
- setNavigationPath(serverPath || trimmedPath, location, staticRoute, withEvents, statePath, routes); // eslint-disable-next-line react-hooks/exhaustive-deps
130
- }, [setNavigationPath, // staticRoute,
131
- withEvents, location, routes, // statePath,
117
+ setNavigationPath(serverPath || trimmedPath, location, staticRoute, withEvents, statePath, routes);
118
+ // eslint-disable-next-line react-hooks/exhaustive-deps
119
+ }, [setNavigationPath,
120
+ // staticRoute,
121
+ withEvents, location, routes,
122
+ // statePath,
132
123
  trimmedPath]);
133
124
  if (typeof window == 'undefined') setPath();
134
125
  React.useEffect(() => {
135
126
  setPath();
136
- }, [location, setPath]); // Need to redirect when url endswith a /
127
+ }, [location, setPath]);
137
128
 
129
+ // Need to redirect when url endswith a /
138
130
  if (location.pathname.length > trimmedPath.length) {
139
131
  return /*#__PURE__*/React__default["default"].createElement(Status, {
140
132
  code: trailingSlashRedirectCode
141
133
  }, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Redirect, {
142
134
  to: `${trimmedPath}${location.search}${location.hash}`
143
135
  }));
144
- } // Render any Static Routes a developer has defined
145
-
136
+ }
146
137
 
138
+ // Render any Static Routes a developer has defined
147
139
  if (isStaticRoute() && !(!isLoggedIn && routeRequiresLogin)) {
148
140
  if (ToJs.matchUserGroup(userGroups, routeRequiresLogin)) return reactRouterConfig.renderRoutes(routes.StaticRoutes, {
149
141
  projectId,
@@ -152,19 +144,18 @@ const RouteLoader = ({
152
144
  mappedEntry,
153
145
  isLoggedIn
154
146
  });
155
- } // Render a supplied Loading component if the route
156
- // is not a static route and is in a loading state
157
-
147
+ }
158
148
 
149
+ // Render a supplied Loading component if the route
150
+ // is not a static route and is in a loading state
159
151
  if (isLoading && !isNotFound && loadingComponent) {
160
152
  const LoadingComponent = loadingComponent;
161
153
  return /*#__PURE__*/React__default["default"].createElement(LoadingComponent, null);
162
- } // Match any defined Content Type Mappings
163
-
154
+ }
164
155
 
156
+ // Match any defined Content Type Mappings
165
157
  if (contentTypeId && !(!isLoggedIn && routeRequiresLogin)) {
166
158
  const MatchedComponent = routes.ContentTypeMappings.find(item => item.contentTypeID === contentTypeId);
167
-
168
159
  if (MatchedComponent && !(MatchedComponent.requireLogin && !isLoggedIn)) {
169
160
  if (ToJs.matchUserGroup(userGroups, MatchedComponent.requireLogin)) return /*#__PURE__*/React__default["default"].createElement(MatchedComponent.component, {
170
161
  projectId: projectId,
@@ -175,9 +166,7 @@ const RouteLoader = ({
175
166
  });
176
167
  }
177
168
  }
178
-
179
169
  const NotFoundComponent = notFoundComponent ? notFoundComponent : NotFound;
180
-
181
170
  if (isNotFound || isError) {
182
171
  return /*#__PURE__*/React__default["default"].createElement(Status, {
183
172
  code: statusCode
@@ -186,10 +175,8 @@ const RouteLoader = ({
186
175
  statusText: statusText
187
176
  }));
188
177
  }
189
-
190
178
  return null;
191
179
  };
192
-
193
180
  const mapStateToPropsMemoized = reselect.createSelector(selectors.selectRouteEntryContentTypeId, selectors.selectRouteEntry, selectors.selectRouteIsError, selectors.selectIsNotFound, selectors.selectRouteLoading, ToJs.selectUserIsAuthenticated, selectors.selectMappedEntry, selectors.selectCurrentProject, selectors.selectCurrentPath, selectors.selectRouteStatusCode, selectors.selectRouteErrorMessage, ToJs.selectUserGroups, (contentTypeId, entry, isError, isNotFound, isLoading, isLoggedIn, mappedEntry, projectId, statePath, statusCode, statusText, userGroups) => ({
194
181
  contentTypeId,
195
182
  entry,
@@ -210,4 +197,4 @@ const mapDispatchToProps = {
210
197
  var RouteLoader$1 = reactHotLoader.hot(module)(reactRedux.connect(mapStateToPropsMemoized, mapDispatchToProps)(ToJs.toJS(RouteLoader)));
211
198
 
212
199
  exports.RouteLoader = RouteLoader$1;
213
- //# sourceMappingURL=RouteLoader-fcd1e4f1.js.map
200
+ //# sourceMappingURL=RouteLoader-47d70a26.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RouteLoader-e46234cc.js","sources":["../src/routing/components/NotFound.tsx","../src/routing/components/Status.tsx","../src/routing/components/RouteLoader.tsx"],"sourcesContent":["import React from 'react';\n\nconst NotFound = ({\n statusCode,\n statusText,\n}: {\n statusCode: number;\n statusText: string;\n}) => (\n <>\n <header>\n <h1>{statusCode || '404'} Page Not Found</h1>\n {statusText && (\n <h2\n style={{\n background: '#eee',\n color: '#666',\n fontSize: '100%',\n padding: '10px',\n }}\n >\n {statusText}\n </h2>\n )}\n </header>\n </>\n);\n\nexport default NotFound;\n","import React, { PropsWithChildren } from 'react';\nimport { Route } from 'react-router-dom';\n\nexport const Status = ({\n code,\n children,\n}: PropsWithChildren<{ code: number }>) => {\n return (\n <Route\n render={({ staticContext }) => {\n if (staticContext) staticContext.statusCode = code;\n return children;\n }}\n />\n );\n};\n","import React, { useEffect, useCallback } from 'react';\nimport { connect } from 'react-redux';\nimport { hot } from 'react-hot-loader';\nimport { Redirect, useLocation } from 'react-router-dom';\nimport { renderRoutes, matchRoutes, RouteConfig } from 'react-router-config';\nimport { createSelector } from 'reselect';\n\nimport NotFound from './NotFound';\nimport { Status } from './Status';\n\nimport {\n selectCurrentPath,\n selectCurrentProject,\n selectIsNotFound,\n selectMappedEntry,\n selectRouteEntry,\n selectRouteEntryContentTypeId,\n selectRouteErrorMessage,\n selectRouteIsError,\n selectRouteLoading,\n selectRouteStatusCode,\n} from '../redux/selectors';\nimport { setNavigationPath } from '../redux/actions';\n\nimport {\n selectUserGroups,\n selectUserIsAuthenticated,\n} from '~/user/redux/selectors';\nimport { matchUserGroup } from '~/user/util/matchGroups';\n\nimport { toJS } from '~/util/ToJs';\nimport { Entry } from 'contensis-delivery-api/lib/models';\nimport { AppRootProps, RouteComponentProps, RouteLoaderProps } from '../routes';\n\nconst replaceDoubleSlashRecursive = (path: string) => {\n const nextPath = path.replace(/\\/\\//, '/');\n\n if (nextPath.match(/\\/\\//)) {\n return replaceDoubleSlashRecursive(nextPath);\n }\n\n return nextPath;\n};\n\nconst getTrimmedPath = path => {\n if (path !== '/') {\n const nextPath = replaceDoubleSlashRecursive(path);\n const lastChar = nextPath[nextPath.length - 1];\n if (lastChar === '/') {\n return nextPath.substring(0, nextPath.length - 1);\n }\n }\n return path;\n};\n\ninterface IReduxProps {\n contentTypeId: string | null;\n entry: Entry | null;\n isError: boolean;\n isNotFound: boolean;\n isLoading: boolean;\n isLoggedIn: boolean;\n mappedEntry: any;\n projectId: string;\n setNavigationPath: typeof setNavigationPath;\n statePath: string;\n statusCode: any;\n statusText: string;\n userGroups: any;\n}\n\nconst RouteLoader = ({\n contentTypeId,\n entry,\n isError,\n isLoading,\n isLoggedIn,\n isNotFound,\n loadingComponent,\n mappedEntry,\n notFoundComponent,\n projectId,\n routes,\n setNavigationPath,\n statePath,\n statusCode,\n statusText,\n userGroups,\n withEvents,\n trailingSlashRedirectCode = 302,\n}: AppRootProps & RouteLoaderProps & IReduxProps) => {\n const location = useLocation();\n // Always ensure paths are trimmed of trailing slashes so urls are always unique\n const trimmedPath = getTrimmedPath(location.pathname);\n\n // Match any Static Routes a developer has defined\n const matchedStaticRoute = () =>\n matchRoutes(routes.StaticRoutes as RouteConfig[], location.pathname);\n const isStaticRoute = () => matchedStaticRoute().length > 0;\n\n const staticRoute = isStaticRoute() && matchedStaticRoute()[0];\n const routeRequiresLogin = staticRoute && staticRoute.route.requireLogin;\n\n const setPath = useCallback(() => {\n // Use serverPath to control the path we send to siteview node api to resolve a route\n let serverPath = '';\n if (staticRoute && staticRoute.match && staticRoute.match.isExact) {\n const { match, route } = staticRoute;\n\n if (route.path?.includes('*')) {\n // Send the whole url to api if we have matched route containing wildcard\n serverPath = match.url;\n } else if (typeof route.fetchNodeLevel === 'number') {\n // Send all url parts to a specified level to api\n serverPath = match.url\n .split('/')\n .splice(0, route.fetchNodeLevel + 1)\n .join('/');\n } else if (route.fetchNode?.params) {\n const fetchNodeParams: string[] = route.fetchNode.params;\n const routeParams: { [key: string]: string } = match.params;\n\n const regexExp = new RegExp(\n Object.keys(routeParams)\n .map(p => `:${p}`)\n .join('|'),\n 'g'\n );\n\n serverPath = match.path\n .replace(/\\?/g, '')\n .replace(regexExp, matched => {\n const param = matched.replace(':', '');\n if (fetchNodeParams.includes(param)) return routeParams[param];\n else return '';\n })\n .replace(/\\/$/, '');\n } else {\n // Send all non-parameterised url parts to api\n serverPath = (route.path as string)\n ?.split('/')\n .filter(p => !p.startsWith(':'))\n .join('/');\n }\n }\n\n setNavigationPath(\n serverPath || trimmedPath,\n location,\n staticRoute,\n withEvents,\n statePath,\n routes\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n setNavigationPath,\n // staticRoute,\n withEvents,\n location,\n routes,\n // statePath,\n trimmedPath,\n ]);\n\n if (typeof window == 'undefined') setPath();\n\n useEffect(() => {\n setPath();\n }, [location, setPath]);\n\n // Need to redirect when url endswith a /\n if (location.pathname.length > trimmedPath.length) {\n return (\n <Status code={trailingSlashRedirectCode}>\n <Redirect to={`${trimmedPath}${location.search}${location.hash}`} />\n </Status>\n );\n }\n\n // Render any Static Routes a developer has defined\n if (isStaticRoute() && !(!isLoggedIn && routeRequiresLogin)) {\n if (matchUserGroup(userGroups, routeRequiresLogin))\n return renderRoutes(\n routes.StaticRoutes as RouteConfig[],\n {\n projectId,\n contentTypeId,\n entry,\n mappedEntry,\n isLoggedIn,\n } as RouteComponentProps\n );\n }\n\n // Render a supplied Loading component if the route\n // is not a static route and is in a loading state\n if (isLoading && !isNotFound && loadingComponent) {\n const LoadingComponent = loadingComponent;\n return <LoadingComponent />;\n }\n\n // Match any defined Content Type Mappings\n if (contentTypeId && !(!isLoggedIn && routeRequiresLogin)) {\n const MatchedComponent = routes.ContentTypeMappings.find(\n item => item.contentTypeID === contentTypeId\n );\n\n if (MatchedComponent && !(MatchedComponent.requireLogin && !isLoggedIn)) {\n if (matchUserGroup(userGroups, MatchedComponent.requireLogin))\n return (\n <MatchedComponent.component\n projectId={projectId}\n contentTypeId={contentTypeId}\n entry={entry}\n mappedEntry={mappedEntry}\n isLoggedIn={isLoggedIn}\n />\n );\n }\n }\n\n const NotFoundComponent = notFoundComponent ? notFoundComponent : NotFound;\n if (isNotFound || isError) {\n return (\n <Status code={statusCode}>\n <NotFoundComponent statusCode={statusCode} statusText={statusText} />\n </Status>\n );\n }\n\n return null;\n};\nconst mapStateToPropsMemoized = createSelector(\n selectRouteEntryContentTypeId,\n selectRouteEntry,\n selectRouteIsError,\n selectIsNotFound,\n selectRouteLoading,\n selectUserIsAuthenticated,\n selectMappedEntry,\n selectCurrentProject,\n selectCurrentPath,\n selectRouteStatusCode,\n selectRouteErrorMessage,\n selectUserGroups,\n (\n contentTypeId,\n entry,\n isError,\n isNotFound,\n isLoading,\n isLoggedIn,\n mappedEntry,\n projectId,\n statePath,\n statusCode,\n statusText,\n userGroups\n ) => ({\n contentTypeId,\n entry,\n isError,\n isNotFound,\n isLoading,\n isLoggedIn,\n mappedEntry,\n projectId,\n statePath,\n statusCode,\n statusText,\n userGroups,\n })\n);\n\nconst mapDispatchToProps = {\n setNavigationPath,\n};\n\nexport default hot(module)(\n connect(mapStateToPropsMemoized, mapDispatchToProps)(toJS(RouteLoader))\n) as unknown as (props: AppRootProps & RouteLoaderProps) => JSX.Element;\n"],"names":["NotFound","statusCode","statusText","background","color","fontSize","padding","Status","code","children","staticContext","replaceDoubleSlashRecursive","path","nextPath","replace","match","getTrimmedPath","lastChar","length","substring","RouteLoader","contentTypeId","entry","isError","isLoading","isLoggedIn","isNotFound","loadingComponent","mappedEntry","notFoundComponent","projectId","routes","setNavigationPath","statePath","userGroups","withEvents","trailingSlashRedirectCode","location","useLocation","trimmedPath","pathname","matchedStaticRoute","matchRoutes","StaticRoutes","isStaticRoute","staticRoute","routeRequiresLogin","route","requireLogin","setPath","useCallback","serverPath","isExact","includes","url","fetchNodeLevel","split","splice","join","fetchNode","params","fetchNodeParams","routeParams","regexExp","RegExp","Object","keys","map","p","matched","param","filter","startsWith","window","useEffect","search","hash","matchUserGroup","renderRoutes","LoadingComponent","MatchedComponent","ContentTypeMappings","find","item","contentTypeID","NotFoundComponent","mapStateToPropsMemoized","createSelector","selectRouteEntryContentTypeId","selectRouteEntry","selectRouteIsError","selectIsNotFound","selectRouteLoading","selectUserIsAuthenticated","selectMappedEntry","selectCurrentProject","selectCurrentPath","selectRouteStatusCode","selectRouteErrorMessage","selectUserGroups","mapDispatchToProps","hot","module","connect","toJS"],"mappings":";;;;;;;;;AAEA,MAAMA,QAAQ,GAAG,CAAC;AAChBC,EAAAA,UADgB;AAEhBC,EAAAA,UAAAA;AAFgB,CAAD,kBAOf,KACE,CAAA,aAAA,CAAA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E,aADF,EAEEC,KAFF,EAGEC,OAHF,EAIEG,UAJF,EAKEF,SALF,EAMEC,UANF,EAOEG,WAPF,EAQEE,SARF,EASEG,SATF,EAUEhC,UAVF,EAWEC,UAXF,EAYEgC,UAZF,MAaM;AACJb,EAAAA,aADI;AAEJC,EAAAA,KAFI;AAGJC,EAAAA,OAHI;AAIJG,EAAAA,UAJI;AAKJF,EAAAA,SALI;AAMJC,EAAAA,UANI;AAOJG,EAAAA,WAPI;AAQJE,EAAAA,SARI;AASJG,EAAAA,SATI;AAUJhC,EAAAA,UAVI;AAWJC,EAAAA,UAXI;AAYJgC,EAAAA,UAAAA;AAZI,CAbN,CAb4C,CAA9C,CAAA;AA0CA,MAAMkE,kBAAkB,GAAG;AACzBpE,EAAAA,iBAAAA;AADyB,CAA3B,CAAA;AAIA,oBAAeqE,GAAG,CAACC,MAAD,CAAH,CACbC,OAAO,CAACjB,uBAAD,EAA0Bc,kBAA1B,CAAP,CAAqDI,IAAI,CAACpF,WAAD,CAAzD,CADa,CAAf;;;;"}
1
+ {"version":3,"file":"RouteLoader-47d70a26.js","sources":["../src/routing/components/NotFound.tsx","../src/routing/components/Status.tsx","../src/routing/components/RouteLoader.tsx"],"sourcesContent":["import React from 'react';\n\nconst NotFound = ({\n statusCode,\n statusText,\n}: {\n statusCode: number;\n statusText: string;\n}) => (\n <>\n <header>\n <h1>{statusCode || '404'} Page Not Found</h1>\n {statusText && (\n <h2\n style={{\n background: '#eee',\n color: '#666',\n fontSize: '100%',\n padding: '10px',\n }}\n >\n {statusText}\n </h2>\n )}\n </header>\n </>\n);\n\nexport default NotFound;\n","import React, { PropsWithChildren } from 'react';\nimport { Route } from 'react-router-dom';\n\nexport const Status = ({\n code,\n children,\n}: PropsWithChildren<{ code: number }>) => {\n return (\n <Route\n render={({ staticContext }) => {\n if (staticContext) staticContext.statusCode = code;\n return children;\n }}\n />\n );\n};\n","import React, { useEffect, useCallback } from 'react';\nimport { connect } from 'react-redux';\nimport { hot } from 'react-hot-loader';\nimport { Redirect, useLocation } from 'react-router-dom';\nimport { renderRoutes, matchRoutes, RouteConfig } from 'react-router-config';\nimport { createSelector } from 'reselect';\n\nimport NotFound from './NotFound';\nimport { Status } from './Status';\n\nimport {\n selectCurrentPath,\n selectCurrentProject,\n selectIsNotFound,\n selectMappedEntry,\n selectRouteEntry,\n selectRouteEntryContentTypeId,\n selectRouteErrorMessage,\n selectRouteIsError,\n selectRouteLoading,\n selectRouteStatusCode,\n} from '../redux/selectors';\nimport { setNavigationPath } from '../redux/actions';\n\nimport {\n selectUserGroups,\n selectUserIsAuthenticated,\n} from '~/user/redux/selectors';\nimport { matchUserGroup } from '~/user/util/matchGroups';\n\nimport { toJS } from '~/util/ToJs';\nimport { Entry } from 'contensis-delivery-api/lib/models';\nimport { AppRootProps, RouteComponentProps, RouteLoaderProps } from '../routes';\n\nconst replaceDoubleSlashRecursive = (path: string) => {\n const nextPath = path.replace(/\\/\\//, '/');\n\n if (nextPath.match(/\\/\\//)) {\n return replaceDoubleSlashRecursive(nextPath);\n }\n\n return nextPath;\n};\n\nconst getTrimmedPath = path => {\n if (path !== '/') {\n const nextPath = replaceDoubleSlashRecursive(path);\n const lastChar = nextPath[nextPath.length - 1];\n if (lastChar === '/') {\n return nextPath.substring(0, nextPath.length - 1);\n }\n }\n return path;\n};\n\ninterface IReduxProps {\n contentTypeId: string | null;\n entry: Entry | null;\n isError: boolean;\n isNotFound: boolean;\n isLoading: boolean;\n isLoggedIn: boolean;\n mappedEntry: any;\n projectId: string;\n setNavigationPath: typeof setNavigationPath;\n statePath: string;\n statusCode: any;\n statusText: string;\n userGroups: any;\n}\n\nconst RouteLoader = ({\n contentTypeId,\n entry,\n isError,\n isLoading,\n isLoggedIn,\n isNotFound,\n loadingComponent,\n mappedEntry,\n notFoundComponent,\n projectId,\n routes,\n setNavigationPath,\n statePath,\n statusCode,\n statusText,\n userGroups,\n withEvents,\n trailingSlashRedirectCode = 302,\n}: AppRootProps & RouteLoaderProps & IReduxProps) => {\n const location = useLocation();\n // Always ensure paths are trimmed of trailing slashes so urls are always unique\n const trimmedPath = getTrimmedPath(location.pathname);\n\n // Match any Static Routes a developer has defined\n const matchedStaticRoute = () =>\n matchRoutes(routes.StaticRoutes as RouteConfig[], location.pathname);\n const isStaticRoute = () => matchedStaticRoute().length > 0;\n\n const staticRoute = isStaticRoute() && matchedStaticRoute()[0];\n const routeRequiresLogin = staticRoute && staticRoute.route.requireLogin;\n\n const setPath = useCallback(() => {\n // Use serverPath to control the path we send to siteview node api to resolve a route\n let serverPath = '';\n if (staticRoute && staticRoute.match && staticRoute.match.isExact) {\n const { match, route } = staticRoute;\n\n if (route.path?.includes('*')) {\n // Send the whole url to api if we have matched route containing wildcard\n serverPath = match.url;\n } else if (typeof route.fetchNodeLevel === 'number') {\n // Send all url parts to a specified level to api\n serverPath = match.url\n .split('/')\n .splice(0, route.fetchNodeLevel + 1)\n .join('/');\n } else if (route.fetchNode?.params) {\n const fetchNodeParams: string[] = route.fetchNode.params;\n const routeParams: { [key: string]: string } = match.params;\n\n const regexExp = new RegExp(\n Object.keys(routeParams)\n .map(p => `:${p}`)\n .join('|'),\n 'g'\n );\n\n serverPath = match.path\n .replace(/\\?/g, '')\n .replace(regexExp, matched => {\n const param = matched.replace(':', '');\n if (fetchNodeParams.includes(param)) return routeParams[param];\n else return '';\n })\n .replace(/\\/$/, '');\n } else {\n // Send all non-parameterised url parts to api\n serverPath = (route.path as string)\n ?.split('/')\n .filter(p => !p.startsWith(':'))\n .join('/');\n }\n }\n\n setNavigationPath(\n serverPath || trimmedPath,\n location,\n staticRoute,\n withEvents,\n statePath,\n routes\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n setNavigationPath,\n // staticRoute,\n withEvents,\n location,\n routes,\n // statePath,\n trimmedPath,\n ]);\n\n if (typeof window == 'undefined') setPath();\n\n useEffect(() => {\n setPath();\n }, [location, setPath]);\n\n // Need to redirect when url endswith a /\n if (location.pathname.length > trimmedPath.length) {\n return (\n <Status code={trailingSlashRedirectCode}>\n <Redirect to={`${trimmedPath}${location.search}${location.hash}`} />\n </Status>\n );\n }\n\n // Render any Static Routes a developer has defined\n if (isStaticRoute() && !(!isLoggedIn && routeRequiresLogin)) {\n if (matchUserGroup(userGroups, routeRequiresLogin))\n return renderRoutes(\n routes.StaticRoutes as RouteConfig[],\n {\n projectId,\n contentTypeId,\n entry,\n mappedEntry,\n isLoggedIn,\n } as RouteComponentProps\n );\n }\n\n // Render a supplied Loading component if the route\n // is not a static route and is in a loading state\n if (isLoading && !isNotFound && loadingComponent) {\n const LoadingComponent = loadingComponent;\n return <LoadingComponent />;\n }\n\n // Match any defined Content Type Mappings\n if (contentTypeId && !(!isLoggedIn && routeRequiresLogin)) {\n const MatchedComponent = routes.ContentTypeMappings.find(\n item => item.contentTypeID === contentTypeId\n );\n\n if (MatchedComponent && !(MatchedComponent.requireLogin && !isLoggedIn)) {\n if (matchUserGroup(userGroups, MatchedComponent.requireLogin))\n return (\n <MatchedComponent.component\n projectId={projectId}\n contentTypeId={contentTypeId}\n entry={entry}\n mappedEntry={mappedEntry}\n isLoggedIn={isLoggedIn}\n />\n );\n }\n }\n\n const NotFoundComponent = notFoundComponent ? notFoundComponent : NotFound;\n if (isNotFound || isError) {\n return (\n <Status code={statusCode}>\n <NotFoundComponent statusCode={statusCode} statusText={statusText} />\n </Status>\n );\n }\n\n return null;\n};\nconst mapStateToPropsMemoized = createSelector(\n selectRouteEntryContentTypeId,\n selectRouteEntry,\n selectRouteIsError,\n selectIsNotFound,\n selectRouteLoading,\n selectUserIsAuthenticated,\n selectMappedEntry,\n selectCurrentProject,\n selectCurrentPath,\n selectRouteStatusCode,\n selectRouteErrorMessage,\n selectUserGroups,\n (\n contentTypeId,\n entry,\n isError,\n isNotFound,\n isLoading,\n isLoggedIn,\n mappedEntry,\n projectId,\n statePath,\n statusCode,\n statusText,\n userGroups\n ) => ({\n contentTypeId,\n entry,\n isError,\n isNotFound,\n isLoading,\n isLoggedIn,\n mappedEntry,\n projectId,\n statePath,\n statusCode,\n statusText,\n userGroups,\n })\n);\n\nconst mapDispatchToProps = {\n setNavigationPath,\n};\n\nexport default hot(module)(\n connect(mapStateToPropsMemoized, mapDispatchToProps)(toJS(RouteLoader))\n) as unknown as (props: AppRootProps & RouteLoaderProps) => JSX.Element;\n"],"names":["NotFound","statusCode","statusText","React","createElement","Fragment","style","background","color","fontSize","padding","Status","code","children","Route","render","staticContext","replaceDoubleSlashRecursive","path","nextPath","replace","match","getTrimmedPath","lastChar","length","substring","RouteLoader","contentTypeId","entry","isError","isLoading","isLoggedIn","isNotFound","loadingComponent","mappedEntry","notFoundComponent","projectId","routes","setNavigationPath","statePath","userGroups","withEvents","trailingSlashRedirectCode","location","useLocation","trimmedPath","pathname","matchedStaticRoute","matchRoutes","StaticRoutes","isStaticRoute","staticRoute","routeRequiresLogin","route","requireLogin","setPath","useCallback","serverPath","isExact","_route$path","_route$fetchNode","includes","url","fetchNodeLevel","split","splice","join","fetchNode","params","fetchNodeParams","routeParams","regexExp","RegExp","Object","keys","map","p","matched","param","_route$path2","filter","startsWith","window","useEffect","Redirect","to","search","hash","matchUserGroup","renderRoutes","LoadingComponent","MatchedComponent","ContentTypeMappings","find","item","contentTypeID","component","NotFoundComponent","mapStateToPropsMemoized","createSelector","selectRouteEntryContentTypeId","selectRouteEntry","selectRouteIsError","selectIsNotFound","selectRouteLoading","selectUserIsAuthenticated","selectMappedEntry","selectCurrentProject","selectCurrentPath","selectRouteStatusCode","selectRouteErrorMessage","selectUserGroups","mapDispatchToProps","hot","module","connect","toJS"],"mappings":";;;;;;;;;;;;;;;AAEA,MAAMA,QAAQ,GAAGA,CAAC;EAChBC,UAAU;AACVC,EAAAA,UAAAA;AAIF,CAAC,kBACCC,yBAAA,CAAAC,aAAA,CAAAD,yBAAA,CAAAE,QAAA,EACEF,IAAAA,eAAAA,yBAAA,CAAAC,aAAA,CACED,QAAAA,EAAAA,IAAAA,eAAAA,yBAAA,CAAAC,aAAA,C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CAAC,CAAA;AAED,oBAAe2E,kBAAG,CAACC,MAAM,CAAC,CACxBC,kBAAO,CAACjB,uBAAuB,EAAEc,kBAAkB,CAAC,CAACI,SAAI,CAAC1F,WAAW,CAAC,CAAC,CACxE;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var selectors$1 = require('./selectors-fa607198.js');
3
+ var selectors$1 = require('./selectors-c76c2676.js');
4
4
  var React = require('react');
5
5
 
6
6
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -11,12 +11,12 @@ const selectUserIsLoading = state => selectors$1.getImmutableOrJS(state, ['user'
11
11
  const selectUserIsAuthenticated = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'isAuthenticated']);
12
12
  const selectUserIsAuthenticationError = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'isAuthenticationError']);
13
13
  const selectUserIsError = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'isError']);
14
+
14
15
  /**
15
16
  * DEPRECATED 12/2021 - use selectUserErrorMessage instead
16
17
  * @param state AppState
17
18
  * @returns string
18
19
  */
19
-
20
20
  const selectUserAuthenticationErrorMessage = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'errorMessage']);
21
21
  const selectUserErrorMessage = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'errorMessage']);
22
22
  const selectClientCredentials = (state, returnType) => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'clientCredentials'], {}, returnType);
@@ -79,7 +79,6 @@ const matchUserGroup = (userGroups = [], requiredGroups = []) => {
79
79
  if (requiredGroup.id === userGroup.id) {
80
80
  return true;
81
81
  }
82
-
83
82
  if (requiredGroup.name === userGroup.name) {
84
83
  return true;
85
84
  }
@@ -126,4 +125,4 @@ exports.selectUserRegistrationIsLoading = selectUserRegistrationIsLoading;
126
125
  exports.selectUserRegistrationIsSuccess = selectUserRegistrationIsSuccess;
127
126
  exports.selectors = selectors;
128
127
  exports.toJS = toJS;
129
- //# sourceMappingURL=ToJs-d962c80f.js.map
128
+ //# sourceMappingURL=ToJs-61c03582.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToJs-d962c80f.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/util/ToJs.tsx"],"sourcesContent":["import { StateType } from '~/config';\nimport { AppState } from '~/redux/appstate';\nimport { getImmutableOrJS as getIn } from '~/redux/util';\n\nexport const selectUserIsLoading = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isLoading']);\n\nexport const selectUserIsAuthenticated = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticated']);\n\nexport const selectUserIsAuthenticationError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticationError']);\n\nexport const selectUserIsError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isError']);\n\n/**\n * DEPRECATED 12/2021 - use selectUserErrorMessage instead\n * @param state AppState\n * @returns string\n */\nexport const selectUserAuthenticationErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectUserErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectClientCredentials = (\n state: AppState,\n returnType?: StateType\n) =>\n getIn(\n state,\n ['user', 'authenticationState', 'clientCredentials'],\n {},\n returnType\n );\n\nexport const selectUser = (state: AppState, returnType?: StateType) =>\n getIn(state, 'user', {}, returnType);\n\nexport const selectUserIsZengentiStaff = (state: AppState) =>\n getIn(state, ['user', 'isZengentiStaff']);\n\nexport const selectUserGuid = (state: AppState) => getIn(state, ['user', 'id']);\n\nexport const selectUsername = (state: AppState) =>\n getIn(state, ['user', 'username']);\n\nexport const selectUserEmail = (state: AppState) =>\n getIn(state, ['user', 'email']);\n\nexport const selectUserGroups = (state: AppState, returnType?: StateType) =>\n getIn(state, ['user', 'groups'], [], returnType);\n\nexport const selectUserSecurityToken = (state: AppState) =>\n getIn(state, [\n 'user',\n 'authenticationState',\n 'clientCredentials',\n 'contensisClassicToken',\n ]);\n\nexport const selectUserRegistration = (\n state: AppState,\n returnType?: StateType\n) => getIn(state, ['user', 'registration'], {}, returnType);\n\nexport const selectUserRegistrationError = (state: AppState) =>\n getIn(state, ['user', 'registration', 'error'], false);\n\nexport const selectUserRegistrationIsLoading = (state: AppState) =>\n getIn(state, ['user', 'registration', 'isLoading'], false);\n\nexport const selectUserRegistrationIsSuccess = (state: AppState) =>\n getIn(state, ['user', 'registration', 'success'], false);\n\nexport const selectPasswordResetRequestSending = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'isSending']);\n\nexport const selectPasswordResetRequestSent = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'sent']);\n\nexport const selectPasswordResetRequestError = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'error']);\n\nexport const selectResetPasswordSending = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'isSending']);\n\nexport const selectResetPasswordSent = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'sent']);\n\nexport const selectResetPasswordError = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'error']);\n\nexport const selectChangePasswordSending = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'isSending']);\n\nexport const selectChangePasswordSent = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'sent']);\n\nexport const selectChangePasswordError = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'error']);\n","import { Group } from 'contensis-management-api/lib/models';\nimport { RequireLogin } from '~/routing/routes';\n\nexport const matchUserGroup = (\n userGroups: Group[] = [],\n requiredGroups: RequireLogin = []\n) => {\n if (\n !Array.isArray(requiredGroups) ||\n (Array.isArray(requiredGroups) && requiredGroups.length === 0)\n )\n return true;\n\n const groupMatch = requiredGroups.some(requiredGroup => {\n return userGroups.some(userGroup => {\n if (requiredGroup.id === userGroup.id) {\n return true;\n }\n if (requiredGroup.name === userGroup.name) {\n return true;\n }\n });\n });\n return groupMatch;\n};\n","/* eslint-disable react/display-name */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport React from 'react';\n\nexport const toJS =\n <Props extends { [key: string]: any }>(\n WrappedComponent: React.ComponentType<Props>\n ): React.ComponentType<Props> =>\n (wrappedComponentProps: Props) => {\n const KEY = 0;\n const VALUE = 1;\n\n const propsJS = Object.entries(wrappedComponentProps).reduce<Props>(\n (newProps: any, wrappedComponentProp) => {\n const propKey = wrappedComponentProp[KEY];\n const propValue = wrappedComponentProp[VALUE];\n newProps[propKey] =\n propValue && typeof propValue === 'object' && 'toJS' in propValue\n ? propValue.toJS()\n : propValue;\n return newProps as Props;\n },\n {} as Props\n );\n\n return <WrappedComponent {...propsJS} />;\n };\n"],"names":["selectUserIsLoading","state","getIn","selectUserIsAuthenticated","selectUserIsAuthenticationError","selectUserIsError","selectUserAuthenticationErrorMessage","selectUserErrorMessage","selectClientCredentials","returnType","selectUser","selectUserIsZengentiStaff","selectUserGuid","selectUsername","selectUserEmail","selectUserGroups","selectUserSecurityToken","selectUserRegistration","selectUserRegistrationError","selectUserRegistrationIsLoading","selectUserRegistrationIsSuccess","selectPasswordResetRequestSending","selectPasswordResetRequestSent","selectPasswordResetRequestError","selectResetPasswordSending","selectResetPasswordSent","selectResetPasswordError","selectChangePasswordSending","selectChangePasswordSent","selectChangePasswordError","matchUserGroup","userGroups","requiredGroups","Array","isArray","length","groupMatch","some","requiredGroup","userGroup","id","name","toJS","WrappedComponent","wrappedComponentProps","KEY","VALUE","propsJS","Object","entries","reduce","newProps","wrappedComponentProp","propKey","propValue","React"],"mappings":";;;;;;;;;MAIaA,mBAAmB,GAAIC,KAAD,IACjCC,4BAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,WAAhC,CAAR,EADA;MAGME,yBAAyB,GAAIF,KAAD,IACvCC,4BAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,iB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,IAArC,EAA2C;AACzC,QAAA,OAAO,IAAP,CAAA;AACD,OAAA;AACF,KAPM,CAAP,CAAA;AAQD,GATkB,CAAnB,CAAA;AAUA,EAAA,OAAOL,UAAP,CAAA;AACD;;ACxBD;MAIaM,IAAI,GAEbC,gBADF,IAGCC,qBAAD,IAAkC;AAChC,EAAMC,MAAAA,GAAG,GAAG,CAAZ,CAAA;AACA,EAAMC,MAAAA,KAAK,GAAG,CAAd,CAAA;AAEA,EAAA,MAAMC,OAAO,GAAGC,MAAM,CAACC,OAAP,CAAeL,qBAAf,CAAsCM,CAAAA,MAAtC,CACd,CAACC,QAAD,EAAgBC,oBAAhB,KAAyC;AACvC,IAAA,MAAMC,OAAO,GAAGD,oBAAoB,CAACP,GAAD,CAApC,CAAA;AACA,IAAA,MAAMS,SAAS,GAAGF,oBAAoB,CAACN,KAAD,CAAtC,CAAA;AACAK,IAAAA,QAAQ,CAACE,OAAD,CAAR,GACEC,SAAS,IAAI,OAAOA,SAAP,KAAqB,QAAlC,IAA8C,MAAA,IAAUA,SAAxD,GACIA,SAAS,CAACZ,IAAV,EADJ,GAEIY,SAHN,CAAA;AAIA,IAAA,OAAOH,QAAP,CAAA;AACD,GATa,EAUd,EAVc,CAAhB,CAAA;AAaA,EAAA,oBAAOI,yBAAC,CAAA,aAAA,CAAA,gBAAD,EAAsBR,OAAtB,CAAP,CAAA;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ToJs-61c03582.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/util/ToJs.tsx"],"sourcesContent":["import { StateType } from '~/config';\nimport { AppState } from '~/redux/appstate';\nimport { getImmutableOrJS as getIn } from '~/redux/util';\n\nexport const selectUserIsLoading = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isLoading']);\n\nexport const selectUserIsAuthenticated = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticated']);\n\nexport const selectUserIsAuthenticationError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticationError']);\n\nexport const selectUserIsError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isError']);\n\n/**\n * DEPRECATED 12/2021 - use selectUserErrorMessage instead\n * @param state AppState\n * @returns string\n */\nexport const selectUserAuthenticationErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectUserErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectClientCredentials = (\n state: AppState,\n returnType?: StateType\n) =>\n getIn(\n state,\n ['user', 'authenticationState', 'clientCredentials'],\n {},\n returnType\n );\n\nexport const selectUser = (state: AppState, returnType?: StateType) =>\n getIn(state, 'user', {}, returnType);\n\nexport const selectUserIsZengentiStaff = (state: AppState) =>\n getIn(state, ['user', 'isZengentiStaff']);\n\nexport const selectUserGuid = (state: AppState) => getIn(state, ['user', 'id']);\n\nexport const selectUsername = (state: AppState) =>\n getIn(state, ['user', 'username']);\n\nexport const selectUserEmail = (state: AppState) =>\n getIn(state, ['user', 'email']);\n\nexport const selectUserGroups = (state: AppState, returnType?: StateType) =>\n getIn(state, ['user', 'groups'], [], returnType);\n\nexport const selectUserSecurityToken = (state: AppState) =>\n getIn(state, [\n 'user',\n 'authenticationState',\n 'clientCredentials',\n 'contensisClassicToken',\n ]);\n\nexport const selectUserRegistration = (\n state: AppState,\n returnType?: StateType\n) => getIn(state, ['user', 'registration'], {}, returnType);\n\nexport const selectUserRegistrationError = (state: AppState) =>\n getIn(state, ['user', 'registration', 'error'], false);\n\nexport const selectUserRegistrationIsLoading = (state: AppState) =>\n getIn(state, ['user', 'registration', 'isLoading'], false);\n\nexport const selectUserRegistrationIsSuccess = (state: AppState) =>\n getIn(state, ['user', 'registration', 'success'], false);\n\nexport const selectPasswordResetRequestSending = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'isSending']);\n\nexport const selectPasswordResetRequestSent = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'sent']);\n\nexport const selectPasswordResetRequestError = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'error']);\n\nexport const selectResetPasswordSending = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'isSending']);\n\nexport const selectResetPasswordSent = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'sent']);\n\nexport const selectResetPasswordError = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'error']);\n\nexport const selectChangePasswordSending = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'isSending']);\n\nexport const selectChangePasswordSent = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'sent']);\n\nexport const selectChangePasswordError = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'error']);\n","import { Group } from 'contensis-management-api/lib/models';\nimport { RequireLogin } from '~/routing/routes';\n\nexport const matchUserGroup = (\n userGroups: Group[] = [],\n requiredGroups: RequireLogin = []\n) => {\n if (\n !Array.isArray(requiredGroups) ||\n (Array.isArray(requiredGroups) && requiredGroups.length === 0)\n )\n return true;\n\n const groupMatch = requiredGroups.some(requiredGroup => {\n return userGroups.some(userGroup => {\n if (requiredGroup.id === userGroup.id) {\n return true;\n }\n if (requiredGroup.name === userGroup.name) {\n return true;\n }\n });\n });\n return groupMatch;\n};\n","/* eslint-disable react/display-name */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport React from 'react';\n\nexport const toJS =\n <Props extends { [key: string]: any }>(\n WrappedComponent: React.ComponentType<Props>\n ): React.ComponentType<Props> =>\n (wrappedComponentProps: Props) => {\n const KEY = 0;\n const VALUE = 1;\n\n const propsJS = Object.entries(wrappedComponentProps).reduce<Props>(\n (newProps: any, wrappedComponentProp) => {\n const propKey = wrappedComponentProp[KEY];\n const propValue = wrappedComponentProp[VALUE];\n newProps[propKey] =\n propValue && typeof propValue === 'object' && 'toJS' in propValue\n ? propValue.toJS()\n : propValue;\n return newProps as Props;\n },\n {} as Props\n );\n\n return <WrappedComponent {...propsJS} />;\n };\n"],"names":["selectUserIsLoading","state","getIn","selectUserIsAuthenticated","selectUserIsAuthenticationError","selectUserIsError","selectUserAuthenticationErrorMessage","selectUserErrorMessage","selectClientCredentials","returnType","selectUser","selectUserIsZengentiStaff","selectUserGuid","selectUsername","selectUserEmail","selectUserGroups","selectUserSecurityToken","selectUserRegistration","selectUserRegistrationError","selectUserRegistrationIsLoading","selectUserRegistrationIsSuccess","selectPasswordResetRequestSending","selectPasswordResetRequestSent","selectPasswordResetRequestError","selectResetPasswordSending","selectResetPasswordSent","selectResetPasswordError","selectChangePasswordSending","selectChangePasswordSent","selectChangePasswordError","matchUserGroup","userGroups","requiredGroups","Array","isArray","length","groupMatch","some","requiredGroup","userGroup","id","name","toJS","WrappedComponent","wrappedComponentProps","KEY","VALUE","propsJS","Object","entries","reduce","newProps","wrappedComponentProp","propKey","propValue","React","createElement"],"mappings":";;;;;;;;;MAIaA,mBAAmB,GAAIC,KAAe,IACjDC,4BAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,WAAW,CAAC,EAAC;MAE/CE,yBAAyB,GAAIF,KAAe,IACvDC,4BAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAC;MAErDG,+BAA+B,GAAIH,KAAe,IAC7DC,4BAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,uBAAuB,CAAC,EAAC;MAE3DI,iBAAiB,GAAIJ,KAAe,IAC/CC,4BAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,SAAS,CAAC,EAAC;;AAE1D;AACA;AACA;AACA;AACA;AACO,MAAMK,oCAAoC,GAAIL,KAAe,IAClEC,4BAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,cAAc,CAAC,CAAC,CAAA;MAElDM,sBAAsB,GAAIN,KAAe,IACpDC,4BAAK,CAACD,KAAK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AAoB,CAACN,KAAK,CAAC,CAAA;IAC7CK,QAAQ,CAACE,OAAO,CAAC,GACfC,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,MAAM,IAAIA,SAAS,GAC7DA,SAAS,CAACZ,IAAI,EAAE,GAChBY,SAAS,CAAA;AACf,IAAA,OAAOH,QAAQ,CAAA;GAChB,EACD,EAAE,CACH,CAAA;AAED,EAAA,oBAAOI,yBAAA,CAAAC,aAAA,CAACb,gBAAgB,EAAKI,OAAO,CAAI,CAAA;AAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/cjs/client.js CHANGED
@@ -11,28 +11,28 @@ var reactRouterDom = require('react-router-dom');
11
11
  var component = require('@loadable/component');
12
12
  var queryString = require('query-string');
13
13
  var reactCookie = require('react-cookie');
14
- var version = require('./version-7ce96442.js');
15
- var version$1 = require('./version-d6e26cc4.js');
16
- var App = require('./App-48706fde.js');
17
- var selectors = require('./selectors-fa607198.js');
18
- var ContensisDeliveryApi = require('./ContensisDeliveryApi-cfdefe17.js');
14
+ var version = require('./version-38afaf2a.js');
15
+ var version$1 = require('./version-886f49d8.js');
16
+ var App = require('./App-2a7a16ad.js');
17
+ var selectors = require('./selectors-c76c2676.js');
18
+ var ContensisDeliveryApi = require('./ContensisDeliveryApi-de88df2a.js');
19
19
  require('redux');
20
20
  require('redux-thunk');
21
21
  require('redux-saga');
22
22
  require('redux-injectors');
23
23
  require('immer');
24
24
  require('deepmerge');
25
- require('./reducers-73a03ef4.js');
25
+ require('./reducers-9afb5f89.js');
26
26
  require('@redux-saga/core/effects');
27
27
  require('history');
28
28
  require('loglevel');
29
- require('./login-dfcea036.js');
30
- require('./ToJs-d962c80f.js');
29
+ require('./login-2ea569cc.js');
30
+ require('./ToJs-61c03582.js');
31
31
  require('jsonpath-mapper');
32
32
  require('await-to-js');
33
33
  require('js-cookie');
34
34
  require('contensis-delivery-api');
35
- require('./RouteLoader-fcd1e4f1.js');
35
+ require('./RouteLoader-47d70a26.js');
36
36
  require('react-router-config');
37
37
  require('reselect');
38
38
 
@@ -50,7 +50,6 @@ class ClientApp {
50
50
  withSagas,
51
51
  withEvents
52
52
  } = config;
53
-
54
53
  const GetClientJSX = store => {
55
54
  const ClientJsx = /*#__PURE__*/React__default["default"].createElement(reactHotLoader.AppContainer, null, /*#__PURE__*/React__default["default"].createElement(reactCookie.CookiesProvider, null, /*#__PURE__*/React__default["default"].createElement(reactRedux.Provider, {
56
55
  store: store
@@ -62,12 +61,11 @@ class ClientApp {
62
61
  })))));
63
62
  return ClientJsx;
64
63
  };
65
-
66
64
  const isProduction = !(process.env.NODE_ENV !== 'production');
65
+
67
66
  /**
68
67
  * Webpack HMR Setup.
69
68
  */
70
-
71
69
  const HMRRenderer = Component => {
72
70
  if (isProduction) component.loadableReady(() => {
73
71
  reactDom.hydrate(Component, documentRoot);
@@ -75,7 +73,6 @@ class ClientApp {
75
73
  namespace: 'modern'
76
74
  });else reactDom.render(Component, documentRoot);
77
75
  };
78
-
79
76
  const hmr = store => {
80
77
  // webpack Hot Module Replacement API
81
78
  if (module.hot) {
@@ -85,20 +82,17 @@ class ClientApp {
85
82
  });
86
83
  }
87
84
  };
88
-
89
85
  const qs = queryString.parse(window.location.search);
90
86
  const versionStatus = ContensisDeliveryApi.deliveryApi.getClientSideVersionStatus();
91
-
92
87
  if (window.isDynamic || window.REDUX_DATA || process.env.NODE_ENV !== 'production') {
93
88
  version.createStore(withReducers, window.REDUX_DATA, App.browserHistory, stateType).then(store => {
94
89
  const state = store.getState();
95
90
  const ssrVersionStatus = version.selectVersionStatus(state);
96
91
  if (!ssrVersionStatus) store.dispatch(version$1.setVersionStatus(versionStatus));
97
- /* eslint-disable no-console */
98
92
 
93
+ /* eslint-disable no-console */
99
94
  console.log('Hydrating from inline Redux');
100
95
  /* eslint-enable no-console */
101
-
102
96
  store.runSaga(App.rootSaga(withSagas));
103
97
  store.dispatch(selectors.setCurrentProject(App.pickProject(window.location.hostname, qs), [], window.location.hostname));
104
98
  delete window.REDUX_DATA;
@@ -118,7 +112,6 @@ class ClientApp {
118
112
  });
119
113
  }
120
114
  }
121
-
122
115
  }
123
116
 
124
117
  exports.ReactApp = App.AppRoot;
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 { render, hydrate } from 'react-dom';\nimport { AppContainer } from 'react-hot-loader';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { Router } from 'react-router-dom';\nimport { loadableReady } from '@loadable/component';\nimport { parse } from 'query-string';\nimport { CookiesProvider } from 'react-cookie';\n\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';\n\nimport { AppConfig } from '~/config';\n\ndeclare let window: typeof globalThis & {\n isDynamic;\n REDUX_DATA;\n};\n\ntype ReactAppProps = { routes: any; withEvents: any };\n\nclass ClientApp {\n constructor(ReactApp: React.ComponentType<ReactAppProps>, config: AppConfig) {\n const documentRoot = document.getElementById('root');\n\n const {\n stateType = 'immutable',\n routes,\n withReducers,\n withSagas,\n withEvents,\n } = config;\n\n const GetClientJSX = store => {\n const ClientJsx = (\n <AppContainer>\n <CookiesProvider>\n <ReduxProvider store={store}>\n <Router history={history}>\n <ReactApp routes={routes} withEvents={withEvents} />\n </Router>\n </ReduxProvider>\n </CookiesProvider>\n </AppContainer>\n );\n return ClientJsx;\n };\n\n const isProduction = !(process.env.NODE_ENV !== 'production');\n\n /**\n * Webpack HMR Setup.\n */\n const HMRRenderer = Component => {\n if (isProduction)\n loadableReady(\n () => {\n hydrate(Component, documentRoot);\n },\n { namespace: 'modern' }\n );\n else render(Component, documentRoot);\n };\n\n const hmr = store => {\n // webpack Hot Module Replacement API\n if (module.hot) {\n module.hot.accept(ReactApp as unknown as string, () => {\n // if you are using harmony modules ({modules:false})\n HMRRenderer(GetClientJSX(store));\n });\n }\n };\n\n const qs = parse(window.location.search);\n const versionStatus = deliveryApi.getClientSideVersionStatus();\n\n if (\n window.isDynamic ||\n window.REDUX_DATA ||\n process.env.NODE_ENV !== 'production'\n ) {\n createStore(withReducers, window.REDUX_DATA, history, stateType).then(\n store => {\n const state = store.getState();\n const ssrVersionStatus = selectVersionStatus(state);\n if (!ssrVersionStatus)\n store.dispatch(setVersionStatus(versionStatus));\n\n /* eslint-disable no-console */\n console.log('Hydrating from inline Redux');\n /* eslint-enable no-console */\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n\n delete window.REDUX_DATA;\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n }\n );\n } else {\n fetch(`${window.location.pathname}?redux=true`)\n .then(response => response.json())\n .then(data => {\n 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","stateType","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","React","AppContainer","CookiesProvider","ReduxProvider","Router","history","isProduction","process","env","NODE_ENV","HMRRenderer","Component","loadableReady","hydrate","namespace","render","hmr","module","hot","accept","qs","parse","window","location","search","versionStatus","deliveryApi","getClientSideVersionStatus","isDynamic","REDUX_DATA","createStore","then","state","getState","ssrVersionStatus","selectVersionStatus","dispatch","setVersionStatus","console","log","runSaga","root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AA;AAEAkB,UAAAA,GAAG,CAAClB,KAAD,CAAH,CAAA;AACD,SAfD,CAAA,CAAA;AAgBD,OApBH,CAAA,CAAA;AAqBD,KAAA;AACF,GAAA;;AA7Ga;;;;;"}
1
+ {"version":3,"file":"client.js","sources":["../src/client/client.tsx"],"sourcesContent":["import 'isomorphic-fetch';\nimport React from 'react';\nimport { render, hydrate } from 'react-dom';\nimport { AppContainer } from 'react-hot-loader';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { Router } from 'react-router-dom';\nimport { loadableReady } from '@loadable/component';\nimport { parse } from 'query-string';\nimport { CookiesProvider } from 'react-cookie';\n\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';\n\nimport { AppConfig } from '~/config';\n\ndeclare let window: typeof globalThis & {\n isDynamic;\n REDUX_DATA;\n};\n\ntype ReactAppProps = { routes: any; withEvents: any };\n\nclass ClientApp {\n constructor(ReactApp: React.ComponentType<ReactAppProps>, config: AppConfig) {\n const documentRoot = document.getElementById('root');\n\n const {\n stateType = 'immutable',\n routes,\n withReducers,\n withSagas,\n withEvents,\n } = config;\n\n const GetClientJSX = store => {\n const ClientJsx = (\n <AppContainer>\n <CookiesProvider>\n <ReduxProvider store={store}>\n <Router history={history}>\n <ReactApp routes={routes} withEvents={withEvents} />\n </Router>\n </ReduxProvider>\n </CookiesProvider>\n </AppContainer>\n );\n return ClientJsx;\n };\n\n const isProduction = !(process.env.NODE_ENV !== 'production');\n\n /**\n * Webpack HMR Setup.\n */\n const HMRRenderer = Component => {\n if (isProduction)\n loadableReady(\n () => {\n hydrate(Component, documentRoot);\n },\n { namespace: 'modern' }\n );\n else render(Component, documentRoot);\n };\n\n const hmr = store => {\n // webpack Hot Module Replacement API\n if (module.hot) {\n module.hot.accept(ReactApp as unknown as string, () => {\n // if you are using harmony modules ({modules:false})\n HMRRenderer(GetClientJSX(store));\n });\n }\n };\n\n const qs = parse(window.location.search);\n const versionStatus = deliveryApi.getClientSideVersionStatus();\n\n if (\n window.isDynamic ||\n window.REDUX_DATA ||\n process.env.NODE_ENV !== 'production'\n ) {\n createStore(withReducers, window.REDUX_DATA, history, stateType).then(\n store => {\n const state = store.getState();\n const ssrVersionStatus = selectVersionStatus(state);\n if (!ssrVersionStatus)\n store.dispatch(setVersionStatus(versionStatus));\n\n /* eslint-disable no-console */\n console.log('Hydrating from inline Redux');\n /* eslint-enable no-console */\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n\n delete window.REDUX_DATA;\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n }\n );\n } else {\n fetch(`${window.location.pathname}?redux=true`)\n .then(response => response.json())\n .then(data => {\n 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","stateType","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","React","createElement","AppContainer","CookiesProvider","ReduxProvider","Router","history","isProduction","process","env","NODE_ENV","HMRRenderer","Component","loadableReady","hydrate","namespace","render","hmr","module","hot","accept","qs","parse","window","location","search","versionStatus","deliveryApi","getClientSideVersionStatus","isDynamic","REDUX_DATA","createStore","then","state","getState","ssrVersionStatus","selectVersionStatus","dispatch","setVersionStatus","console","log","runSaga","rootSaga","setCurr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