@zengenti/contensis-react-base 4.0.0-beta.56 → 4.0.0-beta.59
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-C5hfqiyz.js → App-Dr56ZsQj.js} +2 -1
- package/{esm/App-BVdAv4vL.js.map → cjs/App-Dr56ZsQj.js.map} +1 -1
- package/cjs/client.js +4 -3
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +36 -15
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/util.js +9 -0
- package/cjs/util.js.map +1 -1
- package/esm/{App-BVdAv4vL.js → App-CrCf7gso.js} +2 -1
- package/{cjs/App-C5hfqiyz.js.map → esm/App-CrCf7gso.js.map} +1 -1
- package/esm/client.js +5 -4
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +37 -16
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/util.js +1 -0
- package/esm/util.js.map +1 -1
- package/models/server/util/jsx.d.ts +1 -0
- package/models/util/index.d.ts +1 -0
- package/package.json +2 -1
package/cjs/util.js
CHANGED
|
@@ -5,6 +5,7 @@ var ContensisDeliveryApi = require('./ContensisDeliveryApi-gN3_MHEl.js');
|
|
|
5
5
|
var SSRContext = require('./SSRContext-DotLlTQc.js');
|
|
6
6
|
var VersionInfo = require('./VersionInfo-zFPsvS8q.js');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var reactHelmetAsync = require('react-helmet-async');
|
|
8
9
|
var mapJson = require('jsonpath-mapper');
|
|
9
10
|
var reactRouterDom = require('react-router-dom');
|
|
10
11
|
require('contensis-delivery-api');
|
|
@@ -204,6 +205,14 @@ exports.useDeliveryApi = SSRContext.useDeliveryApi;
|
|
|
204
205
|
exports.useSSRContext = SSRContext.useSSRContext;
|
|
205
206
|
exports.VersionInfo = VersionInfo.VersionInfo;
|
|
206
207
|
exports.stringifyStrings = VersionInfo.stringifyStrings;
|
|
208
|
+
Object.defineProperty(exports, "Helmet", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
get: function () { return reactHelmetAsync.Helmet; }
|
|
211
|
+
});
|
|
212
|
+
Object.defineProperty(exports, "HelmetProvider", {
|
|
213
|
+
enumerable: true,
|
|
214
|
+
get: function () { return reactHelmetAsync.HelmetProvider; }
|
|
215
|
+
});
|
|
207
216
|
Object.defineProperty(exports, "jpath", {
|
|
208
217
|
enumerable: true,
|
|
209
218
|
get: function () { return mapJson.jpath; }
|
package/cjs/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../src/util/json-mapper.ts","../src/util/useIsClient.ts","../src/util/NoSSR.tsx","../src/util/donotuse_useHistory.ts"],"sourcesContent":["import { Entry } from 'contensis-delivery-api/lib/models';\nimport mapJson, { jpath } from 'jsonpath-mapper';\nimport {\n MappingTemplate,\n PureJsFunction,\n} from 'jsonpath-mapper';\nimport { AppState, EntryMapper, RouteNode } from '~/models';\n\nexport { default as mapJson, jpath } from 'jsonpath-mapper';\n\ntype Mappers<S> = { [contentTypeId: string]: MappingTemplate<S> };\n\n/**\n *\n * @param {object} json The source object we wish to transform\n * @param {object} template The mapping template we wish to apply to the source\n * object to generate the intended target object\n */\nexport const useMapper = <T, S>(json: S, template: MappingTemplate<S>) => {\n return template ? (mapJson((json || {}) as S, template) as T) : json;\n};\n\nconst chooseMapperByFieldValue = <S, T extends Mappers<S>>(\n entry: S,\n mappers: T,\n field = 'sys.contentTypeId'\n) => {\n const fieldValue = jpath(field, entry || {}) as string;\n return (mappers[fieldValue] || mappers.default || {}) as T[keyof T];\n};\n\n/**\n * useEntriesMapper hook to take a list of entries from Delivery API along\n * with mappers for each contentTypeId and return an array of mapped objects\n * @param {any} entry The source entry we wish to transform\n * @param {object} mappers Object with keys containing mapper templates,\n * the key name matching sys.contentTypeId\n * @param {string} field Only include if we need to match content based on\n * a field other than sys.contentTypeId in the source data\n * @returns {object} Object transformed using a matched content type or\n * a default mapper template, returns an empty object if no mapper template\n * couild be applied.\n */\nexport const useEntriesMapper = <S, T extends Mappers<S>>(\n entry: S,\n mappers: T,\n field = 'sys.contentTypeId'\n) => {\n const mapper = chooseMapperByFieldValue(entry, mappers, field);\n return useMapper(entry, mapper);\n};\n\n/**\n * Deprecated: due to misleading name, use the hook useEntriesMapper instead\n */\nexport const useEntryMapper = useEntriesMapper;\n\n/**\n * mapEntries mapping function to take a list of entries from Delivery API along\n * with mappers for each contentTypeId and return an array of mapped objects\n * @param {any} entry The source entry we wish to transform\n * @param {object} mappers Object with keys containing mapper templates,\n * the key name matching sys.contentTypeId\n * @param {string} field Only include if we need to match content based on\n * a field other than sys.contentTypeId in the source data\n * @returns {object} Object transformed using a matched content type or\n * a default mapper template, returns an empty object if no mapper template\n * couild be applied.\n */\nexport const mapEntries = <\n S,\n Mappers extends { [contentTypeId: string]: MappingTemplate<S> }\n>(\n entries: S[],\n mappers: Mappers,\n field = 'sys.contentTypeId'\n) =>\n entries.map(entry => {\n const mapper = chooseMapperByFieldValue(entry, mappers, field);\n return mapper ? mapJson((entry || {}) as S, mapper) : entry;\n });\n\n/**\n * mapComposer mapping function to take a composer field from Delivery API along\n * with mappers for each Composer Item \"type\" and return an array of mapped components\n * @param {array} composer Composer field array of Composer Items\n * @param {object} mappers A keyed object with each key matching the Composer Item \"type\"\n * @returns {array} Array of mapped objects transformed using a matched Composer Item \"type\" mapping\n * or null. Injects a \"_type\" property into each transformed object in the array to indicate\n * where the mapping originated and for what component the mapped object is representing\n */\nexport const mapComposer = <\n S extends { type: string; value: any },\n T extends Mappers<S>\n>(\n composer: S[],\n mappers: T\n) =>\n Array.isArray(composer)\n ? composer.map((composerItem, index) => {\n const itemValue = composerItem.value;\n const mapper = mappers[composerItem.type] || mappers.default;\n if (mapper) {\n // Add some fields into the composer item mapper and return object\n const addedFields = {\n _type: composerItem.type,\n _index: index,\n };\n\n // Add fields and $root item into the composer item source object\n // for use inside each item mapping, for arrays we inject the added fields\n // into the first array item. This is useful if we require any of\n // composerItem.type, composerItem index/position and composer $root\n // in scope to influence any composer item's mapping logic\n const sourceObject =\n itemValue && Array.isArray(itemValue)\n ? itemValue.map((iv, idx) =>\n idx !== 0\n ? iv\n : typeof iv === 'object'\n ? { ...addedFields, ...iv, $root: composer }\n : iv\n )\n : typeof itemValue === 'object'\n ? { ...addedFields, ...itemValue, $root: composer }\n : itemValue || {};\n\n // Apply the composer item mapping\n const mappedFields = mapJson(sourceObject, mapper) as any;\n\n // Add the extra fields in with the return object\n return mappedFields && typeof mappedFields === 'object'\n ? { ...mappedFields, ...addedFields }\n : mappedFields;\n } else return {};\n })\n : composer || [];\n\n/**\n * useComposerMapper hook to take a composer field from Delivery API along\n * with mappers for each Composer Item \"type\" and return an array of mapped components\n * @param {array} composer Composer field array of Composer Items\n * @param {object} mappers A keyed object with each key matching the Composer Item \"type\"\n * @returns {array} Array of mapped objects transformed using a matched Composer Item \"type\" mapping\n * or null. Injects a \"_type\" property into each transformed object in the array to indicate\n * where the mapping originated and for what component the mapped object is representing\n */\nexport const useComposerMapper = <\n S extends { type: string; value: any },\n T extends Mappers<S>\n>(\n composer: S[] = [],\n mappers: T\n) => mapComposer(composer, mappers);\n\n/**\n * entryMapper will return a function to satisfy an entryMapper when defining app route\n * this is essentially a shorthand function to prevent boilerplate repetition inside your routes file\n * you do not need to use this function should you wish to map your entry via raw JS functions\n * @param mapping the jsonpath-mapper mapping template to apply when the route is resolved\n * @returns {mappedEntry}\n */\nexport const entryMapper =\n (\n mapping:\n | MappingTemplate<RouteNode & Entry & { state?: AppState }>\n | PureJsFunction<RouteNode & Entry & { state?: AppState }>\n ): EntryMapper =>\n (node, state) =>\n mapJson({ ...node, ...(node.entry || ({} as Entry)), state }, mapping);\n\nexport default mapJson;\n","// hooks/useIsClient.ts\nimport { useEffect, useState } from 'react';\n/**\n * A hook that returns true only when the component has mounted in the browser client\n * Used to prevent SSR render and defer rendering to client-side to safely refernce\n * browser-only apis or avoid React Hydration errors\n */\nexport const useIsClient = () => {\n const [isClient, setIsClient] = useState(false);\n useEffect(() => setIsClient(true), []);\n return isClient;\n};\n","import React from 'react';\nimport { useIsClient } from './useIsClient';\n\n/**\n * NoSSR component to prevent children from rendering on the server.\n * Renders children only after component has mounted in the browser.\n */\nexport const NoSSR: React.FC<React.PropsWithChildren> = ({ children }) => {\n const isClient = useIsClient();\n\n if (!isClient) return null;\n\n return <>{children}</>;\n};\n","import { useNavigate } from 'react-router-dom';\nimport { useLocation } from 'react-router-dom';\n\n/** @deprecated ponyfill for useHistory hook in react-router v5 removed in v6 */\nexport const useHistory = () => {\n const navigate = useNavigate();\n const location = useLocation();\n\n return {\n push: navigate,\n replace: navigate,\n location,\n };\n};\n"],"names":["useMapper","json","template","mapJson","chooseMapperByFieldValue","entry","mappers","field","fieldValue","jpath","default","useEntriesMapper","mapper","useEntryMapper","mapEntries","entries","map","mapComposer","composer","Array","isArray","composerItem","index","itemValue","value","type","addedFields","_type","_index","sourceObject","iv","idx","$root","mappedFields","useComposerMapper","entryMapper","mapping","node","state","useIsClient","isClient","setIsClient","useState","useEffect","NoSSR","children","React","createElement","Fragment","useHistory","navigate","useNavigate","location","useLocation","push","replace"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;AACA;AACA;AACA;AACA;AACA;MACaA,SAAS,GAAGA,CAAOC,IAAO,EAAEC,QAA4B,KAAK;AACxE,EAAA,OAAOA,QAAQ,GAAIC,wBAAO,CAAEF,IAAI,IAAI,EAAE,EAAQC,QAAQ,CAAC,GAASD,IAAI;AACtE;AAEA,MAAMG,wBAAwB,GAAGA,CAC/BC,KAAQ,EACRC,OAAU,EACVC,KAAK,GAAG,mBAAmB,KACxB;EACH,MAAMC,UAAU,GAAGC,aAAK,CAACF,KAAK,EAAEF,KAAK,IAAI,EAAE,CAAW;EACtD,OAAQC,OAAO,CAACE,UAAU,CAAC,IAAIF,OAAO,CAACI,OAAO,IAAI,EAAE;AACtD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;A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cAAQ,CAAC,KAAK,CAAC;EAC/CC,eAAS,CAAC,MAAMF,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;AACtC,EAAA,OAAOD,QAAQ;AACjB;;ACRA;AACA;AACA;AACA;AACO,MAAMI,KAAwC,GAAGA,CAAC;AAAEC,EAAAA;AAAS,CAAC,KAAK;AACxE,EAAA,MAAML,QAAQ,GAAGD,WAAW,EAAE;AAE9B,EAAA,IAAI,CAACC,QAAQ,EAAE,OAAO,IAAI;EAE1B,oBAAOM,sBAAA,CAAAC,aAAA,CAAAD,sBAAA,CAAAE,QAAA,EAAA,IAAA,EAAGH,QAAW,CAAC;AACxB;;ACVA;AACO,MAAMI,UAAU,GAAGA,MAAM;AAC9B,EAAA,MAAMC,QAAQ,GAAGC,0BAAW,EAAE;AAC9B,EAAA,MAAMC,QAAQ,GAAGC,0BAAW,EAAE;EAE9B,OAAO;AACLC,IAAAA,IAAI,EAAEJ,QAAQ;AACdK,IAAAA,OAAO,EAAEL,QAAQ;AACjBE,IAAAA;GACD;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"util.js","sources":["../src/util/json-mapper.ts","../src/util/useIsClient.ts","../src/util/NoSSR.tsx","../src/util/donotuse_useHistory.ts"],"sourcesContent":["import { Entry } from 'contensis-delivery-api/lib/models';\nimport mapJson, { jpath } from 'jsonpath-mapper';\nimport {\n MappingTemplate,\n PureJsFunction,\n} from 'jsonpath-mapper';\nimport { AppState, EntryMapper, RouteNode } from '~/models';\n\nexport { default as mapJson, jpath } from 'jsonpath-mapper';\n\ntype Mappers<S> = { [contentTypeId: string]: MappingTemplate<S> };\n\n/**\n *\n * @param {object} json The source object we wish to transform\n * @param {object} template The mapping template we wish to apply to the source\n * object to generate the intended target object\n */\nexport const useMapper = <T, S>(json: S, template: MappingTemplate<S>) => {\n return template ? (mapJson((json || {}) as S, template) as T) : json;\n};\n\nconst chooseMapperByFieldValue = <S, T extends Mappers<S>>(\n entry: S,\n mappers: T,\n field = 'sys.contentTypeId'\n) => {\n const fieldValue = jpath(field, entry || {}) as string;\n return (mappers[fieldValue] || mappers.default || {}) as T[keyof T];\n};\n\n/**\n * useEntriesMapper hook to take a list of entries from Delivery API along\n * with mappers for each contentTypeId and return an array of mapped objects\n * @param {any} entry The source entry we wish to transform\n * @param {object} mappers Object with keys containing mapper templates,\n * the key name matching sys.contentTypeId\n * @param {string} field Only include if we need to match content based on\n * a field other than sys.contentTypeId in the source data\n * @returns {object} Object transformed using a matched content type or\n * a default mapper template, returns an empty object if no mapper template\n * couild be applied.\n */\nexport const useEntriesMapper = <S, T extends Mappers<S>>(\n entry: S,\n mappers: T,\n field = 'sys.contentTypeId'\n) => {\n const mapper = chooseMapperByFieldValue(entry, mappers, field);\n return useMapper(entry, mapper);\n};\n\n/**\n * Deprecated: due to misleading name, use the hook useEntriesMapper instead\n */\nexport const useEntryMapper = useEntriesMapper;\n\n/**\n * mapEntries mapping function to take a list of entries from Delivery API along\n * with mappers for each contentTypeId and return an array of mapped objects\n * @param {any} entry The source entry we wish to transform\n * @param {object} mappers Object with keys containing mapper templates,\n * the key name matching sys.contentTypeId\n * @param {string} field Only include if we need to match content based on\n * a field other than sys.contentTypeId in the source data\n * @returns {object} Object transformed using a matched content type or\n * a default mapper template, returns an empty object if no mapper template\n * couild be applied.\n */\nexport const mapEntries = <\n S,\n Mappers extends { [contentTypeId: string]: MappingTemplate<S> }\n>(\n entries: S[],\n mappers: Mappers,\n field = 'sys.contentTypeId'\n) =>\n entries.map(entry => {\n const mapper = chooseMapperByFieldValue(entry, mappers, field);\n return mapper ? mapJson((entry || {}) as S, mapper) : entry;\n });\n\n/**\n * mapComposer mapping function to take a composer field from Delivery API along\n * with mappers for each Composer Item \"type\" and return an array of mapped components\n * @param {array} composer Composer field array of Composer Items\n * @param {object} mappers A keyed object with each key matching the Composer Item \"type\"\n * @returns {array} Array of mapped objects transformed using a matched Composer Item \"type\" mapping\n * or null. Injects a \"_type\" property into each transformed object in the array to indicate\n * where the mapping originated and for what component the mapped object is representing\n */\nexport const mapComposer = <\n S extends { type: string; value: any },\n T extends Mappers<S>\n>(\n composer: S[],\n mappers: T\n) =>\n Array.isArray(composer)\n ? composer.map((composerItem, index) => {\n const itemValue = composerItem.value;\n const mapper = mappers[composerItem.type] || mappers.default;\n if (mapper) {\n // Add some fields into the composer item mapper and return object\n const addedFields = {\n _type: composerItem.type,\n _index: index,\n };\n\n // Add fields and $root item into the composer item source object\n // for use inside each item mapping, for arrays we inject the added fields\n // into the first array item. This is useful if we require any of\n // composerItem.type, composerItem index/position and composer $root\n // in scope to influence any composer item's mapping logic\n const sourceObject =\n itemValue && Array.isArray(itemValue)\n ? itemValue.map((iv, idx) =>\n idx !== 0\n ? iv\n : typeof iv === 'object'\n ? { ...addedFields, ...iv, $root: composer }\n : iv\n )\n : typeof itemValue === 'object'\n ? { ...addedFields, ...itemValue, $root: composer }\n : itemValue || {};\n\n // Apply the composer item mapping\n const mappedFields = mapJson(sourceObject, mapper) as any;\n\n // Add the extra fields in with the return object\n return mappedFields && typeof mappedFields === 'object'\n ? { ...mappedFields, ...addedFields }\n : mappedFields;\n } else return {};\n })\n : composer || [];\n\n/**\n * useComposerMapper hook to take a composer field from Delivery API along\n * with mappers for each Composer Item \"type\" and return an array of mapped components\n * @param {array} composer Composer field array of Composer Items\n * @param {object} mappers A keyed object with each key matching the Composer Item \"type\"\n * @returns {array} Array of mapped objects transformed using a matched Composer Item \"type\" mapping\n * or null. Injects a \"_type\" property into each transformed object in the array to indicate\n * where the mapping originated and for what component the mapped object is representing\n */\nexport const useComposerMapper = <\n S extends { type: string; value: any },\n T extends Mappers<S>\n>(\n composer: S[] = [],\n mappers: T\n) => mapComposer(composer, mappers);\n\n/**\n * entryMapper will return a function to satisfy an entryMapper when defining app route\n * this is essentially a shorthand function to prevent boilerplate repetition inside your routes file\n * you do not need to use this function should you wish to map your entry via raw JS functions\n * @param mapping the jsonpath-mapper mapping template to apply when the route is resolved\n * @returns {mappedEntry}\n */\nexport const entryMapper =\n (\n mapping:\n | MappingTemplate<RouteNode & Entry & { state?: AppState }>\n | PureJsFunction<RouteNode & Entry & { state?: AppState }>\n ): EntryMapper =>\n (node, state) =>\n mapJson({ ...node, ...(node.entry || ({} as Entry)), state }, mapping);\n\nexport default mapJson;\n","// hooks/useIsClient.ts\nimport { useEffect, useState } from 'react';\n/**\n * A hook that returns true only when the component has mounted in the browser client\n * Used to prevent SSR render and defer rendering to client-side to safely refernce\n * browser-only apis or avoid React Hydration errors\n */\nexport const useIsClient = () => {\n const [isClient, setIsClient] = useState(false);\n useEffect(() => setIsClient(true), []);\n return isClient;\n};\n","import React from 'react';\nimport { useIsClient } from './useIsClient';\n\n/**\n * NoSSR component to prevent children from rendering on the server.\n * Renders children only after component has mounted in the browser.\n */\nexport const NoSSR: React.FC<React.PropsWithChildren> = ({ children }) => {\n const isClient = useIsClient();\n\n if (!isClient) return null;\n\n return <>{children}</>;\n};\n","import { useNavigate } from 'react-router-dom';\nimport { useLocation } from 'react-router-dom';\n\n/** @deprecated ponyfill for useHistory hook in react-router v5 removed in v6 */\nexport const useHistory = () => {\n const navigate = useNavigate();\n const location = useLocation();\n\n return {\n push: navigate,\n replace: navigate,\n location,\n };\n};\n"],"names":["useMapper","json","template","mapJson","chooseMapperByFieldValue","entry","mappers","field","fieldValue","jpath","default","useEntriesMapper","mapper","useEntryMapper","mapEntries","entries","map","mapComposer","composer","Array","isArray","composerItem","index","itemValue","value","type","addedFields","_type","_index","sourceObject","iv","idx","$root","mappedFields","useComposerMapper","entryMapper","mapping","node","state","useIsClient","isClient","setIsClient","useState","useEffect","NoSSR","children","React","createElement","Fragment","useHistory","navigate","useNavigate","location","useLocation","push","replace"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;AACA;AACA;AACA;AACA;AACA;MACaA,SAAS,GAAGA,CAAOC,IAAO,EAAEC,QAA4B,KAAK;AACxE,EAAA,OAAOA,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;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM6B,WAAW,GAEpBC,OAE4D,IAE5D,CAACC,IAAI,EAAEC,KAAK,KACVnC,wBAAO,CAAC;AAAE,EAAA,GAAGkC,IAAI;AAAE,EAAA,IAAIA,IAAI,CAAChC,KAAK,IAAK,EAAY,CAAC;AAAEiC,EAAAA;AAAM,CAAC,EAAEF,OAAO;;ACzK3E;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMG,WAAW,GAAGA,MAAM;EAC/B,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;EAC/CC,eAAS,CAAC,MAAMF,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;AACtC,EAAA,OAAOD,QAAQ;AACjB;;ACRA;AACA;AACA;AACA;AACO,MAAMI,KAAwC,GAAGA,CAAC;AAAEC,EAAAA;AAAS,CAAC,KAAK;AACxE,EAAA,MAAML,QAAQ,GAAGD,WAAW,EAAE;AAE9B,EAAA,IAAI,CAACC,QAAQ,EAAE,OAAO,IAAI;EAE1B,oBAAOM,sBAAA,CAAAC,aAAA,CAAAD,sBAAA,CAAAE,QAAA,EAAA,IAAA,EAAGH,QAAW,CAAC;AACxB;;ACVA;AACO,MAAMI,UAAU,GAAGA,MAAM;AAC9B,EAAA,MAAMC,QAAQ,GAAGC,0BAAW,EAAE;AAC9B,EAAA,MAAMC,QAAQ,GAAGC,0BAAW,EAAE;EAE9B,OAAO;AACLC,IAAAA,IAAI,EAAEJ,QAAQ;AACdK,IAAAA,OAAO,EAAEL,QAAQ;AACjBE,IAAAA;GACD;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -13,6 +13,7 @@ import React from 'react';
|
|
|
13
13
|
import 'react-cookie';
|
|
14
14
|
import 'react-redux';
|
|
15
15
|
import './VersionInfo-By2ZCZOh.js';
|
|
16
|
+
import 'react-helmet-async';
|
|
16
17
|
import 'jsonpath-mapper';
|
|
17
18
|
import 'react-router-dom';
|
|
18
19
|
import { s as selectCurrentLanguage, a as selectDictionary, c as selectLocaleRoutes, b as selectLocales, f as selectDictionaryResolver, d as selectPrimaryLanguage } from './selectors-DcmvOeX2.js';
|
|
@@ -1208,4 +1209,4 @@ const AppRoot = props => {
|
|
|
1208
1209
|
};
|
|
1209
1210
|
|
|
1210
1211
|
export { AppRoot as A, browserHistory as b, createLocaleRoutes as c, history as h, pickProject as p, rootSaga as r };
|
|
1211
|
-
//# sourceMappingURL=App-
|
|
1212
|
+
//# sourceMappingURL=App-CrCf7gso.js.map
|