@enonic/nextjs-adapter 3.3.0-B1 → 3.3.0-B2
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 +41 -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} +5 -7
- 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 +19 -31
- 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
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import type { PublishInfo } from '@enonic-types/core';
|
|
2
|
+
import type { PageComponent, PageData } from './component';
|
|
3
|
+
import type { MetaData } from './componentProps';
|
|
4
|
+
import type { Context } from './next';
|
|
5
|
+
import type { RecursivePartial } from './util';
|
|
6
|
+
export interface GuillotineError {
|
|
7
|
+
errorType: string;
|
|
8
|
+
locations: {
|
|
9
|
+
line: number;
|
|
10
|
+
column: number;
|
|
11
|
+
}[];
|
|
12
|
+
message: string;
|
|
13
|
+
validationErrorType?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface GuillotineResponseJson<Guillotine = RecursivePartial<HeadlessCms>> {
|
|
16
|
+
data?: Record<string, Guillotine>;
|
|
17
|
+
errors?: GuillotineError[];
|
|
18
|
+
}
|
|
19
|
+
export interface GuillotineResponse<Data = Record<string, unknown>> {
|
|
20
|
+
json: () => Promise<GuillotineResponseJson<Data>>;
|
|
21
|
+
text: () => Promise<string>;
|
|
22
|
+
ok: boolean;
|
|
23
|
+
status: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sends one query to the guillotine API and asks for content type, then uses the type to select a second query and variables, which is sent to the API and fetches content data.
|
|
27
|
+
* @param contentPath string or string array: pre-split or slash-delimited _path to a content available on the API
|
|
28
|
+
* @returns FetchContentResult object: {data?: T, error?: {code, message}}
|
|
29
|
+
*/
|
|
30
|
+
export type ContentFetcher = (context: Context) => Promise<FetchContentResult>;
|
|
31
|
+
export interface ContentResult<Content = Record<string, unknown>> extends Result {
|
|
32
|
+
contents?: Content[];
|
|
33
|
+
}
|
|
34
|
+
export interface FetchContentResult extends Result {
|
|
35
|
+
data: Record<string, any> | null;
|
|
36
|
+
common: Record<string, any> | null;
|
|
37
|
+
meta: MetaData;
|
|
38
|
+
page: PageComponent | null;
|
|
39
|
+
}
|
|
40
|
+
export interface GuillotineRequestHeaders {
|
|
41
|
+
[key: string]: string | undefined;
|
|
42
|
+
Cookie?: string;
|
|
43
|
+
locale: string;
|
|
44
|
+
locales: string;
|
|
45
|
+
'default-locale': string;
|
|
46
|
+
}
|
|
47
|
+
export type GuillotineResult = Result & Record<string, any>;
|
|
48
|
+
export interface MetaResult extends Result {
|
|
49
|
+
meta?: {
|
|
50
|
+
_id: string;
|
|
51
|
+
_path: string;
|
|
52
|
+
type: string;
|
|
53
|
+
pageAsJson?: PageData;
|
|
54
|
+
components?: PageComponent[];
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export interface Result {
|
|
58
|
+
error?: {
|
|
59
|
+
code: string;
|
|
60
|
+
message: string;
|
|
61
|
+
} | null;
|
|
62
|
+
}
|
|
63
|
+
interface AccessControlEntry {
|
|
64
|
+
principal: PrincipalKey;
|
|
65
|
+
allow: [Permission];
|
|
66
|
+
deny: [Permission];
|
|
67
|
+
}
|
|
68
|
+
interface Attachment {
|
|
69
|
+
name: string;
|
|
70
|
+
label: string;
|
|
71
|
+
size: number;
|
|
72
|
+
mimeType: string;
|
|
73
|
+
attachmentUrl: string;
|
|
74
|
+
}
|
|
75
|
+
type DateTime = string;
|
|
76
|
+
export interface Component {
|
|
77
|
+
type: ComponentType;
|
|
78
|
+
path: string;
|
|
79
|
+
page?: PageComponentData | null;
|
|
80
|
+
layout?: LayoutComponentData | null;
|
|
81
|
+
image?: ImageComponentData | null;
|
|
82
|
+
part?: PartComponentData | null;
|
|
83
|
+
text?: TextComponentData | null;
|
|
84
|
+
fragment?: FragmentComponentData | null;
|
|
85
|
+
}
|
|
86
|
+
type ComponentType = 'page' | 'layout' | 'image' | 'part' | 'text' | 'fragment';
|
|
87
|
+
interface Content {
|
|
88
|
+
_id: string;
|
|
89
|
+
_name: string;
|
|
90
|
+
_path: string;
|
|
91
|
+
_references?: Content[];
|
|
92
|
+
_score?: number;
|
|
93
|
+
creator?: PrincipalKey;
|
|
94
|
+
modifier?: PrincipalKey;
|
|
95
|
+
createdTime?: DateTime;
|
|
96
|
+
modifiedTime?: DateTime;
|
|
97
|
+
owner?: PrincipalKey;
|
|
98
|
+
type?: string;
|
|
99
|
+
contentType?: ContentType;
|
|
100
|
+
displayName?: string;
|
|
101
|
+
hasChildren?: boolean;
|
|
102
|
+
language?: string;
|
|
103
|
+
valid?: boolean;
|
|
104
|
+
dataAsJson?: JSON;
|
|
105
|
+
x?: ExtraData;
|
|
106
|
+
xAsJson?: JSON;
|
|
107
|
+
pageAsJson?: JSON;
|
|
108
|
+
pageTemplate?: Content;
|
|
109
|
+
components?: Component[];
|
|
110
|
+
attachments?: Attachment[];
|
|
111
|
+
publish?: PublishInfo;
|
|
112
|
+
pageUrl?: string;
|
|
113
|
+
site?: portal_Site;
|
|
114
|
+
parent?: Content;
|
|
115
|
+
children?: Content[];
|
|
116
|
+
childrenConnection?: ContentConnection;
|
|
117
|
+
permissions?: Permissions;
|
|
118
|
+
}
|
|
119
|
+
interface ContentConnection {
|
|
120
|
+
totalCount: Int;
|
|
121
|
+
edges: ContentEdge[];
|
|
122
|
+
pageInfo: PageInfo;
|
|
123
|
+
}
|
|
124
|
+
interface ContentEdge {
|
|
125
|
+
node: Content;
|
|
126
|
+
cursor: string;
|
|
127
|
+
}
|
|
128
|
+
interface ContentType {
|
|
129
|
+
name: string;
|
|
130
|
+
displayName: string;
|
|
131
|
+
description: string;
|
|
132
|
+
superType: string;
|
|
133
|
+
abstract: boolean;
|
|
134
|
+
final: boolean;
|
|
135
|
+
allowChildContent: boolean;
|
|
136
|
+
contentDisplayNameScript: string;
|
|
137
|
+
icon: Icon;
|
|
138
|
+
form: FormItem[];
|
|
139
|
+
formAsJson: JSON;
|
|
140
|
+
getInstances: Content[];
|
|
141
|
+
getInstanceConnection: ContentConnection;
|
|
142
|
+
}
|
|
143
|
+
type ExtraData<App = Record<string, unknown>> = App & {
|
|
144
|
+
media: XData_media_ApplicationConfig;
|
|
145
|
+
base: XData_base_ApplicationConfig;
|
|
146
|
+
};
|
|
147
|
+
type Float = number;
|
|
148
|
+
interface FormItem {
|
|
149
|
+
formItemType: FormItemType;
|
|
150
|
+
name: string;
|
|
151
|
+
label: string;
|
|
152
|
+
}
|
|
153
|
+
type FormItemType = 'ItemSet' | 'Layout' | 'Input' | 'OptionSet';
|
|
154
|
+
interface FragmentComponentData {
|
|
155
|
+
id: string;
|
|
156
|
+
fragment: Content;
|
|
157
|
+
}
|
|
158
|
+
interface GeoPoint {
|
|
159
|
+
value: string;
|
|
160
|
+
latitude: Float;
|
|
161
|
+
longitude: Float;
|
|
162
|
+
}
|
|
163
|
+
export interface HeadlessCms {
|
|
164
|
+
get?: Content;
|
|
165
|
+
getChildren?: Content[];
|
|
166
|
+
getChildrenConnection?: ContentConnection;
|
|
167
|
+
getPermissions?: Permissions;
|
|
168
|
+
getSite?: portal_Site;
|
|
169
|
+
getType?: ContentType;
|
|
170
|
+
getTypes?: ContentType[];
|
|
171
|
+
query?: Content[];
|
|
172
|
+
queryConnection?: QueryContentConnection;
|
|
173
|
+
queryDsl?: Content[];
|
|
174
|
+
queryDslConnection?: QueryDSLContentConnection;
|
|
175
|
+
}
|
|
176
|
+
interface Icon {
|
|
177
|
+
mimeType: string;
|
|
178
|
+
modifiedTime: string;
|
|
179
|
+
}
|
|
180
|
+
interface Image {
|
|
181
|
+
image: Content;
|
|
182
|
+
ref: string;
|
|
183
|
+
style: ImageStyle;
|
|
184
|
+
}
|
|
185
|
+
interface ImageComponentData {
|
|
186
|
+
id: string;
|
|
187
|
+
caption?: string;
|
|
188
|
+
image: media_Image;
|
|
189
|
+
}
|
|
190
|
+
interface ImageStyle {
|
|
191
|
+
name: string;
|
|
192
|
+
aspectRatio: string;
|
|
193
|
+
filter: string;
|
|
194
|
+
}
|
|
195
|
+
type Int = number;
|
|
196
|
+
type JSON = Record<string, unknown>;
|
|
197
|
+
interface LayoutComponentData {
|
|
198
|
+
descriptor: string;
|
|
199
|
+
configAsJson: JSON | null;
|
|
200
|
+
}
|
|
201
|
+
interface Link {
|
|
202
|
+
ref: string;
|
|
203
|
+
uri: string;
|
|
204
|
+
media: Media;
|
|
205
|
+
content: Content;
|
|
206
|
+
}
|
|
207
|
+
type LocalDateTime = string;
|
|
208
|
+
interface Macro_system_disable_DataConfig {
|
|
209
|
+
body: string;
|
|
210
|
+
}
|
|
211
|
+
interface Macro_system_embed_DataConfig {
|
|
212
|
+
body: string;
|
|
213
|
+
}
|
|
214
|
+
interface Macro {
|
|
215
|
+
ref: string;
|
|
216
|
+
name: string;
|
|
217
|
+
descriptor: string;
|
|
218
|
+
config: MacroConfig;
|
|
219
|
+
}
|
|
220
|
+
interface MacroConfig {
|
|
221
|
+
disable: Macro_system_disable_DataConfig;
|
|
222
|
+
embed: Macro_system_embed_DataConfig;
|
|
223
|
+
}
|
|
224
|
+
interface Media {
|
|
225
|
+
content: Content;
|
|
226
|
+
intent: MediaIntentType;
|
|
227
|
+
}
|
|
228
|
+
type MediaIntentType = 'download' | 'inline';
|
|
229
|
+
interface media_Image extends Content {
|
|
230
|
+
mediaUrl: string;
|
|
231
|
+
imageUrl: string;
|
|
232
|
+
data: media_Image_Data;
|
|
233
|
+
}
|
|
234
|
+
interface media_Image_Data {
|
|
235
|
+
media: MediaUploader;
|
|
236
|
+
caption: string;
|
|
237
|
+
altText: string;
|
|
238
|
+
artist: string[];
|
|
239
|
+
copyright: string;
|
|
240
|
+
tags: string[];
|
|
241
|
+
}
|
|
242
|
+
interface MediaFocalPoint {
|
|
243
|
+
x: number;
|
|
244
|
+
y: number;
|
|
245
|
+
}
|
|
246
|
+
interface MediaUploader {
|
|
247
|
+
attachment: string;
|
|
248
|
+
focalPoint: MediaFocalPoint;
|
|
249
|
+
}
|
|
250
|
+
interface PageComponentData {
|
|
251
|
+
descriptor?: string;
|
|
252
|
+
customized?: boolean;
|
|
253
|
+
configAsJson?: JSON;
|
|
254
|
+
template?: Content | null;
|
|
255
|
+
}
|
|
256
|
+
interface PageInfo {
|
|
257
|
+
startCursor: string;
|
|
258
|
+
endCursor: string;
|
|
259
|
+
hasNext: boolean;
|
|
260
|
+
}
|
|
261
|
+
interface PartComponentData<Config = Record<string, unknown>> {
|
|
262
|
+
descriptor: string;
|
|
263
|
+
config: Config;
|
|
264
|
+
configAsJson: JSON;
|
|
265
|
+
}
|
|
266
|
+
type Permission = 'READ' | 'CREATE' | 'MODIFY' | 'DELETE' | 'PUBLISH' | 'READ_PERMISSIONS' | 'WRITE_PERMISSIONS';
|
|
267
|
+
interface Permissions {
|
|
268
|
+
inheritsPermissions: boolean;
|
|
269
|
+
permissions: AccessControlEntry[];
|
|
270
|
+
}
|
|
271
|
+
interface portal_Site extends Content {
|
|
272
|
+
data: portal_Site_Data;
|
|
273
|
+
}
|
|
274
|
+
interface portal_Site_Data {
|
|
275
|
+
description: string;
|
|
276
|
+
}
|
|
277
|
+
type PrincipalType = 'user' | 'group' | 'role';
|
|
278
|
+
interface PrincipalKey {
|
|
279
|
+
value: string;
|
|
280
|
+
type: PrincipalType;
|
|
281
|
+
idProvider: string;
|
|
282
|
+
principalId: string;
|
|
283
|
+
}
|
|
284
|
+
interface QueryContentConnection extends ContentConnection {
|
|
285
|
+
aggregationsAsJson: JSON;
|
|
286
|
+
}
|
|
287
|
+
interface QueryDSLContentConnection extends QueryContentConnection {
|
|
288
|
+
highlightAsJson: JSON;
|
|
289
|
+
}
|
|
290
|
+
interface RichText {
|
|
291
|
+
raw: string;
|
|
292
|
+
processedHtml: string;
|
|
293
|
+
macrosAsJson: JSON;
|
|
294
|
+
macros: Macro[];
|
|
295
|
+
images: Image[];
|
|
296
|
+
links: Link[];
|
|
297
|
+
}
|
|
298
|
+
interface TextComponentData {
|
|
299
|
+
value: RichText;
|
|
300
|
+
}
|
|
301
|
+
interface XData_base_ApplicationConfig {
|
|
302
|
+
gpsInfo: XData_base_gpsInfo_DataConfig;
|
|
303
|
+
}
|
|
304
|
+
interface XData_base_gpsInfo_DataConfig {
|
|
305
|
+
geoPoint: GeoPoint;
|
|
306
|
+
altitude: string;
|
|
307
|
+
direction: string;
|
|
308
|
+
}
|
|
309
|
+
interface XData_media_ApplicationConfig {
|
|
310
|
+
imageInfo: XData_media_imageInfo_DataConfig;
|
|
311
|
+
cameraInfo: XData_media_cameraInfo_DataConfig;
|
|
312
|
+
}
|
|
313
|
+
interface XData_media_imageInfo_DataConfig {
|
|
314
|
+
pixelSize: number;
|
|
315
|
+
imageHeight: number;
|
|
316
|
+
imageWidth: number;
|
|
317
|
+
contentType: string;
|
|
318
|
+
description: string;
|
|
319
|
+
byteSize: number;
|
|
320
|
+
colorSpace: string[];
|
|
321
|
+
fileSource: string;
|
|
322
|
+
}
|
|
323
|
+
interface XData_media_cameraInfo_DataConfig {
|
|
324
|
+
date: LocalDateTime;
|
|
325
|
+
make: string;
|
|
326
|
+
model: string;
|
|
327
|
+
lens: string;
|
|
328
|
+
iso: string;
|
|
329
|
+
focalLength: string;
|
|
330
|
+
focalLength35: string;
|
|
331
|
+
exposureBias: string;
|
|
332
|
+
aperture: string[];
|
|
333
|
+
shutterTime: string;
|
|
334
|
+
flash: string;
|
|
335
|
+
autoFlashCompensation: string;
|
|
336
|
+
whiteBalance: string;
|
|
337
|
+
exposureProgram: string;
|
|
338
|
+
shootingMode: string;
|
|
339
|
+
meteringMode: string;
|
|
340
|
+
exposureMode: string;
|
|
341
|
+
focusDistance: string;
|
|
342
|
+
orientation: string;
|
|
343
|
+
}
|
|
344
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guillotine.js","sourceRoot":"","sources":["../../src/types/guillotine.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/types/i18n.ts"],"names":[],"mappings":""}
|
|
@@ -1,60 +1,45 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
|
|
3
1
|
export type * from './component';
|
|
4
2
|
export type * from './componentProps';
|
|
5
3
|
export type * from './guillotine';
|
|
6
4
|
export type * from './i18n';
|
|
7
5
|
export type * from './next';
|
|
8
6
|
export type * from './util';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// Shape of content base-data API body
|
|
12
7
|
export interface ContentApiBaseBody {
|
|
13
|
-
query?: string
|
|
14
|
-
variables?: ContentApiBaseBodyVariables
|
|
8
|
+
query?: string;
|
|
9
|
+
variables?: ContentApiBaseBodyVariables;
|
|
15
10
|
}
|
|
16
|
-
|
|
17
11
|
export interface ContentApiBaseBodyVariables {
|
|
18
|
-
path?: string
|
|
19
|
-
[key: string]: string | number | undefined
|
|
12
|
+
path?: string;
|
|
13
|
+
[key: string]: string | number | undefined;
|
|
20
14
|
}
|
|
21
|
-
|
|
22
15
|
export interface ContentPathItem {
|
|
23
|
-
contentPath: string[]
|
|
24
|
-
locale: string
|
|
16
|
+
contentPath: string[];
|
|
17
|
+
locale: string;
|
|
25
18
|
}
|
|
26
|
-
|
|
27
19
|
export interface PathFragment {
|
|
28
|
-
index: number
|
|
29
|
-
region: string
|
|
20
|
+
index: number;
|
|
21
|
+
region: string;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
export interface PreviewParams {
|
|
33
|
-
contentPath: string[]
|
|
34
|
-
headers: Record<string, string
|
|
35
|
-
params: Record<string, string
|
|
24
|
+
contentPath: string[];
|
|
25
|
+
headers: Record<string, string>;
|
|
26
|
+
params: Record<string, string>;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
export interface LocaleMapping {
|
|
39
|
-
default: boolean
|
|
40
|
-
project: string
|
|
41
|
-
site: string
|
|
42
|
-
locale: string
|
|
29
|
+
default: boolean;
|
|
30
|
+
project: string;
|
|
31
|
+
site: string;
|
|
32
|
+
locale: string;
|
|
43
33
|
}
|
|
44
|
-
|
|
45
34
|
export type LocaleMappings = Record<string, LocaleMapping>;
|
|
46
|
-
|
|
47
35
|
export type SelectorName = 'contentType' | 'page' | 'component' | 'part' | 'layout' | 'macro';
|
|
48
|
-
|
|
49
|
-
// https://nextjs.org/docs/app/api-reference/functions/fetch
|
|
50
36
|
export type FetchOptions = Omit<RequestInit, 'body'> & {
|
|
51
|
-
body?: ContentApiBaseBody
|
|
37
|
+
body?: ContentApiBaseBody;
|
|
52
38
|
next?: {
|
|
53
|
-
revalidate?: boolean | number
|
|
54
|
-
tags?: string[]
|
|
55
|
-
}
|
|
39
|
+
revalidate?: boolean | number;
|
|
40
|
+
tags?: string[];
|
|
41
|
+
};
|
|
56
42
|
};
|
|
57
|
-
|
|
58
43
|
export interface StaticContentProps extends Record<string, any> {
|
|
59
44
|
children?: React.ReactNode;
|
|
60
45
|
element?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,+BAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.js","sourceRoot":"","sources":["../../src/types/next.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/types/util.ts"],"names":[],"mappings":";AAIA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function addLineNumbers(s: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addLineNumbers.js","sourceRoot":"","sources":["../../src/utils/addLineNumbers.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,CAAS;IACpC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Context, GuillotineRequestHeaders } from '../types';
|
|
2
|
+
export declare function buildGuillotineRequestHeaders({ context, defaultLocale, locale, locales }: {
|
|
3
|
+
context: Context;
|
|
4
|
+
defaultLocale: string;
|
|
5
|
+
locale: string;
|
|
6
|
+
locales: string[];
|
|
7
|
+
}): GuillotineRequestHeaders;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GUILLOTINE_REQUEST_HEADERS, JSESSIONID_HEADER } from '../common/constants';
|
|
2
|
+
export function buildGuillotineRequestHeaders({ context, defaultLocale, locale, locales }) {
|
|
3
|
+
var _a;
|
|
4
|
+
const guillotineRequestHeaders = {
|
|
5
|
+
[GUILLOTINE_REQUEST_HEADERS.DEFAULT_LOCALE]: defaultLocale,
|
|
6
|
+
[GUILLOTINE_REQUEST_HEADERS.LOCALE]: locale,
|
|
7
|
+
[GUILLOTINE_REQUEST_HEADERS.LOCALES]: JSON.stringify(locales)
|
|
8
|
+
};
|
|
9
|
+
const jsessionid = (_a = context.headers) === null || _a === void 0 ? void 0 : _a.get(JSESSIONID_HEADER);
|
|
10
|
+
if (jsessionid) {
|
|
11
|
+
guillotineRequestHeaders[GUILLOTINE_REQUEST_HEADERS.COOKIE] =
|
|
12
|
+
`${JSESSIONID_HEADER}=${jsessionid}`;
|
|
13
|
+
}
|
|
14
|
+
return guillotineRequestHeaders;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=buildGuillotineRequestHeaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildGuillotineRequestHeaders.js","sourceRoot":"","sources":["../../src/utils/buildGuillotineRequestHeaders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,0BAA0B,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAGlF,MAAM,UAAU,6BAA6B,CAAC,EAC1C,OAAO,EACP,aAAa,EACb,MAAM,EACN,OAAO,EAMV;;IACG,MAAM,wBAAwB,GAA6B;QACvD,CAAC,0BAA0B,CAAC,cAAc,CAAC,EAAE,aAAa;QAC1D,CAAC,0BAA0B,CAAC,MAAM,CAAC,EAAE,MAAM;QAC3C,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KAChE,CAAC;IACF,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC3D,IAAI,UAAU,EAAE,CAAC;QACb,wBAAwB,CAAC,0BAA0B,CAAC,MAAM,CAAC;YACvD,GAAG,iBAAiB,IAAI,UAAU,EAAE,CAAC;IAC7C,CAAC;IACD,OAAO,wBAAwB,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const commonChars: (s1?: string, s2?: string) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const commonChars = (s1
|
|
1
|
+
export const commonChars = (s1, s2) => {
|
|
2
2
|
let result = '';
|
|
3
3
|
if (!s1 || s1.length === 0 || !s2 || s2.length === 0) {
|
|
4
4
|
return result;
|
|
@@ -7,10 +7,11 @@ export const commonChars = (s1?: string, s2?: string) => {
|
|
|
7
7
|
const s1Element = s1[i];
|
|
8
8
|
if (s2[i] === s1Element) {
|
|
9
9
|
result += s1Element;
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
11
12
|
break;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
|
|
15
15
|
return result;
|
|
16
|
-
};
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=commonChars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonChars.js","sourceRoot":"","sources":["../../src/utils/commonChars.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAW,EAAE,EAAW,EAAE,EAAE;IACpD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnD,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,IAAI,SAAS,CAAC;QACxB,CAAC;aAAM,CAAC;YACJ,MAAM;QACV,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const enonicDebug: (s?: string, ...params: any[]) => void;
|
|
2
|
+
export declare const enonicLog: (s?: string, ...params: any[]) => void;
|
|
3
|
+
export declare const enonicInfo: (s?: string, ...params: any[]) => void;
|
|
4
|
+
export declare const enonicWarn: (s?: string, ...params: any[]) => void;
|
|
5
|
+
export declare const enonicError: (s?: string, ...params: any[]) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LOGGING } from '../common/env';
|
|
2
|
+
export const enonicDebug = (s, ...params) => {
|
|
3
|
+
enonicPrint('debug', s, ...params);
|
|
4
|
+
};
|
|
5
|
+
export const enonicLog = (s, ...params) => {
|
|
6
|
+
enonicPrint('log', s, ...params);
|
|
7
|
+
};
|
|
8
|
+
export const enonicInfo = (s, ...params) => {
|
|
9
|
+
enonicPrint('info', s, ...params);
|
|
10
|
+
};
|
|
11
|
+
export const enonicWarn = (s, ...params) => {
|
|
12
|
+
enonicPrint('warn', s, ...params);
|
|
13
|
+
};
|
|
14
|
+
export const enonicError = (s, ...params) => {
|
|
15
|
+
enonicPrint('error', s, ...params);
|
|
16
|
+
};
|
|
17
|
+
const enonicPrint = (type, s, ...params) => {
|
|
18
|
+
if (LOGGING) {
|
|
19
|
+
const m = `\n[${new Date().toLocaleTimeString()}] ${s}:\n`;
|
|
20
|
+
console[type](m, ...params, '\n');
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=enonicLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enonicLog.js","sourceRoot":"","sources":["../../src/utils/enonicLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAU,EAAE,GAAG,MAAa,EAAE,EAAE;IACxD,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,GAAG,MAAa,EAAE,EAAE;IACtD,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAU,EAAE,GAAG,MAAa,EAAE,EAAE;IACvD,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAU,EAAE,GAAG,MAAa,EAAE,EAAE;IACvD,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAU,EAAE,GAAG,MAAa,EAAE,EAAE;IACxD,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAiD,EAAE,CAAU,EAAE,GAAG,MAAa,EAAE,EAAE;IACpG,IAAI,OAAO,EAAE,CAAC;QACV,MAAM,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC;QAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fixDoubleSlashes(str: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixDoubleSlashes.js","sourceRoot":"","sources":["../../src/utils/fixDoubleSlashes.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAC,GAAW;IACxC,OAAO,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getAllLocales(): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllLocales.js","sourceRoot":"","sources":["../../src/utils/getAllLocales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAGtD,MAAM,UAAU,aAAa;IACzB,OAAO,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RENDER_MODE } from '../common/constants';
|
|
2
|
+
import { API_URL } from '../common/env';
|
|
3
|
+
import { getLocaleMapping } from './getLocaleMapping';
|
|
4
|
+
import { fixDoubleSlashes } from './fixDoubleSlashes';
|
|
5
|
+
import { getRenderMode } from './getRenderMode';
|
|
6
|
+
export function getContentApiUrl(context) {
|
|
7
|
+
const project = getLocaleMapping(context).project;
|
|
8
|
+
const branch = getRenderMode(context) === RENDER_MODE.NEXT
|
|
9
|
+
? 'master'
|
|
10
|
+
: getRenderMode(context) === RENDER_MODE.LIVE
|
|
11
|
+
? 'master'
|
|
12
|
+
: 'draft';
|
|
13
|
+
return fixDoubleSlashes(`${API_URL}/${project}/${branch}`);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=getContentApiUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getContentApiUrl.js","sourceRoot":"","sources":["../../src/utils/getContentApiUrl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAG9C,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC7C,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;IAClD,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,IAAI;QACtD,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,IAAI;YACzC,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,OAAO,CAAC;IAElB,OAAO,gBAAgB,CAAC,GAAG,OAAO,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PROJECT_ID_HEADER } from '../common/constants';
|
|
2
|
+
import { getLocaleMappingByProjectId } from './getLocaleMappingByProjectId';
|
|
3
|
+
import { getLocaleMappingByLocale } from './getLocaleMappingByLocale';
|
|
4
|
+
export function getLocaleMapping(context) {
|
|
5
|
+
var _a;
|
|
6
|
+
const projectId = (_a = context.headers) === null || _a === void 0 ? void 0 : _a.get(PROJECT_ID_HEADER);
|
|
7
|
+
let config;
|
|
8
|
+
if (projectId) {
|
|
9
|
+
// first use project id header
|
|
10
|
+
config = getLocaleMappingByProjectId(projectId, false);
|
|
11
|
+
}
|
|
12
|
+
if (!config) {
|
|
13
|
+
// next try to use locale from url
|
|
14
|
+
// it will fall back to default locale if not found
|
|
15
|
+
config = getLocaleMappingByLocale(context.locale);
|
|
16
|
+
}
|
|
17
|
+
return config;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=getLocaleMapping.js.map
|