@enonic/nextjs-adapter 3.3.0-B1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseMappings.d.ts +1 -0
- package/{src/baseMappings.ts → dist/baseMappings.js} +4 -14
- package/dist/baseMappings.js.map +1 -0
- package/dist/client/getClientHydratedHtml.d.ts +1 -0
- package/{src/client/getClientHydratedHtml.tsx → dist/client/getClientHydratedHtml.jsx} +3 -6
- package/dist/client/getClientHydratedHtml.jsx.map +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +3 -0
- package/dist/client.js.map +1 -0
- package/dist/common/ComponentRegistry.d.ts +34 -0
- package/dist/common/ComponentRegistry.js +121 -0
- package/dist/common/ComponentRegistry.js.map +1 -0
- package/dist/common/UrlProcessor.d.ts +25 -0
- package/{src/common/UrlProcessor.ts → dist/common/UrlProcessor.js} +49 -70
- package/dist/common/UrlProcessor.js.map +1 -0
- package/dist/common/constants.d.ts +51 -0
- package/{src/common/constants.ts → dist/common/constants.js} +38 -44
- package/dist/common/constants.js.map +1 -0
- package/dist/common/env.d.ts +12 -0
- package/{src/common/env.ts → dist/common/env.js} +3 -14
- package/dist/common/env.js.map +1 -0
- package/dist/guillotine/applyProcessors.d.ts +2 -0
- package/dist/guillotine/applyProcessors.js +33 -0
- package/dist/guillotine/applyProcessors.js.map +1 -0
- package/dist/guillotine/buildComponentTree.d.ts +2 -0
- package/{src/guillotine/buildComponentTree.ts → dist/guillotine/buildComponentTree.js} +13 -25
- package/dist/guillotine/buildComponentTree.js.map +1 -0
- package/dist/guillotine/buildErrorResponse.d.ts +3 -0
- package/{src/guillotine/buildErrorResponse.ts → dist/guillotine/buildErrorResponse.js} +2 -10
- package/dist/guillotine/buildErrorResponse.js.map +1 -0
- package/dist/guillotine/buildPage.d.ts +2 -0
- package/dist/guillotine/buildPage.js +10 -0
- package/dist/guillotine/buildPage.js.map +1 -0
- package/dist/guillotine/collectComponentDescriptors.d.ts +6 -0
- package/{src/guillotine/collectComponentDescriptors.ts → dist/guillotine/collectComponentDescriptors.js} +13 -26
- package/dist/guillotine/collectComponentDescriptors.js.map +1 -0
- package/dist/guillotine/combineMultipleQueries.d.ts +2 -0
- package/{src/guillotine/combineMultipleQueries.ts → dist/guillotine/combineMultipleQueries.js} +9 -23
- package/dist/guillotine/combineMultipleQueries.js.map +1 -0
- package/dist/guillotine/createMetaData.d.ts +18 -0
- package/dist/guillotine/createMetaData.js +45 -0
- package/dist/guillotine/createMetaData.js.map +1 -0
- package/dist/guillotine/fetchContent.d.ts +9 -0
- package/dist/guillotine/fetchContent.js +222 -0
- package/dist/guillotine/fetchContent.js.map +1 -0
- package/dist/guillotine/fetchContentData.d.ts +2 -0
- package/dist/guillotine/fetchContentData.js +30 -0
- package/dist/guillotine/fetchContentData.js.map +1 -0
- package/dist/guillotine/fetchContentPathsForAllLocales.d.ts +2 -0
- package/dist/guillotine/fetchContentPathsForAllLocales.js +21 -0
- package/dist/guillotine/fetchContentPathsForAllLocales.js.map +1 -0
- package/dist/guillotine/fetchContentPathsForLocale.d.ts +2 -0
- package/dist/guillotine/fetchContentPathsForLocale.js +42 -0
- package/dist/guillotine/fetchContentPathsForLocale.js.map +1 -0
- package/dist/guillotine/fetchFromApi.d.ts +3 -0
- package/dist/guillotine/fetchFromApi.js +76 -0
- package/dist/guillotine/fetchFromApi.js.map +1 -0
- package/dist/guillotine/fetchGuillotine.d.ts +3 -0
- package/dist/guillotine/fetchGuillotine.js +75 -0
- package/dist/guillotine/fetchGuillotine.js.map +1 -0
- package/dist/guillotine/fetchMetaData.d.ts +2 -0
- package/dist/guillotine/fetchMetaData.js +33 -0
- package/dist/guillotine/fetchMetaData.js.map +1 -0
- package/dist/guillotine/getCleanContentPathArrayOrThrow400.d.ts +2 -0
- package/{src/guillotine/getCleanContentPathArrayOrThrow400.ts → dist/guillotine/getCleanContentPathArrayOrThrow400.js} +7 -9
- package/dist/guillotine/getCleanContentPathArrayOrThrow400.js.map +1 -0
- package/dist/guillotine/getComponentConfig.d.ts +2 -0
- package/{src/guillotine/getComponentConfig.ts → dist/guillotine/getComponentConfig.js} +3 -5
- package/dist/guillotine/getComponentConfig.js.map +1 -0
- package/dist/guillotine/getContentAndComponentPaths.d.ts +1 -0
- package/{src/guillotine/getContentAndComponentPaths.ts → dist/guillotine/getContentAndComponentPaths.js} +6 -5
- package/dist/guillotine/getContentAndComponentPaths.js.map +1 -0
- package/dist/guillotine/getMetaData.d.ts +2 -0
- package/{src/guillotine/getMetaData.ts → dist/guillotine/getMetaData.js} +11 -18
- package/dist/guillotine/getMetaData.js.map +1 -0
- package/dist/guillotine/getParentRegion.d.ts +2 -0
- package/{src/guillotine/getParentRegion.ts → dist/guillotine/getParentRegion.js} +9 -23
- package/dist/guillotine/getParentRegion.js.map +1 -0
- package/dist/guillotine/getQueryAndVariables.d.ts +2 -0
- package/{src/guillotine/getQueryAndVariables.ts → dist/guillotine/getQueryAndVariables.js} +7 -23
- package/dist/guillotine/getQueryAndVariables.js.map +1 -0
- package/dist/guillotine/metadata/configQuery.d.ts +2 -0
- package/dist/guillotine/metadata/configQuery.js +36 -0
- package/dist/guillotine/metadata/configQuery.js.map +1 -0
- package/dist/guillotine/metadata/richTextQuery.d.ts +1 -0
- package/{src/guillotine/metadata/richTextQuery.ts → dist/guillotine/metadata/richTextQuery.js} +6 -8
- package/dist/guillotine/metadata/richTextQuery.js.map +1 -0
- package/dist/guillotine/parseComponentPath.d.ts +2 -0
- package/{src/guillotine/parseComponentPath.ts → dist/guillotine/parseComponentPath.js} +4 -8
- package/dist/guillotine/parseComponentPath.js.map +1 -0
- package/dist/guillotine/prefixFragmentCmpPath.d.ts +1 -0
- package/{src/guillotine/prefixFragmentCmpPath.ts → dist/guillotine/prefixFragmentCmpPath.js} +5 -5
- package/dist/guillotine/prefixFragmentCmpPath.js.map +1 -0
- package/dist/guillotine/processComponentConfig.d.ts +2 -0
- package/{src/guillotine/processComponentConfig.ts → dist/guillotine/processComponentConfig.js} +4 -12
- package/dist/guillotine/processComponentConfig.js.map +1 -0
- package/dist/guillotine/restrictComponentsToPath.d.ts +2 -0
- package/{src/guillotine/restrictComponentsToPath.ts → dist/guillotine/restrictComponentsToPath.js} +9 -19
- package/dist/guillotine/restrictComponentsToPath.js.map +1 -0
- package/dist/guillotine/validateData.d.ts +2 -0
- package/dist/guillotine/validateData.js +7 -0
- package/dist/guillotine/validateData.js.map +1 -0
- package/dist/guillotine/validateNotFound.d.ts +2 -0
- package/{src/guillotine/validateNotFound.ts → dist/guillotine/validateNotFound.js} +5 -9
- package/dist/guillotine/validateNotFound.js.map +1 -0
- package/dist/guillotine/validateShortcut.d.ts +2 -0
- package/{src/guillotine/validateShortcut.ts → dist/guillotine/validateShortcut.js} +12 -20
- package/dist/guillotine/validateShortcut.js.map +1 -0
- package/dist/i18n/LocaleContext.d.ts +7 -0
- package/dist/i18n/LocaleContext.jsx +50 -0
- package/dist/i18n/LocaleContext.jsx.map +1 -0
- package/dist/i18n/i18n.d.ts +12 -0
- package/dist/i18n/i18n.js +59 -0
- package/dist/i18n/i18n.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/query/Shortcut.d.ts +1 -0
- package/{src/query/Shortcut.ts → dist/query/Shortcut.js} +1 -0
- package/dist/query/Shortcut.js.map +1 -0
- package/dist/server/getServerRenderedHtml.d.ts +1 -0
- package/dist/server/getServerRenderedHtml.js +4 -0
- package/dist/server/getServerRenderedHtml.js.map +1 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +6 -0
- package/dist/server.js.map +1 -0
- package/{src/types/component.ts → dist/types/component.d.ts} +23 -62
- package/dist/types/component.js +2 -0
- package/dist/types/component.js.map +1 -0
- package/dist/types/componentProps.d.ts +107 -0
- package/dist/types/componentProps.js +2 -0
- package/dist/types/componentProps.js.map +1 -0
- package/dist/types/guillotine.d.ts +344 -0
- package/dist/types/guillotine.js +2 -0
- package/dist/types/guillotine.js.map +1 -0
- package/dist/types/i18n.d.ts +7 -0
- package/dist/types/i18n.js +2 -0
- package/dist/types/i18n.js.map +1 -0
- package/{src/types/index.ts → dist/types/index.d.ts} +19 -34
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/next.d.ts +6 -0
- package/dist/types/next.js +2 -0
- package/dist/types/next.js.map +1 -0
- package/dist/types/util.d.ts +3 -0
- package/dist/types/util.js +3 -0
- package/dist/types/util.js.map +1 -0
- package/dist/utils/addLineNumbers.d.ts +1 -0
- package/dist/utils/addLineNumbers.js +4 -0
- package/dist/utils/addLineNumbers.js.map +1 -0
- package/dist/utils/buildGuillotineRequestHeaders.d.ts +7 -0
- package/dist/utils/buildGuillotineRequestHeaders.js +16 -0
- package/dist/utils/buildGuillotineRequestHeaders.js.map +1 -0
- package/dist/utils/commonChars.d.ts +1 -0
- package/{src/utils/commonChars.ts → dist/utils/commonChars.js} +5 -4
- package/dist/utils/commonChars.js.map +1 -0
- package/dist/utils/enonicLog.d.ts +5 -0
- package/dist/utils/enonicLog.js +23 -0
- package/dist/utils/enonicLog.js.map +1 -0
- package/dist/utils/fixDoubleSlashes.d.ts +1 -0
- package/dist/utils/fixDoubleSlashes.js +4 -0
- package/dist/utils/fixDoubleSlashes.js.map +1 -0
- package/dist/utils/getAllLocales.d.ts +1 -0
- package/dist/utils/getAllLocales.js +5 -0
- package/dist/utils/getAllLocales.js.map +1 -0
- package/dist/utils/getContentApiUrl.d.ts +2 -0
- package/dist/utils/getContentApiUrl.js +15 -0
- package/dist/utils/getContentApiUrl.js.map +1 -0
- package/dist/utils/getLocaleMapping.d.ts +2 -0
- package/dist/utils/getLocaleMapping.js +19 -0
- package/dist/utils/getLocaleMapping.js.map +1 -0
- package/dist/utils/getLocaleMappingByLocale.d.ts +2 -0
- package/dist/utils/getLocaleMappingByLocale.js +13 -0
- package/dist/utils/getLocaleMappingByLocale.js.map +1 -0
- package/dist/utils/getLocaleMappingByProjectId.d.ts +2 -0
- package/dist/utils/getLocaleMappingByProjectId.js +16 -0
- package/dist/utils/getLocaleMappingByProjectId.js.map +1 -0
- package/dist/utils/getLocaleMappings.d.ts +2 -0
- package/{src/utils/getLocaleMappings.ts → dist/utils/getLocaleMappings.js} +8 -14
- package/dist/utils/getLocaleMappings.js.map +1 -0
- package/dist/utils/getRenderMode.d.ts +3 -0
- package/dist/utils/getRenderMode.js +8 -0
- package/dist/utils/getRenderMode.js.map +1 -0
- package/dist/utils/getRequestLocaleInfo.d.ts +6 -0
- package/{src/utils/getRequestLocaleInfo.ts → dist/utils/getRequestLocaleInfo.js} +12 -13
- package/dist/utils/getRequestLocaleInfo.js.map +1 -0
- package/dist/utils/getXpBaseUrl.d.ts +2 -0
- package/dist/utils/getXpBaseUrl.js +8 -0
- package/dist/utils/getXpBaseUrl.js.map +1 -0
- package/dist/utils/indent.d.ts +1 -0
- package/dist/utils/indent.js +5 -0
- package/dist/utils/indent.js.map +1 -0
- package/dist/utils/sanitizeGraphqlName.d.ts +1 -0
- package/{src/utils/sanitizeGraphqlName.ts → dist/utils/sanitizeGraphqlName.js} +3 -2
- package/dist/utils/sanitizeGraphqlName.js.map +1 -0
- package/dist/views/BaseComponent.d.ts +20 -0
- package/{src/views/BaseComponent.tsx → dist/views/BaseComponent.jsx} +49 -76
- package/dist/views/BaseComponent.jsx.map +1 -0
- package/dist/views/BaseContent.d.ts +3 -0
- package/dist/views/BaseContent.jsx +38 -0
- package/dist/views/BaseContent.jsx.map +1 -0
- package/dist/views/BaseLayout.d.ts +3 -0
- package/dist/views/BaseLayout.jsx +24 -0
- package/dist/views/BaseLayout.jsx.map +1 -0
- package/dist/views/BaseMacro.d.ts +6 -0
- package/{src/views/BaseMacro.tsx → dist/views/BaseMacro.jsx} +37 -42
- package/dist/views/BaseMacro.jsx.map +1 -0
- package/dist/views/BasePage.d.ts +3 -0
- package/dist/views/BasePage.jsx +34 -0
- package/dist/views/BasePage.jsx.map +1 -0
- package/dist/views/BasePart.d.ts +3 -0
- package/dist/views/BasePart.jsx +24 -0
- package/dist/views/BasePart.jsx.map +1 -0
- package/dist/views/Empty.d.ts +2 -0
- package/{src/views/Empty.tsx → dist/views/Empty.jsx} +1 -2
- package/dist/views/Empty.jsx.map +1 -0
- package/dist/views/Fragment.d.ts +3 -0
- package/dist/views/Fragment.jsx +30 -0
- package/dist/views/Fragment.jsx.map +1 -0
- package/dist/views/MainView.d.ts +3 -0
- package/dist/views/MainView.jsx +14 -0
- package/dist/views/MainView.jsx.map +1 -0
- package/dist/views/PropsView.d.ts +2 -0
- package/dist/views/PropsView.jsx +21 -0
- package/dist/views/PropsView.jsx.map +1 -0
- package/dist/views/Region.d.ts +6 -0
- package/{src/views/Region.tsx → dist/views/Region.jsx} +17 -41
- package/dist/views/Region.jsx.map +1 -0
- package/dist/views/RichTextView.d.ts +3 -0
- package/dist/views/RichTextView.jsx +65 -0
- package/dist/views/RichTextView.jsx.map +1 -0
- package/dist/views/SingleComponent.d.ts +4 -0
- package/dist/views/SingleComponent.jsx +10 -0
- package/dist/views/SingleComponent.jsx.map +1 -0
- package/dist/views/StaticContent.d.ts +10 -0
- package/dist/views/StaticContent.jsx +37 -0
- package/dist/views/StaticContent.jsx.map +1 -0
- package/dist/views/Text.d.ts +8 -0
- package/dist/views/Text.jsx +4 -0
- package/dist/views/Text.jsx.map +1 -0
- package/dist/views/macros/DefaultMacro.d.ts +3 -0
- package/dist/views/macros/DefaultMacro.jsx +4 -0
- package/dist/views/macros/DefaultMacro.jsx.map +1 -0
- package/dist/views/macros/DisableMacro.d.ts +3 -0
- package/dist/views/macros/DisableMacro.jsx +3 -0
- package/dist/views/macros/DisableMacro.jsx.map +1 -0
- package/package.json +20 -32
- package/src/client.ts +0 -2
- package/src/common/ComponentRegistry.ts +0 -159
- package/src/guillotine/applyProcessors.ts +0 -34
- package/src/guillotine/buildPage.ts +0 -15
- package/src/guillotine/createMetaData.ts +0 -72
- package/src/guillotine/fetchContent.ts +0 -240
- package/src/guillotine/fetchContentData.ts +0 -31
- package/src/guillotine/fetchContentPathsForAllLocales.ts +0 -21
- package/src/guillotine/fetchContentPathsForLocale.ts +0 -43
- package/src/guillotine/fetchFromApi.ts +0 -76
- package/src/guillotine/fetchGuillotine.ts +0 -76
- package/src/guillotine/fetchMetaData.ts +0 -31
- package/src/guillotine/metadata/configQuery.ts +0 -46
- package/src/guillotine/validateData.ts +0 -11
- package/src/i18n/LocaleContext.tsx +0 -59
- package/src/i18n/i18n.ts +0 -57
- package/src/index.ts +0 -42
- package/src/server/getServerRenderedHtml.ts +0 -3
- package/src/server.ts +0 -5
- package/src/types/componentProps.ts +0 -143
- package/src/types/guillotine.ts +0 -428
- package/src/types/i18n.ts +0 -8
- package/src/types/next.ts +0 -7
- package/src/types/util.ts +0 -5
- package/src/utils/addLineNumbers.ts +0 -3
- package/src/utils/buildGuillotineRequestHeaders.ts +0 -29
- package/src/utils/enonicLog.ts +0 -28
- package/src/utils/fixDoubleSlashes.ts +0 -3
- package/src/utils/getAllLocales.ts +0 -6
- package/src/utils/getContentApiUrl.ts +0 -20
- package/src/utils/getLocaleMapping.ts +0 -24
- package/src/utils/getLocaleMappingByLocale.ts +0 -19
- package/src/utils/getLocaleMappingByProjectId.ts +0 -21
- package/src/utils/getRenderMode.ts +0 -11
- package/src/utils/getXpBaseUrl.ts +0 -12
- package/src/utils/indent.ts +0 -4
- package/src/views/BaseContent.tsx +0 -47
- package/src/views/BaseLayout.tsx +0 -33
- package/src/views/BasePage.tsx +0 -42
- package/src/views/BasePart.tsx +0 -34
- package/src/views/Fragment.tsx +0 -41
- package/src/views/MainView.tsx +0 -22
- package/src/views/PropsView.tsx +0 -38
- package/src/views/RichTextView.tsx +0 -106
- package/src/views/SingleComponent.tsx +0 -19
- package/src/views/StaticContent.tsx +0 -39
- package/src/views/Text.tsx +0 -19
- package/src/views/macros/DefaultMacro.tsx +0 -9
- package/src/views/macros/DisableMacro.tsx +0 -8
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type {ContentApiBaseBody, ContentApiBaseBodyVariables, ContentResult, LocaleMapping, GuillotineRequestHeaders} from '../types';
|
|
2
|
-
|
|
3
|
-
import {fetchGuillotine} from './fetchGuillotine';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const fetchContentData = async <Content = Record<string, unknown>>(
|
|
7
|
-
contentApiUrl: string,
|
|
8
|
-
xpContentPath: string,
|
|
9
|
-
mapping: LocaleMapping,
|
|
10
|
-
query: string,
|
|
11
|
-
variables?: ContentApiBaseBodyVariables,
|
|
12
|
-
headers?: GuillotineRequestHeaders
|
|
13
|
-
): Promise<ContentResult> => {
|
|
14
|
-
const body: ContentApiBaseBody = {query};
|
|
15
|
-
if (variables && Object.keys(variables).length > 0) {
|
|
16
|
-
body.variables = variables;
|
|
17
|
-
}
|
|
18
|
-
const contentResults = await fetchGuillotine<ContentResult<Content>>(contentApiUrl, mapping, {
|
|
19
|
-
body,
|
|
20
|
-
headers
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
if (contentResults.error) {
|
|
24
|
-
return contentResults;
|
|
25
|
-
} else {
|
|
26
|
-
return {
|
|
27
|
-
// omit the aliases and return values
|
|
28
|
-
contents: Object.values(contentResults)
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type {ContentPathItem} from '../types';
|
|
2
|
-
|
|
3
|
-
import {GET_STATIC_PATHS_QUERY} from '../common/constants';
|
|
4
|
-
import {getLocaleMappings} from '../utils/getLocaleMappings';
|
|
5
|
-
import {fetchContentPathsForLocale} from './fetchContentPathsForLocale';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export async function fetchContentPathsForAllLocales(
|
|
9
|
-
path: string,
|
|
10
|
-
query: string = GET_STATIC_PATHS_QUERY,
|
|
11
|
-
countPerLocale = 999
|
|
12
|
-
): Promise<ContentPathItem[]> {
|
|
13
|
-
const promises = Object.values(getLocaleMappings()).map(
|
|
14
|
-
config => fetchContentPathsForLocale(
|
|
15
|
-
path, config, query, countPerLocale
|
|
16
|
-
)
|
|
17
|
-
);
|
|
18
|
-
return Promise.all(promises).then(results => {
|
|
19
|
-
return results.reduce((all, localePaths) => all.concat(localePaths), []);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type {ContentApiBaseBody, ContentPathItem, GuillotineResult, LocaleMapping} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {GET_STATIC_PATHS_QUERY} from '../common/constants';
|
|
5
|
-
import {getContentApiUrl} from '../utils/getContentApiUrl';
|
|
6
|
-
import {fetchGuillotine} from './fetchGuillotine';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export async function fetchContentPathsForLocale(
|
|
10
|
-
path: string,
|
|
11
|
-
config: LocaleMapping,
|
|
12
|
-
query: string = GET_STATIC_PATHS_QUERY,
|
|
13
|
-
count = 999
|
|
14
|
-
): Promise<ContentPathItem[]> {
|
|
15
|
-
const contentApiUrl = getContentApiUrl({
|
|
16
|
-
contentPath: path,
|
|
17
|
-
locale: config.locale
|
|
18
|
-
});
|
|
19
|
-
const body: ContentApiBaseBody = {
|
|
20
|
-
query,
|
|
21
|
-
variables: {
|
|
22
|
-
path,
|
|
23
|
-
pathRegex: `/content${config.site}/*`,
|
|
24
|
-
count
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
return fetchGuillotine<ContentPathItem[]>(contentApiUrl, config, {body}).then((
|
|
28
|
-
results: GuillotineResult
|
|
29
|
-
) => {
|
|
30
|
-
return results.guillotine.queryDsl.reduce((
|
|
31
|
-
prev: ContentPathItem[],
|
|
32
|
-
child: any
|
|
33
|
-
) => {
|
|
34
|
-
const regexp = new RegExp(`^/${child.site?._name ? `${child.site._name}/?` : ''}`);
|
|
35
|
-
const contentPath = child._path.replace(regexp, '');
|
|
36
|
-
prev.push({
|
|
37
|
-
contentPath: contentPath.split('/'),
|
|
38
|
-
locale: config.locale
|
|
39
|
-
});
|
|
40
|
-
return prev;
|
|
41
|
-
}, []);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type {FetchOptions, GuillotineResponse, GuillotineResponseJson, LocaleMapping} from '../types';
|
|
2
|
-
|
|
3
|
-
/** Generic fetch */
|
|
4
|
-
export async function fetchFromApi<Data = Record<string, unknown>>(
|
|
5
|
-
apiUrl: string,
|
|
6
|
-
mapping: LocaleMapping,
|
|
7
|
-
options?: FetchOptions
|
|
8
|
-
): Promise<GuillotineResponseJson> {
|
|
9
|
-
|
|
10
|
-
const opts = {
|
|
11
|
-
method: options?.method || 'POST',
|
|
12
|
-
body: options?.body ? JSON.stringify(options?.body) : null,
|
|
13
|
-
headers: mergeHeaders(mapping, options?.headers),
|
|
14
|
-
next: options?.next,
|
|
15
|
-
cache: options?.cache
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
let res: GuillotineResponse<Data>;
|
|
19
|
-
try {
|
|
20
|
-
res = await fetch(apiUrl, opts as RequestInit);
|
|
21
|
-
} catch (e: any) {
|
|
22
|
-
console.warn(apiUrl, e);
|
|
23
|
-
throw new Error(JSON.stringify({
|
|
24
|
-
code: 'API',
|
|
25
|
-
message: e.message
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!res.ok) {
|
|
30
|
-
throw new Error(JSON.stringify({
|
|
31
|
-
code: res.status,
|
|
32
|
-
message: `Data fetching failed (message: '${await res.text()}')`
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let json: GuillotineResponseJson<Data>;
|
|
37
|
-
try {
|
|
38
|
-
json = await res.json();
|
|
39
|
-
} catch (e) {
|
|
40
|
-
throw new Error(JSON.stringify({
|
|
41
|
-
code: 500,
|
|
42
|
-
message: `API call completed but with non-JSON data: ${JSON.stringify(await res.text())}`
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!json) {
|
|
47
|
-
throw new Error(JSON.stringify({
|
|
48
|
-
code: 500,
|
|
49
|
-
message: `API call completed but with unexpectedly empty data: ${JSON.stringify(await res.text())}`
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (Array.isArray(json)) {
|
|
54
|
-
throw new Error(JSON.stringify({
|
|
55
|
-
code: 500,
|
|
56
|
-
message: `API call completed but with unexpected array data: ${JSON.stringify(json)}`
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return json;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function mergeHeaders(mapping: LocaleMapping, headers?: HeadersInit): Headers {
|
|
64
|
-
const newHeaders = new Headers({
|
|
65
|
-
'Accept': 'application/json',
|
|
66
|
-
'Content-Type': 'application/json'
|
|
67
|
-
});
|
|
68
|
-
if (headers) {
|
|
69
|
-
Object.keys(headers).forEach((headersKey) => {
|
|
70
|
-
newHeaders.set(headersKey, headers[headersKey]);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
// append last to make sure it is not overwritten
|
|
74
|
-
newHeaders.set('X-Guillotine-SiteKey', mapping.site);
|
|
75
|
-
return newHeaders;
|
|
76
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type {FetchOptions, GuillotineResult, LocaleMapping} from '../types';
|
|
2
|
-
import gqlmin from 'gqlmin';
|
|
3
|
-
|
|
4
|
-
import {fetchFromApi} from './fetchFromApi';
|
|
5
|
-
|
|
6
|
-
const XP_ERROR_PATTERN = '/_/error/';
|
|
7
|
-
|
|
8
|
-
/** Guillotine-specialized fetch, using the generic fetch above */
|
|
9
|
-
export async function fetchGuillotine<Data = Record<string, unknown>>(
|
|
10
|
-
contentApiUrl: string,
|
|
11
|
-
mapping: LocaleMapping,
|
|
12
|
-
options?: FetchOptions
|
|
13
|
-
): Promise<GuillotineResult> {
|
|
14
|
-
const body = options?.body;
|
|
15
|
-
const path = body?.variables?.path;
|
|
16
|
-
|
|
17
|
-
if (typeof body.query !== 'string' || !body.query.trim()) {
|
|
18
|
-
return {
|
|
19
|
-
error: {
|
|
20
|
-
code: '400',
|
|
21
|
-
message: `Invalid or missing query. JSON.stringify(query) = ${JSON.stringify(body.query)}`
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
} else {
|
|
25
|
-
// special case for not sending XP generated error paths to guillotine
|
|
26
|
-
const pathArr = path?.split(XP_ERROR_PATTERN);
|
|
27
|
-
if (pathArr?.length === 2) {
|
|
28
|
-
return {
|
|
29
|
-
error: {
|
|
30
|
-
code: pathArr[1],
|
|
31
|
-
message: `XP error URL detected`
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
// Minify the query to avoid hitting 200k space limit
|
|
36
|
-
body.query = gqlmin(body.query);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const pathMessage = path ? JSON.stringify(path) : '';
|
|
41
|
-
return await fetchFromApi<Data>(
|
|
42
|
-
contentApiUrl,
|
|
43
|
-
mapping,
|
|
44
|
-
options
|
|
45
|
-
)
|
|
46
|
-
.then(json => {
|
|
47
|
-
let errors: any[] = json.errors; // fetchFromApi ensures json is an object
|
|
48
|
-
|
|
49
|
-
if (errors) {
|
|
50
|
-
if (!Array.isArray(errors)) {
|
|
51
|
-
errors = [errors];
|
|
52
|
-
}
|
|
53
|
-
console.error(`${errors.length} error(s) when fetching data from: ${contentApiUrl}`);
|
|
54
|
-
errors.forEach(error => {
|
|
55
|
-
console.error(error);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
error: {
|
|
60
|
-
code: '500',
|
|
61
|
-
message: `Server responded with ${errors.length} error(s), probably from guillotine - see log.`
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return json.data;
|
|
67
|
-
})
|
|
68
|
-
.catch((err) => {
|
|
69
|
-
console.warn(`Client-side error when trying to fetch data ${pathMessage}`, err);
|
|
70
|
-
try {
|
|
71
|
-
return {error: JSON.parse(err.message)};
|
|
72
|
-
} catch (e2) {
|
|
73
|
-
return {error: {code: 'Client-side error', message: err.message}};
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type {ContentApiBaseBody, MetaResult, LocaleMapping, GuillotineRequestHeaders} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {getMetaQuery, pageFragmentQuery} from './getMetaData';
|
|
5
|
-
import {fetchGuillotine} from './fetchGuillotine';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const fetchMetaData = async (
|
|
9
|
-
contentApiUrl: string,
|
|
10
|
-
xpContentPath: string,
|
|
11
|
-
mapping: LocaleMapping,
|
|
12
|
-
headers?: GuillotineRequestHeaders
|
|
13
|
-
): Promise<MetaResult> => {
|
|
14
|
-
const body: ContentApiBaseBody = {
|
|
15
|
-
query: getMetaQuery(pageFragmentQuery()),
|
|
16
|
-
variables: {
|
|
17
|
-
path: xpContentPath
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const metaResult = await fetchGuillotine<MetaResult>(contentApiUrl, mapping, {
|
|
21
|
-
body,
|
|
22
|
-
headers
|
|
23
|
-
});
|
|
24
|
-
if (metaResult.error) {
|
|
25
|
-
return metaResult;
|
|
26
|
-
} else {
|
|
27
|
-
return {
|
|
28
|
-
meta: metaResult?.guillotine?.get
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type {ComponentDefinition} from '../../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {sanitizeGraphqlName} from '../../utils/sanitizeGraphqlName';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const configQuery = (
|
|
8
|
-
list: [string, ComponentDefinition][],
|
|
9
|
-
includeAppName = true,
|
|
10
|
-
canUseConfigAsJson = true
|
|
11
|
-
): string => {
|
|
12
|
-
const hasQueryList = list?.filter(([key, def]) => def.configQuery) || [];
|
|
13
|
-
if (hasQueryList.length === 0) {
|
|
14
|
-
return canUseConfigAsJson ? 'configAsJson' : '';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const configsByApp: Record<string,string[]> = {};
|
|
18
|
-
hasQueryList
|
|
19
|
-
.forEach((entry) => {
|
|
20
|
-
const nameParts = entry[0].split(':');
|
|
21
|
-
if (nameParts.length === 2) {
|
|
22
|
-
const sanitizedAppName = sanitizeGraphqlName(nameParts[0]);
|
|
23
|
-
let existingConfigs = configsByApp[sanitizedAppName];
|
|
24
|
-
if (!existingConfigs) {
|
|
25
|
-
existingConfigs = [];
|
|
26
|
-
configsByApp[sanitizedAppName] = existingConfigs;
|
|
27
|
-
}
|
|
28
|
-
existingConfigs.push(`${sanitizeGraphqlName(nameParts[1])}${entry[1].configQuery}`);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// Still query for configAsJson if at least one item has no configQuery defined
|
|
33
|
-
const configAsJsonQuery = canUseConfigAsJson && hasQueryList.length < list.length ? 'configAsJson' : '';
|
|
34
|
-
|
|
35
|
-
if (!includeAppName) {
|
|
36
|
-
return `${configAsJsonQuery}
|
|
37
|
-
config {
|
|
38
|
-
${Object.values(configsByApp).reduce((arr, curr) => arr.concat(curr), []).join('\n')}
|
|
39
|
-
}`;
|
|
40
|
-
} else {
|
|
41
|
-
return `${configAsJsonQuery}
|
|
42
|
-
config {
|
|
43
|
-
${Object.entries(configsByApp).map(entry => entry[0] + '{\n' + entry[1].join('\n') + '\n}')}
|
|
44
|
-
}`;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type {FetchContentResult} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {validateNotFound} from './validateNotFound';
|
|
5
|
-
import {validateShortcut} from './validateShortcut';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export function validateData(props: FetchContentResult): void {
|
|
9
|
-
validateNotFound(props);
|
|
10
|
-
validateShortcut(props);
|
|
11
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import type {Dict, LocaleContextType} from '../types';
|
|
3
|
-
|
|
4
|
-
import React, {createContext, useContext, useEffect, useState} from 'react';
|
|
5
|
-
import {getPhrase, loadPhrases} from './i18n';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const LocaleContext = createContext<LocaleContextType>({
|
|
9
|
-
dictionary: {},
|
|
10
|
-
locale: '',
|
|
11
|
-
localize: (key: string, ...args: any[]) => key,
|
|
12
|
-
setLocale: (locale: string) => Promise.resolve({})
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const useLocaleContext = () => useContext(LocaleContext);
|
|
16
|
-
|
|
17
|
-
export const LocaleContextProvider = ({
|
|
18
|
-
children,
|
|
19
|
-
locale: localeProps = ''
|
|
20
|
-
}: {
|
|
21
|
-
children: any
|
|
22
|
-
locale?: string
|
|
23
|
-
}) => {
|
|
24
|
-
const [currentLocale, setLocaleState] = useState(localeProps);
|
|
25
|
-
const [dictionary, setPhrasesState] = useState<Dict>({});
|
|
26
|
-
const [isLoaded, setLoadedState] = useState(false);
|
|
27
|
-
|
|
28
|
-
const setLocale = async (locale: string): Promise<Dict> => {
|
|
29
|
-
setLocaleState(locale);
|
|
30
|
-
setLoadedState(false);
|
|
31
|
-
|
|
32
|
-
return loadPhrases(locale).then((phrases) => {
|
|
33
|
-
setPhrasesState(phrases);
|
|
34
|
-
setLoadedState(true);
|
|
35
|
-
return phrases;
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (localeProps) {
|
|
41
|
-
void setLocale(localeProps); // void to avoid @typescript-eslint/no-floating-promises
|
|
42
|
-
}
|
|
43
|
-
}, []);
|
|
44
|
-
|
|
45
|
-
const localize = (key: string, ...args: any[]) => {
|
|
46
|
-
return isLoaded ? getPhrase(currentLocale, dictionary, key, ...args) : key;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<LocaleContext.Provider value={{
|
|
51
|
-
setLocale,
|
|
52
|
-
locale: currentLocale,
|
|
53
|
-
dictionary,
|
|
54
|
-
localize
|
|
55
|
-
}}>
|
|
56
|
-
{children}
|
|
57
|
-
</LocaleContext.Provider>
|
|
58
|
-
);
|
|
59
|
-
};
|
package/src/i18n/i18n.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type {Dict} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class I18n {
|
|
5
|
-
private static locale = '';
|
|
6
|
-
private static dictionary: Dict = {};
|
|
7
|
-
private static isLoaded = false;
|
|
8
|
-
|
|
9
|
-
public static async setLocale(locale: string): Promise<Dict> {
|
|
10
|
-
this.locale = locale;
|
|
11
|
-
this.isLoaded = false;
|
|
12
|
-
|
|
13
|
-
return loadPhrases(locale).then((phrases) => {
|
|
14
|
-
this.dictionary = phrases;
|
|
15
|
-
this.isLoaded = true;
|
|
16
|
-
return phrases;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public static localize(key: string, ...args: any[]): string {
|
|
21
|
-
return this.isLoaded ? getPhrase(this.locale, this.dictionary, key, ...args) : key;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public static getLocale() {
|
|
25
|
-
return this.locale;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public static getDictionary() {
|
|
29
|
-
return this.dictionary;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const loadPhrases = async (locale: string): Promise<Dict> => {
|
|
34
|
-
return import(`@phrases/${locale}.json`)
|
|
35
|
-
.then((module) => module.default)
|
|
36
|
-
.catch((e) => {
|
|
37
|
-
console.error(`Failed to load phrases for locale "${locale}"`, e);
|
|
38
|
-
return {};
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const getPhrase = (locale: string, dict: Dict, key: string, ...args: any[]) => {
|
|
43
|
-
const template = dict[key];
|
|
44
|
-
if (!template) {
|
|
45
|
-
console.warn(`Missing localization phrase for locale "${locale}": <${key}>`);
|
|
46
|
-
return `<${key}>`;
|
|
47
|
-
}
|
|
48
|
-
if (args.length) {
|
|
49
|
-
let index = -1;
|
|
50
|
-
return template.replace(/{(\d+)?}/g, (match, digit) => {
|
|
51
|
-
index++;
|
|
52
|
-
return args[digit || index] ?? match;
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return template;
|
|
56
|
-
};
|
|
57
|
-
|
package/src/index.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
APP_NAME,
|
|
3
|
-
APP_NAME_DASHED,
|
|
4
|
-
APP_NAME_UNDERSCORED,
|
|
5
|
-
IS_DEV_MODE
|
|
6
|
-
} from './common/env';
|
|
7
|
-
|
|
8
|
-
export type * from './types';
|
|
9
|
-
|
|
10
|
-
export {ComponentRegistry} from './common/ComponentRegistry';
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
CATCH_ALL,
|
|
14
|
-
JSESSIONID_HEADER,
|
|
15
|
-
PORTAL_COMPONENT_ATTRIBUTE,
|
|
16
|
-
PORTAL_REGION_ATTRIBUTE,
|
|
17
|
-
PROJECT_ID_HEADER,
|
|
18
|
-
RENDER_MODE,
|
|
19
|
-
RENDER_MODE_HEADER,
|
|
20
|
-
XP_BASE_URL_HEADER,
|
|
21
|
-
XP_COMPONENT_TYPE,
|
|
22
|
-
XP_REQUEST_TYPE
|
|
23
|
-
} from './common/constants';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export {richTextQuery} from './guillotine/metadata/richTextQuery';
|
|
27
|
-
export {validateData} from './guillotine/validateData';
|
|
28
|
-
|
|
29
|
-
export {I18n} from './i18n/i18n';
|
|
30
|
-
|
|
31
|
-
export {getContentApiUrl} from './utils/getContentApiUrl';
|
|
32
|
-
export {getLocaleMapping} from './utils/getLocaleMapping';
|
|
33
|
-
export {getLocaleMappingByProjectId} from './utils/getLocaleMappingByProjectId';
|
|
34
|
-
export {getLocaleMappingByLocale} from './utils/getLocaleMappingByLocale';
|
|
35
|
-
export {getRequestLocaleInfo} from './utils/getRequestLocaleInfo';
|
|
36
|
-
export {sanitizeGraphqlName} from './utils/sanitizeGraphqlName';
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
UrlProcessor,
|
|
40
|
-
getAsset,
|
|
41
|
-
getUrl
|
|
42
|
-
} from './common/UrlProcessor';
|
package/src/server.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export {fetchContent} from './guillotine/fetchContent';
|
|
2
|
-
export {fetchContentPathsForAllLocales} from './guillotine/fetchContentPathsForAllLocales';
|
|
3
|
-
export {fetchContentPathsForLocale} from './guillotine/fetchContentPathsForLocale';
|
|
4
|
-
export {fetchFromApi} from './guillotine/fetchFromApi';
|
|
5
|
-
export {fetchGuillotine} from './guillotine/fetchGuillotine';
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import {DOMNode} from 'html-react-parser';
|
|
2
|
-
import type {RENDER_MODE, XP_REQUEST_TYPE} from '../common/constants';
|
|
3
|
-
import type {
|
|
4
|
-
FragmentData,
|
|
5
|
-
LayoutData,
|
|
6
|
-
MacroConfig,
|
|
7
|
-
MacroData,
|
|
8
|
-
PageComponent,
|
|
9
|
-
PageData,
|
|
10
|
-
PartData,
|
|
11
|
-
RichTextData,
|
|
12
|
-
RegionTree
|
|
13
|
-
} from './component';
|
|
14
|
-
import type {ReactNode} from 'react';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export interface BaseComponentProps {
|
|
18
|
-
component: PageComponent;
|
|
19
|
-
meta: MetaData;
|
|
20
|
-
common?: any; // Content is passed down for optional consumption in componentviews.
|
|
21
|
-
// TODO: Use a react contextprovider instead of "manually" passing everything down
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface BaseLayoutProps {
|
|
25
|
-
component?: LayoutData;
|
|
26
|
-
path: string;
|
|
27
|
-
regions?: RegionTree;
|
|
28
|
-
common?: any;
|
|
29
|
-
meta: MetaData;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface BaseMacroProps {
|
|
33
|
-
children: ReactNode;
|
|
34
|
-
data: Omit<MacroData, 'ref'>;
|
|
35
|
-
meta: MetaData;
|
|
36
|
-
renderInEditMode?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface BasePageProps {
|
|
40
|
-
component?: PageData;
|
|
41
|
-
path?: string;
|
|
42
|
-
common?: any;
|
|
43
|
-
data?: any;
|
|
44
|
-
error?: string;
|
|
45
|
-
meta: MetaData;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface BasePartProps {
|
|
49
|
-
component?: PartData;
|
|
50
|
-
path: string;
|
|
51
|
-
common?: any;
|
|
52
|
-
data?: any;
|
|
53
|
-
error?: string;
|
|
54
|
-
meta: MetaData;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface FragmentProps {
|
|
58
|
-
page?: PageData;
|
|
59
|
-
component?: FragmentData;
|
|
60
|
-
common?: any;
|
|
61
|
-
meta: MetaData;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface LayoutProps {
|
|
65
|
-
layout: LayoutData;
|
|
66
|
-
path: string;
|
|
67
|
-
common: any;
|
|
68
|
-
meta: MetaData;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface MacroProps {
|
|
72
|
-
name: string;
|
|
73
|
-
children: string | React.ReactNode;
|
|
74
|
-
config: MacroConfig;
|
|
75
|
-
meta: MetaData;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface MetaData {
|
|
79
|
-
id: string,
|
|
80
|
-
type: string,
|
|
81
|
-
path: string,
|
|
82
|
-
requestType: XP_REQUEST_TYPE,
|
|
83
|
-
renderMode: RENDER_MODE,
|
|
84
|
-
requestedComponent?: PageComponent,
|
|
85
|
-
canRender: boolean,
|
|
86
|
-
catchAll: boolean,
|
|
87
|
-
apiUrl: string,
|
|
88
|
-
baseUrl: string,
|
|
89
|
-
locale: string,
|
|
90
|
-
defaultLocale: string
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface PageProps {
|
|
94
|
-
page: PageData;
|
|
95
|
-
path: string;
|
|
96
|
-
data?: any;
|
|
97
|
-
common?: any; // Content is passed down to componentviews. TODO: Use a react contextprovider instead?
|
|
98
|
-
meta: MetaData;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface PartProps {
|
|
102
|
-
part: PartData
|
|
103
|
-
path: string
|
|
104
|
-
data?: any
|
|
105
|
-
// Content is passed down to componentviews. TODO: Use a react contextprovider instead?
|
|
106
|
-
common?: any
|
|
107
|
-
meta: MetaData
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export interface RegionProps {
|
|
111
|
-
name: string
|
|
112
|
-
components?: PageComponent[]
|
|
113
|
-
className?: string
|
|
114
|
-
// Content is passed down for optional consumption in componentviews. TODO: Use a react contextprovider instead?
|
|
115
|
-
common?: any
|
|
116
|
-
meta: MetaData
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface RegionsProps {
|
|
120
|
-
page: PageData | null;
|
|
121
|
-
name?: string;
|
|
122
|
-
// Content is passed down for optional consumption in componentviews. TODO: Use a react contextprovider instead?
|
|
123
|
-
common?: any;
|
|
124
|
-
meta: MetaData;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export type Replacer = (
|
|
128
|
-
domNode: DOMNode,
|
|
129
|
-
data: RichTextData,
|
|
130
|
-
meta: MetaData,
|
|
131
|
-
renderMacroInEditMode: boolean
|
|
132
|
-
) => ReplacerResult;
|
|
133
|
-
|
|
134
|
-
export type ReplacerResult = JSX.Element | DOMNode;
|
|
135
|
-
|
|
136
|
-
export interface RichTextViewProps {
|
|
137
|
-
data: RichTextData
|
|
138
|
-
meta: MetaData
|
|
139
|
-
className?: string
|
|
140
|
-
tag?: string
|
|
141
|
-
renderMacroInEditMode?: boolean
|
|
142
|
-
customReplacer?: Replacer
|
|
143
|
-
}
|