@zengenti/contensis-react-base 3.2.2-beta.6 → 3.2.2-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/{App-b96f8a00.js → App-D2_FqsUD.js} +30 -30
- package/{esm/App-71b8475e.js.map → cjs/App-D2_FqsUD.js.map} +1 -1
- package/cjs/{ChangePassword.container-fe39e44a.js → ChangePassword.container-DrO8p-7S.js} +17 -34
- package/cjs/{ChangePassword.container-fe39e44a.js.map → ChangePassword.container-DrO8p-7S.js.map} +1 -1
- package/cjs/{CookieHelper.class-e0908573.js → CookieHelper.class-CNL3lC5D.js} +1 -6
- package/cjs/{CookieHelper.class-e0908573.js.map → CookieHelper.class-CNL3lC5D.js.map} +1 -1
- package/cjs/{RouteLoader-4ac8153a.js → RouteLoader-BrUuhdcK.js} +14 -14
- package/cjs/{RouteLoader-4ac8153a.js.map → RouteLoader-BrUuhdcK.js.map} +1 -1
- package/cjs/{SSRContext-79344de2.js → SSRContext-CmXDzwPL.js} +8 -14
- package/cjs/{SSRContext-79344de2.js.map → SSRContext-CmXDzwPL.js.map} +1 -1
- package/cjs/{ToJs-8fd54c8e.js → ToJs-C9jwV7YB.js} +25 -24
- package/cjs/{ToJs-8fd54c8e.js.map → ToJs-C9jwV7YB.js.map} +1 -1
- package/cjs/{_commonjsHelpers-b3309d7b.js → _commonjsHelpers-BJu3ubxk.js} +1 -1
- package/cjs/_commonjsHelpers-BJu3ubxk.js.map +1 -0
- package/cjs/client.js +16 -16
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +177 -184
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +2478 -2482
- package/cjs/forms.js.map +1 -1
- package/cjs/{fromJSLeaveImmer-7c363211.js → fromJSLeaveImmer-Drk6JyYs.js} +2 -2
- package/{esm/fromJSLeaveImmer-e2dacd63.js.map → cjs/fromJSLeaveImmer-Drk6JyYs.js.map} +1 -1
- package/cjs/redux.js +5 -7
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +6 -8
- package/cjs/routing.js.map +1 -1
- package/cjs/{sagas-497c6e94.js → sagas-DFdRjqSX.js} +54 -56
- package/cjs/{sagas-497c6e94.js.map → sagas-DFdRjqSX.js.map} +1 -1
- package/cjs/search.js +24 -23
- package/cjs/search.js.map +1 -1
- package/cjs/{selectors-d5cd6b19.js → selectors-wCs5fHD4.js} +43 -43
- package/cjs/{selectors-d5cd6b19.js.map → selectors-wCs5fHD4.js.map} +1 -1
- package/cjs/{store-0ef9b570.js → store-D8dJBaFw.js} +16 -34
- package/cjs/{store-0ef9b570.js.map → store-D8dJBaFw.js.map} +1 -1
- package/cjs/{urls-6fcaf4c6.js → urls-DVIwGZmd.js} +1 -1
- package/cjs/{urls-6fcaf4c6.js.map → urls-DVIwGZmd.js.map} +1 -1
- package/cjs/user.js +7 -9
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +46 -46
- package/cjs/util.js.map +1 -1
- package/cjs/{version-0cb648de.js → version-CM-bJ62L.js} +3 -3
- package/cjs/{version-0cb648de.js.map → version-CM-bJ62L.js.map} +1 -1
- package/cjs/{version-8072b62e.js → version-DSW6Roy9.js} +5 -5
- package/cjs/{version-8072b62e.js.map → version-DSW6Roy9.js.map} +1 -1
- package/esm/{App-71b8475e.js → App-BE7fh-wb.js} +24 -24
- package/{cjs/App-b96f8a00.js.map → esm/App-BE7fh-wb.js.map} +1 -1
- package/esm/{ChangePassword.container-572653e2.js → ChangePassword.container-6fQXhkzW.js} +14 -13
- package/esm/{ChangePassword.container-572653e2.js.map → ChangePassword.container-6fQXhkzW.js.map} +1 -1
- package/esm/{CookieHelper.class-67f65459.js → CookieHelper.class-DqJ_o1jL.js} +2 -7
- package/esm/{CookieHelper.class-67f65459.js.map → CookieHelper.class-DqJ_o1jL.js.map} +1 -1
- package/esm/{RouteLoader-11833209.js → RouteLoader-BNKfOnU8.js} +5 -5
- package/esm/{RouteLoader-11833209.js.map → RouteLoader-BNKfOnU8.js.map} +1 -1
- package/esm/{SSRContext-0177db9c.js → SSRContext-BoisoiyV.js} +5 -11
- package/esm/{SSRContext-0177db9c.js.map → SSRContext-BoisoiyV.js.map} +1 -1
- package/esm/{ToJs-0ed7c7db.js → ToJs-B4MH53fx.js} +23 -22
- package/esm/{ToJs-0ed7c7db.js.map → ToJs-B4MH53fx.js.map} +1 -1
- package/esm/{_commonjsHelpers-1789f0cf.js → _commonjsHelpers-BFTU3MAI.js} +1 -1
- package/esm/_commonjsHelpers-BFTU3MAI.js.map +1 -0
- package/esm/client.js +11 -11
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +135 -142
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +2224 -2226
- package/esm/forms.js.map +1 -1
- package/esm/{fromJSLeaveImmer-e2dacd63.js → fromJSLeaveImmer-DfnbPBKC.js} +1 -1
- package/{cjs/fromJSLeaveImmer-7c363211.js.map → esm/fromJSLeaveImmer-DfnbPBKC.js.map} +1 -1
- package/esm/redux.js +8 -8
- package/esm/routing.js +6 -6
- package/esm/{sagas-b654d1a6.js → sagas-waBQR0Ek.js} +43 -45
- package/esm/{sagas-b654d1a6.js.map → sagas-waBQR0Ek.js.map} +1 -1
- package/esm/search.js +14 -11
- package/esm/search.js.map +1 -1
- package/esm/{selectors-bb117d1b.js → selectors-BRzliwbK.js} +41 -41
- package/esm/{selectors-bb117d1b.js.map → selectors-BRzliwbK.js.map} +1 -1
- package/esm/{store-2ff73952.js → store-Cr0lmZNr.js} +12 -12
- package/esm/{store-2ff73952.js.map → store-Cr0lmZNr.js.map} +1 -1
- package/esm/{urls-eac9a747.js → urls-DfCisos-.js} +1 -1
- package/esm/{urls-eac9a747.js.map → urls-DfCisos-.js.map} +1 -1
- package/esm/user.js +6 -6
- package/esm/user.js.map +1 -1
- package/esm/util.js +10 -8
- package/esm/util.js.map +1 -1
- package/esm/{version-df7f7154.js → version-78jjDnHU.js} +3 -3
- package/esm/{version-df7f7154.js.map → version-78jjDnHU.js.map} +1 -1
- package/esm/{version-49ad9e9d.js → version-CB7rIyoF.js} +6 -6
- package/esm/{version-49ad9e9d.js.map → version-CB7rIyoF.js.map} +1 -1
- package/package.json +21 -32
- package/cjs/_commonjsHelpers-b3309d7b.js.map +0 -1
- package/esm/_commonjsHelpers-1789f0cf.js.map +0 -1
|
@@ -3,9 +3,9 @@ import { useCookies } from 'react-cookie';
|
|
|
3
3
|
import { useDispatch } from 'react-redux';
|
|
4
4
|
import { Client } from 'contensis-delivery-api';
|
|
5
5
|
import { parse } from 'query-string';
|
|
6
|
-
import {
|
|
7
|
-
import { r as reduxStore } from './store-
|
|
8
|
-
import { f as findLoginCookies,
|
|
6
|
+
import { q as setSurrogateKeys } from './selectors-BRzliwbK.js';
|
|
7
|
+
import { r as reduxStore } from './store-Cr0lmZNr.js';
|
|
8
|
+
import { f as findLoginCookies, C as CookieHelper } from './CookieHelper.class-DqJ_o1jL.js';
|
|
9
9
|
|
|
10
10
|
class CacheNode {
|
|
11
11
|
constructor(key, value) {
|
|
@@ -83,8 +83,6 @@ class CachedSearch {
|
|
|
83
83
|
constructor(ssr) {
|
|
84
84
|
var _this$ssr;
|
|
85
85
|
this.cache = new LruCache();
|
|
86
|
-
this.cookies = void 0;
|
|
87
|
-
this.ssr = void 0;
|
|
88
86
|
this.ssr = ssr;
|
|
89
87
|
this.cookies = (_this$ssr = this.ssr) === null || _this$ssr === void 0 ? void 0 : _this$ssr.cookies.raw;
|
|
90
88
|
}
|
|
@@ -190,7 +188,7 @@ const storeSurrogateKeys = ssr => response => {
|
|
|
190
188
|
// concurrent loads and exists here as a best effort fallback
|
|
191
189
|
// in case the SSRContext is not provided
|
|
192
190
|
const put = (ssr === null || ssr === void 0 ? void 0 : ssr.dispatch) || (reduxStore === null || reduxStore === void 0 ? void 0 : reduxStore.dispatch);
|
|
193
|
-
put === null || put === void 0
|
|
191
|
+
put === null || put === void 0 || put(setSurrogateKeys(keys, response.url, response.status));
|
|
194
192
|
};
|
|
195
193
|
|
|
196
194
|
/**
|
|
@@ -208,14 +206,12 @@ const deliveryApiConfig = ssr => {
|
|
|
208
206
|
// request surrogate-key response header
|
|
209
207
|
'x-crb-ssr': 'true' // add this for support tracing
|
|
210
208
|
};
|
|
211
|
-
|
|
212
209
|
if (ssr) config.defaultHeaders.referer = getSsrReferer(ssr); // add this for support tracing
|
|
213
210
|
|
|
214
211
|
config.responseHandler = {
|
|
215
212
|
[200]: storeSurrogateKeys(ssr)
|
|
216
213
|
}; // for handling page cache invalidation
|
|
217
214
|
}
|
|
218
|
-
|
|
219
215
|
if (typeof window !== 'undefined' && PROXY_DELIVERY_API /* global PROXY_DELIVERY_API */) {
|
|
220
216
|
// ensure a relative url is used to bypass the need for CORS (separate OPTIONS calls)
|
|
221
217
|
config.rootUrl = '';
|
|
@@ -245,8 +241,6 @@ const getClientConfig = (project, ssr) => {
|
|
|
245
241
|
|
|
246
242
|
class DeliveryApi {
|
|
247
243
|
constructor(ssr) {
|
|
248
|
-
this.cookies = void 0;
|
|
249
|
-
this.ssr = void 0;
|
|
250
244
|
this.getClientSideVersionStatus = () => {
|
|
251
245
|
if (typeof window !== 'undefined') {
|
|
252
246
|
// Allow overriding versionStatus with the querystring
|
|
@@ -355,4 +349,4 @@ const useDeliveryApi = () => {
|
|
|
355
349
|
};
|
|
356
350
|
|
|
357
351
|
export { SSRContextProvider as S, cachedSearchWithCookies as a, deliveryApiWithCookies as b, cachedSearch as c, deliveryApi as d, useDeliveryApi as e, getClientConfig as g, useSSRContext as u };
|
|
358
|
-
//# sourceMappingURL=SSRContext-
|
|
352
|
+
//# sourceMappingURL=SSRContext-BoisoiyV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SSRContext-0177db9c.js","sources":["../src/util/LruCache.js","../src/util/CachedDeliveryApi.ts","../src/util/ContensisDeliveryApi.ts","../src/util/SSRContext.tsx"],"sourcesContent":["class CacheNode {\n constructor(key, value) {\n this.key = key;\n this.value = value;\n this.next = null;\n this.prev = null;\n }\n}\n\nexport class 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","import { VersionStatus } from 'contensis-core-api';\nimport { Client, Query } from 'contensis-delivery-api';\nimport {\n INodeOperations,\n NodeGetRootOptions,\n} from 'contensis-delivery-api/lib/models';\n\nimport {\n DeliveryApi,\n SSRContext,\n getClientConfig,\n} from './ContensisDeliveryApi';\nimport { LruCache } from './LruCache';\nimport { CookieObject } from '~/user/util/CookieConstants';\n\n// CachedSearch does not cache results in SSR by design\nclass CachedSearch {\n cache = new LruCache();\n cookies?: CookieObject;\n ssr?: SSRContext;\n\n constructor(ssr?: SSRContext) {\n this.ssr = ssr;\n this.cookies = this.ssr?.cookies.raw;\n }\n\n getClient(...args: Parameters<DeliveryApi['getClient']>) {\n return new DeliveryApi(this.ssr).getClient(...args);\n }\n\n search(query: Query, linkDepth = 0, project?: string) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project}+${JSON.stringify(query)}+${linkDepth}`,\n () => client.entries.search(query, linkDepth)\n );\n }\n\n searchUsingPost(query: Query, linkDepth = 0, project = '') {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project}+${JSON.stringify(query)}+${linkDepth}`,\n () => (client.entries as any).searchUsingPost(query, linkDepth)\n );\n }\n\n get(\n id: string,\n linkDepth = 0,\n versionStatus: VersionStatus = 'published',\n project?: string,\n fields?: string[]\n ) {\n const client = Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n return this.request(id, () =>\n client.entries.get({ id, linkDepth, fields })\n );\n }\n\n getContentType(id: string, project?: string) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(`[CONTENT TYPE] ${id} ${project}`, () =>\n client.contentTypes.get(id)\n );\n }\n\n getRootNode(\n options: NodeGetRootOptions,\n versionStatus: VersionStatus = 'published',\n project?: string\n ) {\n const client = Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n return this.request(`${project} / ${JSON.stringify(options)}`, () =>\n client.nodes.getRoot(options)\n );\n }\n\n getNode(options: Parameters<INodeOperations['get']>[0], project?: string) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} ${\n options && typeof options !== 'string'\n ? 'path' in options\n ? options.path\n : options.id\n : options\n } ${JSON.stringify(options)}`,\n () => client.nodes.get(options)\n );\n }\n\n getAncestors(\n options: Parameters<INodeOperations['getAncestors']>[0],\n project?: string\n ) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} [A] ${\n (options && typeof options !== 'string' && options.id) || options\n } ${JSON.stringify(options)}`,\n () => client.nodes.getAncestors(options)\n );\n }\n\n getChildren(\n options: Parameters<INodeOperations['getChildren']>[0],\n project?: string\n ) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} [C] ${\n (options && typeof options !== 'string' && options.id) || options\n } ${JSON.stringify(options)}`,\n () => client.nodes.getChildren(options)\n );\n }\n\n getSiblings(\n options: Parameters<INodeOperations['getSiblings']>[0],\n project?: string\n ) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} [S] ${\n (options && typeof options !== 'string' && options.id) || options\n } ${JSON.stringify(options)}`,\n () => client.nodes.getSiblings(options)\n );\n }\n\n request<T extends () => Promise<any>>(key: string, execute: T) {\n // do not cache results in SSR\n if (!this.cache.get(key) || typeof window == 'undefined') {\n const promise = execute();\n this.cache.set(key, promise);\n promise.catch(() => {\n this.cache.remove(key);\n });\n }\n return this.cache.get(key) as ReturnType<T>;\n }\n}\n\nexport const cachedSearch = new CachedSearch();\nexport const cachedSearchWithCookies = (ssr?: SSRContext) =>\n new CachedSearch(ssr);\n","import { VersionStatus } from 'contensis-core-api';\nimport { Client, Query } from 'contensis-delivery-api';\nimport { Config } from 'contensis-delivery-api/lib/models';\nimport { parse } from 'query-string';\nimport { setSurrogateKeys } from '~/routing/redux/actions';\nimport { reduxStore } from '~/redux/store/store';\n\nimport { CookieObject, findLoginCookies } from '~/user/util/CookieConstants';\nimport { Request } from 'express';\nimport { IncomingHttpHeaders } from 'http';\nimport { SSRContext as SSRContextType } from '~/models';\n\nexport type SSRContext = Omit<SSRContextType, 'api'>;\n\nconst mapCookieHeader = (cookies: CookieObject | string) =>\n typeof cookies === 'object'\n ? Object.entries(cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join('; ')\n : cookies;\n\nconst getSsrReferer = ({ request }: SSRContext) => {\n if (request) {\n try {\n const url = new URL(\n request.url,\n `${request.protocol || `http`}://${request.headers.host}`\n );\n return url.href;\n } catch (ex) {\n console.error(\n `getSsrReferer cannot parse url ${request.url} and host ${request.headers.host}`\n );\n\n return request.url;\n }\n }\n\n // if (typeof window === 'undefined') {\n // const state = reduxStore.getState();\n // const referer = `${selectCurrentHostname(state)}${selectCurrentPath(\n // state\n // )}${selectCurrentSearch(state)}`;\n\n // return referer;\n // }\n return '';\n};\n\n/**\n * Store the surrogate-key header contents in redux state to output in SSR response\n */\nconst storeSurrogateKeys = (ssr?: SSRContext) => (response: any) => {\n let keys = '';\n if (response.status === 200) {\n keys = response.headers.get\n ? response.headers.get('surrogate-key')\n : response.headers.map['surrogate-key'];\n if (!keys) console.info(`[storeSurrogateKeys] No keys in ${response.url}`);\n }\n // Using imported reduxStore in SSR is unreliable during high\n // concurrent loads and exists here as a best effort fallback\n // in case the SSRContext is not provided\n const put = ssr?.dispatch || reduxStore?.dispatch;\n put?.(setSurrogateKeys(keys, response.url, response.status));\n};\n\n/**\n * Create a new Config object to create a DeliveryAPI Client\n */\nconst deliveryApiConfig = (ssr?: SSRContext) => {\n const config: Config = {\n ...DELIVERY_API_CONFIG /* global DELIVERY_API_CONFIG */,\n };\n\n // Add SSR headers and handlers\n if (typeof window === 'undefined') {\n config.defaultHeaders = {\n 'x-require-surrogate-key': 'true', // request surrogate-key response header\n 'x-crb-ssr': 'true', // add this for support tracing\n };\n if (ssr) config.defaultHeaders.referer = getSsrReferer(ssr); // add this for support tracing\n\n config.responseHandler = { [200]: storeSurrogateKeys(ssr) }; // for handling page cache invalidation\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 const getClientConfig = (project?: string, ssr?: SSRContext) => {\n const config = deliveryApiConfig(ssr);\n\n if (project) {\n config.projectId = project;\n }\n\n if (ssr?.cookies) {\n const cookieHeader = mapCookieHeader(findLoginCookies(ssr.cookies));\n if (cookieHeader) {\n config.defaultHeaders = Object.assign(config.defaultHeaders || {}, {\n Cookie: cookieHeader,\n });\n }\n }\n\n return config;\n};\n\n// export * from 'contensis-delivery-api';\n\ndeclare let window: Window &\n typeof globalThis & {\n versionStatus?: VersionStatus;\n };\n\nexport class DeliveryApi {\n cookies?: CookieObject;\n ssr?: SSRContext;\n\n constructor(ssr?: SSRContext) {\n this.ssr = ssr;\n this.cookies = ssr?.cookies.raw;\n }\n\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\n getServerSideVersionStatus = (request: Request) =>\n request.query.versionStatus ||\n deliveryApi.getVersionStatusFromHeaders(request.headers) ||\n deliveryApi.getVersionStatusFromHostname(request.hostname);\n\n getVersionStatusFromHeaders = (headers: IncomingHttpHeaders) => {\n const versionStatusHeader = headers['x-entry-versionstatus'];\n if (typeof versionStatusHeader !== 'undefined') return versionStatusHeader;\n return null;\n };\n\n getVersionStatusFromHostname = (currentHostname: string) => {\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\n search = (query: Query, linkDepth = 0, project?: string) => {\n const client = Client.create(getClientConfig(project, this.ssr));\n return client.entries.search(\n query,\n typeof linkDepth !== 'undefined' ? linkDepth : 1\n );\n };\n\n getClient = (versionStatus: VersionStatus = 'published', project?: string) =>\n Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n\n getEntry = (\n id: string,\n linkDepth = 0,\n versionStatus: VersionStatus = 'published',\n project?: string\n ) => {\n const client = Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n return client.entries.get({ id, linkDepth });\n };\n}\n\nexport const deliveryApi = new DeliveryApi();\n\nexport const deliveryApiWithCookies = (ssr?: SSRContext) =>\n new DeliveryApi(ssr);\n\nexport * from './CachedDeliveryApi';\n","import { Request, Response } from 'express';\nimport React, {\n PropsWithChildren,\n createContext,\n useContext,\n useState,\n} from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useDispatch } from 'react-redux';\nimport { SSRContext as SSRContextType } from '~/models';\nimport { cachedSearchWithCookies } from '~/util/CachedDeliveryApi';\nimport { CookieHelper } from '~/user/util/CookieHelper.class';\n\nconst SSRContext = createContext<SSRContextType | null>(null);\n\n/** SSRContextProvider allows us to hold and access request-scoped references\n * throughout the component tree\n *\n * adding this in client side allows consumers to write universal code and use\n * the same helpers and refs as in SSR */\nexport const SSRContextProvider = ({\n children,\n request,\n response,\n}: PropsWithChildren<{ request?: Request; response?: Response }>) => {\n // In SSR pass references to things in backing sagas\n // we cannot access in a global scope\n const dispatch = useDispatch();\n const cookies = new CookieHelper(...useCookies());\n const api = cachedSearchWithCookies({ cookies, dispatch, request, response });\n\n const [context] = useState<SSRContextType>({\n api,\n cookies,\n dispatch,\n request,\n response,\n });\n\n return (\n <SSRContext.Provider value={{ ...context }}>{children}</SSRContext.Provider>\n );\n};\n\nexport const useSSRContext = () => useContext(SSRContext) as SSRContextType;\n\nexport const useDeliveryApi = () => {\n const { api } = useSSRContext();\n return api;\n};\n"],"names":["CacheNode","constructor","key","value","next","prev","LruCache","limit","map","head","tail","size","get","node","remove","setHead","set","CachedSearch","ssr","_this$ssr","cache","cookies","raw","getClient","args","DeliveryApi","search","query","linkDepth","project","client","Client","create","getClientConfig","request","JSON","stringify","entries","searchUsingPost","id","versionStatus","fields","getContentType","contentTypes","getRootNode","options","nodes","getRoot","getNode","path","getAncestors","getChildren","getSiblings","execute","window","promise","catch","cachedSearch","cachedSearchWithCookies","mapCookieHeader","Object","name","join","getSsrReferer","url","URL","protocol","headers","host","href","ex","console","error","storeSurrogateKeys","response","keys","status","info","put","dispatch","reduxStore","setSurrogateKeys","deliveryApiConfig","config","DELIVERY_API_CONFIG","defaultHeaders","referer","responseHandler","PROXY_DELIVERY_API","rootUrl","projectId","cookieHeader","findLoginCookies","assign","Cookie","getClientSideVersionStatus","parse","location","currentHostname","hostname","getVersionStatusFromHostname","getServerSideVersionStatus","deliveryApi","getVersionStatusFromHeaders","versionStatusHeader","indexOf","endsWith","getEntry","deliveryApiWithCookies","SSRContext","createContext","SSRContextProvider","children","useDispatch","CookieHelper","useCookies","api","context","useState","React","createElement","Provider","useSSRContext","useContext","useDeliveryApi"],"mappings":";;;;;;;;;AAAA,MAAMA,SAAS,CAAC;AACdC,EAAAA,WAAWA,CAACC,GAAG,EAAEC,KAAK,EAAE;IACtB,IAAI,CAACD,GAAG,GAAGA,GAAG,CAAA;IACd,IAAI,CAACC,KAAK,GAAGA,KAAK,CAAA;IAClB,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;IAChB,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;AAClB,GAAA;AACF,CAAA;AAEO,MAAMC,QAAQ,CAAC;AACpBL,EAAAA,WAAWA,CAACM,KAAK,GAAG,GAAG,EAAE;AACvB,IAAA,IAAI,CAACC,GAAG,GAAG,EAAE,CAAA;IACb,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;IAChB,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;AAChB,IAAA,IAAI,CAACH,KAAK,GAAGA,KAAK,IAAI,GAAG,CAAA;IACzB,IAAI,CAACI,IAAI,GAAG,CAAC,CAAA;AACf,GAAA;EAEAC,GAAGA,CAACV,GAAG,EAAE;AACP,IAAA,IAAI,IAAI,CAACM,GAAG,CAACN,GAAG,CAAC,EAAE;MACjB,IAAIC,KAAK,GAAG,IAAI,CAACK,GAAG,CAACN,GAAG,CAAC,CAACC,KAAK,CAAA;MAC/B,IAAIU,IAAI,GAAG,IAAIb,SAAS,CAACE,GAAG,EAAEC,KAAK,CAAC,CAAA;AACpC,MAAA,IAAI,CAACW,MAAM,CAACZ,GAAG,CAAC,CAAA;AAChB,MAAA,IAAI,CAACa,OAAO,CAACF,IAAI,CAAC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AC;AAEM,MAAMU,aAAa,GAAGA,MAAMC,UAAU,CAACd,UAAU,EAAmB;AAE9De,MAAAA,cAAc,GAAGA,MAAM;EAClC,MAAM;AAAER,IAAAA,GAAAA;GAAK,GAAGM,aAAa,EAAE,CAAA;AAC/B,EAAA,OAAON,GAAG,CAAA;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"SSRContext-BoisoiyV.js","sources":["../src/util/LruCache.js","../src/util/CachedDeliveryApi.ts","../src/util/ContensisDeliveryApi.ts","../src/util/SSRContext.tsx"],"sourcesContent":["class CacheNode {\n constructor(key, value) {\n this.key = key;\n this.value = value;\n this.next = null;\n this.prev = null;\n }\n}\n\nexport class 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","import { VersionStatus } from 'contensis-core-api';\nimport { Client, Query } from 'contensis-delivery-api';\nimport {\n INodeOperations,\n NodeGetRootOptions,\n} from 'contensis-delivery-api/lib/models';\n\nimport {\n DeliveryApi,\n SSRContext,\n getClientConfig,\n} from './ContensisDeliveryApi';\nimport { LruCache } from './LruCache';\nimport { CookieObject } from '~/user/util/CookieConstants';\n\n// CachedSearch does not cache results in SSR by design\nclass CachedSearch {\n cache = new LruCache();\n cookies?: CookieObject;\n ssr?: SSRContext;\n\n constructor(ssr?: SSRContext) {\n this.ssr = ssr;\n this.cookies = this.ssr?.cookies.raw;\n }\n\n getClient(...args: Parameters<DeliveryApi['getClient']>) {\n return new DeliveryApi(this.ssr).getClient(...args);\n }\n\n search(query: Query, linkDepth = 0, project?: string) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project}+${JSON.stringify(query)}+${linkDepth}`,\n () => client.entries.search(query, linkDepth)\n );\n }\n\n searchUsingPost(query: Query, linkDepth = 0, project = '') {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project}+${JSON.stringify(query)}+${linkDepth}`,\n () => (client.entries as any).searchUsingPost(query, linkDepth)\n );\n }\n\n get(\n id: string,\n linkDepth = 0,\n versionStatus: VersionStatus = 'published',\n project?: string,\n fields?: string[]\n ) {\n const client = Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n return this.request(id, () =>\n client.entries.get({ id, linkDepth, fields })\n );\n }\n\n getContentType(id: string, project?: string) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(`[CONTENT TYPE] ${id} ${project}`, () =>\n client.contentTypes.get(id)\n );\n }\n\n getRootNode(\n options: NodeGetRootOptions,\n versionStatus: VersionStatus = 'published',\n project?: string\n ) {\n const client = Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n return this.request(`${project} / ${JSON.stringify(options)}`, () =>\n client.nodes.getRoot(options)\n );\n }\n\n getNode(options: Parameters<INodeOperations['get']>[0], project?: string) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} ${\n options && typeof options !== 'string'\n ? 'path' in options\n ? options.path\n : options.id\n : options\n } ${JSON.stringify(options)}`,\n () => client.nodes.get(options)\n );\n }\n\n getAncestors(\n options: Parameters<INodeOperations['getAncestors']>[0],\n project?: string\n ) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} [A] ${\n (options && typeof options !== 'string' && options.id) || options\n } ${JSON.stringify(options)}`,\n () => client.nodes.getAncestors(options)\n );\n }\n\n getChildren(\n options: Parameters<INodeOperations['getChildren']>[0],\n project?: string\n ) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} [C] ${\n (options && typeof options !== 'string' && options.id) || options\n } ${JSON.stringify(options)}`,\n () => client.nodes.getChildren(options)\n );\n }\n\n getSiblings(\n options: Parameters<INodeOperations['getSiblings']>[0],\n project?: string\n ) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} [S] ${\n (options && typeof options !== 'string' && options.id) || options\n } ${JSON.stringify(options)}`,\n () => client.nodes.getSiblings(options)\n );\n }\n\n request<T extends () => Promise<any>>(key: string, execute: T) {\n // do not cache results in SSR\n if (!this.cache.get(key) || typeof window == 'undefined') {\n const promise = execute();\n this.cache.set(key, promise);\n promise.catch(() => {\n this.cache.remove(key);\n });\n }\n return this.cache.get(key) as ReturnType<T>;\n }\n}\n\nexport const cachedSearch = new CachedSearch();\nexport const cachedSearchWithCookies = (ssr?: SSRContext) =>\n new CachedSearch(ssr);\n","import { VersionStatus } from 'contensis-core-api';\nimport { Client, Query } from 'contensis-delivery-api';\nimport { Config } from 'contensis-delivery-api/lib/models';\nimport { parse } from 'query-string';\nimport { setSurrogateKeys } from '~/routing/redux/actions';\nimport { reduxStore } from '~/redux/store/store';\n\nimport { CookieObject, findLoginCookies } from '~/user/util/CookieConstants';\nimport { Request } from 'express';\nimport { IncomingHttpHeaders } from 'http';\nimport { SSRContext as SSRContextType } from '~/models';\n\nexport type SSRContext = Omit<SSRContextType, 'api'>;\n\nconst mapCookieHeader = (cookies: CookieObject | string) =>\n typeof cookies === 'object'\n ? Object.entries(cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join('; ')\n : cookies;\n\nconst getSsrReferer = ({ request }: SSRContext) => {\n if (request) {\n try {\n const url = new URL(\n request.url,\n `${request.protocol || `http`}://${request.headers.host}`\n );\n return url.href;\n } catch (ex) {\n console.error(\n `getSsrReferer cannot parse url ${request.url} and host ${request.headers.host}`\n );\n\n return request.url;\n }\n }\n\n // if (typeof window === 'undefined') {\n // const state = reduxStore.getState();\n // const referer = `${selectCurrentHostname(state)}${selectCurrentPath(\n // state\n // )}${selectCurrentSearch(state)}`;\n\n // return referer;\n // }\n return '';\n};\n\n/**\n * Store the surrogate-key header contents in redux state to output in SSR response\n */\nconst storeSurrogateKeys = (ssr?: SSRContext) => (response: any) => {\n let keys = '';\n if (response.status === 200) {\n keys = response.headers.get\n ? response.headers.get('surrogate-key')\n : response.headers.map['surrogate-key'];\n if (!keys) console.info(`[storeSurrogateKeys] No keys in ${response.url}`);\n }\n // Using imported reduxStore in SSR is unreliable during high\n // concurrent loads and exists here as a best effort fallback\n // in case the SSRContext is not provided\n const put = ssr?.dispatch || reduxStore?.dispatch;\n put?.(setSurrogateKeys(keys, response.url, response.status));\n};\n\n/**\n * Create a new Config object to create a DeliveryAPI Client\n */\nconst deliveryApiConfig = (ssr?: SSRContext) => {\n const config: Config = {\n ...DELIVERY_API_CONFIG /* global DELIVERY_API_CONFIG */,\n };\n\n // Add SSR headers and handlers\n if (typeof window === 'undefined') {\n config.defaultHeaders = {\n 'x-require-surrogate-key': 'true', // request surrogate-key response header\n 'x-crb-ssr': 'true', // add this for support tracing\n };\n if (ssr) config.defaultHeaders.referer = getSsrReferer(ssr); // add this for support tracing\n\n config.responseHandler = { [200]: storeSurrogateKeys(ssr) }; // for handling page cache invalidation\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 const getClientConfig = (project?: string, ssr?: SSRContext) => {\n const config = deliveryApiConfig(ssr);\n\n if (project) {\n config.projectId = project;\n }\n\n if (ssr?.cookies) {\n const cookieHeader = mapCookieHeader(findLoginCookies(ssr.cookies));\n if (cookieHeader) {\n config.defaultHeaders = Object.assign(config.defaultHeaders || {}, {\n Cookie: cookieHeader,\n });\n }\n }\n\n return config;\n};\n\n// export * from 'contensis-delivery-api';\n\ndeclare let window: Window &\n typeof globalThis & {\n versionStatus?: VersionStatus;\n };\n\nexport class DeliveryApi {\n cookies?: CookieObject;\n ssr?: SSRContext;\n\n constructor(ssr?: SSRContext) {\n this.ssr = ssr;\n this.cookies = ssr?.cookies.raw;\n }\n\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\n getServerSideVersionStatus = (request: Request) =>\n request.query.versionStatus ||\n deliveryApi.getVersionStatusFromHeaders(request.headers) ||\n deliveryApi.getVersionStatusFromHostname(request.hostname);\n\n getVersionStatusFromHeaders = (headers: IncomingHttpHeaders) => {\n const versionStatusHeader = headers['x-entry-versionstatus'];\n if (typeof versionStatusHeader !== 'undefined') return versionStatusHeader;\n return null;\n };\n\n getVersionStatusFromHostname = (currentHostname: string) => {\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\n search = (query: Query, linkDepth = 0, project?: string) => {\n const client = Client.create(getClientConfig(project, this.ssr));\n return client.entries.search(\n query,\n typeof linkDepth !== 'undefined' ? linkDepth : 1\n );\n };\n\n getClient = (versionStatus: VersionStatus = 'published', project?: string) =>\n Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n\n getEntry = (\n id: string,\n linkDepth = 0,\n versionStatus: VersionStatus = 'published',\n project?: string\n ) => {\n const client = Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n return client.entries.get({ id, linkDepth });\n };\n}\n\nexport const deliveryApi = new DeliveryApi();\n\nexport const deliveryApiWithCookies = (ssr?: SSRContext) =>\n new DeliveryApi(ssr);\n\nexport * from './CachedDeliveryApi';\n","import { Request, Response } from 'express';\nimport React, {\n PropsWithChildren,\n createContext,\n useContext,\n useState,\n} from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useDispatch } from 'react-redux';\nimport { SSRContext as SSRContextType } from '~/models';\nimport { cachedSearchWithCookies } from '~/util/CachedDeliveryApi';\nimport { CookieHelper } from '~/user/util/CookieHelper.class';\n\nconst SSRContext = createContext<SSRContextType | null>(null);\n\n/** SSRContextProvider allows us to hold and access request-scoped references\n * throughout the component tree\n *\n * adding this in client side allows consumers to write universal code and use\n * the same helpers and refs as in SSR */\nexport const SSRContextProvider = ({\n children,\n request,\n response,\n}: PropsWithChildren<{ request?: Request; response?: Response }>) => {\n // In SSR pass references to things in backing sagas\n // we cannot access in a global scope\n const dispatch = useDispatch();\n const cookies = new CookieHelper(...useCookies());\n const api = cachedSearchWithCookies({ cookies, dispatch, request, response });\n\n const [context] = useState<SSRContextType>({\n api,\n cookies,\n dispatch,\n request,\n response,\n });\n\n return (\n <SSRContext.Provider value={{ ...context }}>{children}</SSRContext.Provider>\n );\n};\n\nexport const useSSRContext = () => useContext(SSRContext) as SSRContextType;\n\nexport const useDeliveryApi = () => {\n const { api } = useSSRContext();\n return api;\n};\n"],"names":["CacheNode","constructor","key","value","next","prev","LruCache","limit","map","head","tail","size","get","node","remove","setHead","set","CachedSearch","ssr","_this$ssr","cache","cookies","raw","getClient","args","DeliveryApi","search","query","linkDepth","project","client","Client","create","getClientConfig","request","JSON","stringify","entries","searchUsingPost","id","versionStatus","fields","getContentType","contentTypes","getRootNode","options","nodes","getRoot","getNode","path","getAncestors","getChildren","getSiblings","execute","window","promise","catch","cachedSearch","cachedSearchWithCookies","mapCookieHeader","Object","name","join","getSsrReferer","url","URL","protocol","headers","host","href","ex","console","error","storeSurrogateKeys","response","keys","status","info","put","dispatch","reduxStore","setSurrogateKeys","deliveryApiConfig","config","DELIVERY_API_CONFIG","defaultHeaders","referer","responseHandler","PROXY_DELIVERY_API","rootUrl","projectId","cookieHeader","findLoginCookies","assign","Cookie","getClientSideVersionStatus","parse","location","currentHostname","hostname","getVersionStatusFromHostname","getServerSideVersionStatus","deliveryApi","getVersionStatusFromHeaders","versionStatusHeader","indexOf","endsWith","getEntry","deliveryApiWithCookies","SSRContext","createContext","SSRContextProvider","children","useDispatch","CookieHelper","useCookies","api","context","useState","React","createElement","Provider","useSSRContext","useContext","useDeliveryApi"],"mappings":";;;;;;;;;AAAA,MAAMA,SAAS,CAAC;AACdC,EAAAA,WAAWA,CAACC,GAAG,EAAEC,KAAK,EAAE;IACtB,IAAI,CAACD,GAAG,GAAGA,GAAG,CAAA;IACd,IAAI,CAACC,KAAK,GAAGA,KAAK,CAAA;IAClB,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;IAChB,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;AAClB,GAAA;AACF,CAAA;AAEO,MAAMC,QAAQ,CAAC;AACpBL,EAAAA,WAAWA,CAACM,KAAK,GAAG,GAAG,EAAE;AACvB,IAAA,IAAI,CAACC,GAAG,GAAG,EAAE,CAAA;IACb,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;IAChB,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;AAChB,IAAA,IAAI,CAACH,KAAK,GAAGA,KAAK,IAAI,GAAG,CAAA;IACzB,IAAI,CA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,UAAU,CAACY,QAAQ,EAAA;AAACtH,IAAAA,KAAK,EAAE;MAAE,GAAGkH,OAAAA;AAAQ,KAAA;AAAE,GAAA,EAAEL,QAA8B,CAAC,CAAA;AAEhF,EAAC;AAEM,MAAMU,aAAa,GAAGA,MAAMC,UAAU,CAACd,UAAU,EAAmB;AAE9De,MAAAA,cAAc,GAAGA,MAAM;EAClC,MAAM;AAAER,IAAAA,GAAAA;GAAK,GAAGM,aAAa,EAAE,CAAA;AAC/B,EAAA,OAAON,GAAG,CAAA;AACZ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getImmutableOrJS } from './selectors-
|
|
1
|
+
import { g as getImmutableOrJS } from './selectors-BRzliwbK.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
const selectUserIsLoading = state => getImmutableOrJS(state, ['user', 'authenticationState', 'isLoading']);
|
|
@@ -37,33 +37,33 @@ const selectChangePasswordError = state => getImmutableOrJS(state, ['user', 'cha
|
|
|
37
37
|
|
|
38
38
|
var selectors = /*#__PURE__*/Object.freeze({
|
|
39
39
|
__proto__: null,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
selectUserIsError: selectUserIsError,
|
|
44
|
-
selectUserAuthenticationErrorMessage: selectUserAuthenticationErrorMessage,
|
|
45
|
-
selectUserErrorMessage: selectUserErrorMessage,
|
|
40
|
+
selectChangePasswordError: selectChangePasswordError,
|
|
41
|
+
selectChangePasswordSending: selectChangePasswordSending,
|
|
42
|
+
selectChangePasswordSent: selectChangePasswordSent,
|
|
46
43
|
selectClientCredentials: selectClientCredentials,
|
|
44
|
+
selectPasswordResetRequestError: selectPasswordResetRequestError,
|
|
45
|
+
selectPasswordResetRequestSending: selectPasswordResetRequestSending,
|
|
46
|
+
selectPasswordResetRequestSent: selectPasswordResetRequestSent,
|
|
47
|
+
selectResetPasswordError: selectResetPasswordError,
|
|
48
|
+
selectResetPasswordSending: selectResetPasswordSending,
|
|
49
|
+
selectResetPasswordSent: selectResetPasswordSent,
|
|
47
50
|
selectUser: selectUser,
|
|
48
|
-
|
|
49
|
-
selectUserGuid: selectUserGuid,
|
|
50
|
-
selectUsername: selectUsername,
|
|
51
|
+
selectUserAuthenticationErrorMessage: selectUserAuthenticationErrorMessage,
|
|
51
52
|
selectUserEmail: selectUserEmail,
|
|
53
|
+
selectUserErrorMessage: selectUserErrorMessage,
|
|
52
54
|
selectUserGroups: selectUserGroups,
|
|
53
|
-
|
|
55
|
+
selectUserGuid: selectUserGuid,
|
|
56
|
+
selectUserIsAuthenticated: selectUserIsAuthenticated,
|
|
57
|
+
selectUserIsAuthenticationError: selectUserIsAuthenticationError,
|
|
58
|
+
selectUserIsError: selectUserIsError,
|
|
59
|
+
selectUserIsLoading: selectUserIsLoading,
|
|
60
|
+
selectUserIsZengentiStaff: selectUserIsZengentiStaff,
|
|
54
61
|
selectUserRegistration: selectUserRegistration,
|
|
55
62
|
selectUserRegistrationError: selectUserRegistrationError,
|
|
56
63
|
selectUserRegistrationIsLoading: selectUserRegistrationIsLoading,
|
|
57
64
|
selectUserRegistrationIsSuccess: selectUserRegistrationIsSuccess,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
selectPasswordResetRequestError: selectPasswordResetRequestError,
|
|
61
|
-
selectResetPasswordSending: selectResetPasswordSending,
|
|
62
|
-
selectResetPasswordSent: selectResetPasswordSent,
|
|
63
|
-
selectResetPasswordError: selectResetPasswordError,
|
|
64
|
-
selectChangePasswordSending: selectChangePasswordSending,
|
|
65
|
-
selectChangePasswordSent: selectChangePasswordSent,
|
|
66
|
-
selectChangePasswordError: selectChangePasswordError
|
|
65
|
+
selectUserSecurityToken: selectUserSecurityToken,
|
|
66
|
+
selectUsername: selectUsername
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
const matchUserGroup = (userGroups = [], requiredGroups = []) => {
|
|
@@ -82,6 +82,7 @@ const matchUserGroup = (userGroups = [], requiredGroups = []) => {
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
/* eslint-disable react/display-name */
|
|
85
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
85
86
|
const toJS = WrappedComponent => wrappedComponentProps => {
|
|
86
87
|
const KEY = 0;
|
|
87
88
|
const VALUE = 1;
|
|
@@ -94,5 +95,5 @@ const toJS = WrappedComponent => wrappedComponentProps => {
|
|
|
94
95
|
return /*#__PURE__*/React.createElement(WrappedComponent, propsJS);
|
|
95
96
|
};
|
|
96
97
|
|
|
97
|
-
export { selectUserIsAuthenticated as a,
|
|
98
|
-
//# sourceMappingURL=ToJs-
|
|
98
|
+
export { selectUserIsAuthenticated as a, selectUserIsAuthenticationError as b, selectUserIsError as c, selectUserIsLoading as d, selectUser as e, selectUserRegistrationError as f, selectUserRegistrationIsLoading as g, selectUserRegistrationIsSuccess as h, selectUserRegistration as i, selectors as j, selectUserGroups as k, selectClientCredentials as l, matchUserGroup as m, selectPasswordResetRequestSending as n, selectPasswordResetRequestSent as o, selectPasswordResetRequestError as p, selectResetPasswordSending as q, selectResetPasswordSent as r, selectUserErrorMessage as s, toJS as t, selectResetPasswordError as u, selectChangePasswordSending as v, selectChangePasswordSent as w, selectUserGuid as x, selectChangePasswordError as y };
|
|
99
|
+
//# sourceMappingURL=ToJs-B4MH53fx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToJs-0ed7c7db.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/util/ToJs.tsx"],"sourcesContent":["import { AppState, StateType } from '~/models';\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 '~/models';\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 ) =>\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":";;;MAGaA,mBAAmB,GAAIC,KAAe,IACjDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,WAAW,CAAC,EAAC;MAE/CE,yBAAyB,GAAIF,KAAe,IACvDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAC;MAErDG,+BAA+B,GAAIH,KAAe,IAC7DC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,uBAAuB,CAAC,EAAC;MAE3DI,iBAAiB,GAAIJ,KAAe,IAC/CC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,SAAS,CAAC,EAAC;;AAE1D;AACA;AACA;AACA;AACA;AACO,MAAMK,oCAAoC,GAAIL,KAAe,IAClEC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,cAAc,CAAC,CAAC,CAAA;MAElDM,sBAAsB,GAAIN,KAAe,IACpDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,cAAc,CAAC,EAAC;AAExD,MAAMO,uBAAuB,GAAGA,CACrCP,KAAe,EAC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AQ,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,KAAA,CAAAC,aAAA,CAACb,gBAAgB,EAAKI,OAAO,CAAI,CAAA;AAC1C;;;;"}
|
|
1
|
+
{"version":3,"file":"ToJs-B4MH53fx.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/util/ToJs.tsx"],"sourcesContent":["import { AppState, StateType } from '~/models';\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 '~/models';\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 ) =>\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":";;;MAGaA,mBAAmB,GAAIC,KAAe,IACjDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,WAAW,CAAC,EAAC;MAE/CE,yBA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IAAIF,aAAa,CAACG,IAAI,KAAKF,SAAS,CAACE,IAAI,EAAE;AACzC,QAAA,OAAO,IAAI,CAAA;AACb,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAC,CAAC,CAAA;AACF,EAAA,OAAOL,UAAU,CAAA;AACnB;;ACxBA;AACA;MAGaM,IAAI,GAEbC,gBAA4C,IAE7CC,qBAA4B,IAAK;EAChC,MAAMC,GAAG,GAAG,CAAC,CAAA;EACb,MAAMC,KAAK,GAAG,CAAC,CAAA;AAEf,EAAA,MAAMC,OAAO,GAAGC,MAAM,CAACC,OAAO,CAACL,qBAAqB,CAAC,CAACM,MAAM,CAC1D,CAACC,QAAa,EAAEC,oBAAoB,KAAK;AACvC,IAAA,MAAMC,OAAO,GAAGD,oBAAoB,CAACP,GAAG,CAAC,CAAA;AACzC,IAAA,MAAMS,SAAS,GAAGF,oBAAoB,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,EACF,CAAC,CAAA;AAED,EAAA,oBAAOI,KAAA,CAAAC,aAAA,CAACb,gBAAgB,EAAKI,OAAU,CAAC,CAAA;AAC1C;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers-BFTU3MAI.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
package/esm/client.js
CHANGED
|
@@ -7,23 +7,23 @@ import { Router } from 'react-router-dom';
|
|
|
7
7
|
import { loadableReady } from '@loadable/component';
|
|
8
8
|
import { parse } from 'query-string';
|
|
9
9
|
import { CookiesProvider } from 'react-cookie';
|
|
10
|
-
import { s as selectVersionStatus } from './version-
|
|
11
|
-
import { s as setVersionStatus } from './version-
|
|
12
|
-
import { b as browserHistory, r as rootSaga, p as pickProject } from './App-
|
|
13
|
-
export { A as ReactApp } from './App-
|
|
14
|
-
import { c as createStore } from './store-
|
|
15
|
-
import {
|
|
16
|
-
import { d as deliveryApi, S as SSRContextProvider } from './SSRContext-
|
|
10
|
+
import { s as selectVersionStatus } from './version-78jjDnHU.js';
|
|
11
|
+
import { s as setVersionStatus } from './version-CB7rIyoF.js';
|
|
12
|
+
import { b as browserHistory, r as rootSaga, p as pickProject } from './App-BE7fh-wb.js';
|
|
13
|
+
export { A as ReactApp } from './App-BE7fh-wb.js';
|
|
14
|
+
import { c as createStore } from './store-Cr0lmZNr.js';
|
|
15
|
+
import { s as setCurrentProject } from './selectors-BRzliwbK.js';
|
|
16
|
+
import { d as deliveryApi, S as SSRContextProvider } from './SSRContext-BoisoiyV.js';
|
|
17
17
|
import '@redux-saga/core/effects';
|
|
18
18
|
import 'history';
|
|
19
19
|
import 'loglevel';
|
|
20
20
|
import 'await-to-js';
|
|
21
|
-
import './ChangePassword.container-
|
|
22
|
-
import './ToJs-
|
|
21
|
+
import './ChangePassword.container-6fQXhkzW.js';
|
|
22
|
+
import './ToJs-B4MH53fx.js';
|
|
23
23
|
import 'jsonpath-mapper';
|
|
24
|
-
import './CookieHelper.class-
|
|
24
|
+
import './CookieHelper.class-DqJ_o1jL.js';
|
|
25
25
|
import 'contensis-delivery-api';
|
|
26
|
-
import './RouteLoader-
|
|
26
|
+
import './RouteLoader-BNKfOnU8.js';
|
|
27
27
|
import 'react-router-config';
|
|
28
28
|
import 'reselect';
|
|
29
29
|
import 'redux';
|
package/esm/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';\nimport { SSRContextProvider } from '~/util/SSRContext';\n\nimport { AppConfig, AppState } from '~/models';\n\ndeclare let window: typeof globalThis & {\n isDynamic: boolean;\n REDUX_DATA: AppState;\n};\n\ntype ReactAppProps = { routes: any; withEvents: any };\n\n// Fix TS2769 error No overload matches this call\nconst Container = AppContainer as any; // as typeof AppContainer;\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 <Container>\n <CookiesProvider>\n <ReduxProvider store={store}>\n <Router history={history}>\n <SSRContextProvider>\n <ReactApp routes={routes} withEvents={withEvents} />\n </SSRContextProvider>\n </Router>\n </ReduxProvider>\n </CookiesProvider>\n </Container>\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 as any).REDUX_DATA;\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n }\n );\n } else {\n fetch(`${window.location.pathname}?redux=true`)\n .then(response => response.json())\n .then(data => {\n const ssRedux = JSON.parse(data);\n createStore(withReducers, ssRedux, history, stateType).then(store => {\n store.dispatch(setVersionStatus(versionStatus));\n\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n });\n });\n }\n }\n}\n\nexport default ClientApp;\n"],"names":["Container","AppContainer","ClientApp","constructor","ReactApp","config","documentRoot","document","getElementById","stateType","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","React","createElement","CookiesProvider","ReduxProvider","Router","history","SSRContextProvider","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","setCurrentProject","pickProject","hostname","fetch","pathname","response","json","data","ssRedux","JSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA;AACA,MAAMA,SAAS,GAAGC,YAAmB,CAAC;;AAEtC,MAAMC,SAAS,CAAC;AACdC,EAAAA,WAAWA,CAACC,QAA4C,EAAEC,MAAiB,EAAE;AAC3E,IAAA,MAAMC,YAAY,GAAGC,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAC,CAAA;IAEpD,MAAM;AACJC,MAAAA,SAAS,GAAG,WAAW;MACvBC,MAAM;MACNC,YAAY;MACZC,SAAS;AACTC,MAAAA,UAAAA;AACF,KAAC,GAAGR,MAAM,CAAA;IAEV,MAAMS,YAAY,GAAGC,KAAK,IAAI;AAC5B,MAAA,MAAMC,SAAS,gBACbC,KAAA,CAAAC,aAAA,CAAClB,SAAS,EACRiB,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACC,eAAe,EAAA,IAAA,eACdF,KAAA,CAAAC,aAAA,CAACE,QAAa,EAAA;AAACL,QAAAA,KAAK,EAAEA,KAAAA;AAAM,OAAA,eAC1BE,KAAA,CAAAC,aAAA,CAACG,MAAM,EAAA;AAACC,QAAAA,OAAO,EAAEA,cAAAA;OACfL,eAAAA,KAAA,CAAAC,aAAA,CAACK,kBAAkB,qBACjBN,KAAA,CAAAC,aAAA,CAACd,QAAQ,EAAA;AAACM,QAAAA,MAAM,EAAEA,MAAO;AAACG,QAAAA,UAAU,EAAEA,UAAAA;AAAW,
|
|
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';\nimport { SSRContextProvider } from '~/util/SSRContext';\n\nimport { AppConfig, AppState } from '~/models';\n\ndeclare let window: typeof globalThis & {\n isDynamic: boolean;\n REDUX_DATA: AppState;\n};\n\ntype ReactAppProps = { routes: any; withEvents: any };\n\n// Fix TS2769 error No overload matches this call\nconst Container = AppContainer as any; // as typeof AppContainer;\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 <Container>\n <CookiesProvider>\n <ReduxProvider store={store}>\n <Router history={history}>\n <SSRContextProvider>\n <ReactApp routes={routes} withEvents={withEvents} />\n </SSRContextProvider>\n </Router>\n </ReduxProvider>\n </CookiesProvider>\n </Container>\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 as any).REDUX_DATA;\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n }\n );\n } else {\n fetch(`${window.location.pathname}?redux=true`)\n .then(response => response.json())\n .then(data => {\n const ssRedux = JSON.parse(data);\n createStore(withReducers, ssRedux, history, stateType).then(store => {\n store.dispatch(setVersionStatus(versionStatus));\n\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n });\n });\n }\n }\n}\n\nexport default ClientApp;\n"],"names":["Container","AppContainer","ClientApp","constructor","ReactApp","config","documentRoot","document","getElementById","stateType","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","React","createElement","CookiesProvider","ReduxProvider","Router","history","SSRContextProvider","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","setCurrentProject","pickProject","hostname","fetch","pathname","response","json","data","ssRedux","JSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA;AACA,MAAMA,SAAS,GAAGC,YAAmB,CAAC;;AAEtC,MAAMC,SAAS,CAAC;AACdC,EAAAA,WAAWA,CAACC,QAA4C,EAAEC,MAAiB,EAAE;AAC3E,IAAA,MAAMC,YAAY,GAAGC,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAC,CAAA;IAEpD,MAAM;AACJC,MAAAA,SAAS,GAAG,WAAW;MACvBC,MAAM;MACNC,YAAY;MACZC,SAAS;AACTC,MAAAA,UAAAA;AACF,KAAC,GAAGR,MAAM,CAAA;IAEV,MAAMS,YAAY,GAAGC,KAAK,IAAI;AAC5B,MAAA,MAAMC,S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