@enonic/nextjs-adapter 3.2.2 → 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/{baseMappings.js → dist/baseMappings.js} +9 -9
- package/dist/baseMappings.js.map +1 -0
- package/dist/client/getClientHydratedHtml.jsx.map +1 -0
- package/dist/client.js.map +1 -0
- package/{common → dist/common}/ComponentRegistry.js +1 -1
- package/dist/common/ComponentRegistry.js.map +1 -0
- package/dist/common/UrlProcessor.js.map +1 -0
- package/dist/common/constants.js.map +1 -0
- package/{common → dist/common}/env.js +1 -1
- package/dist/common/env.js.map +1 -0
- package/dist/guillotine/applyProcessors.js.map +1 -0
- package/dist/guillotine/buildComponentTree.js.map +1 -0
- package/{guillotine → dist/guillotine}/buildErrorResponse.js +3 -3
- package/dist/guillotine/buildErrorResponse.js.map +1 -0
- package/{guillotine → dist/guillotine}/buildPage.js +1 -1
- package/dist/guillotine/buildPage.js.map +1 -0
- package/{guillotine → dist/guillotine}/collectComponentDescriptors.d.ts +1 -1
- package/{guillotine → dist/guillotine}/collectComponentDescriptors.js +4 -4
- package/dist/guillotine/collectComponentDescriptors.js.map +1 -0
- package/{guillotine → dist/guillotine}/combineMultipleQueries.js +1 -1
- package/dist/guillotine/combineMultipleQueries.js.map +1 -0
- package/{guillotine → dist/guillotine}/createMetaData.d.ts +1 -1
- package/{guillotine → dist/guillotine}/createMetaData.js +2 -2
- package/dist/guillotine/createMetaData.js.map +1 -0
- package/{guillotine → dist/guillotine}/fetchContent.js +10 -10
- package/dist/guillotine/fetchContent.js.map +1 -0
- package/{guillotine → dist/guillotine}/fetchContentData.js +2 -2
- package/dist/guillotine/fetchContentData.js.map +1 -0
- package/dist/guillotine/fetchContentPathsForAllLocales.js.map +1 -0
- package/{guillotine → dist/guillotine}/fetchContentPathsForLocale.js +4 -4
- package/dist/guillotine/fetchContentPathsForLocale.js.map +1 -0
- package/{guillotine → dist/guillotine}/fetchFromApi.js +7 -7
- package/dist/guillotine/fetchFromApi.js.map +1 -0
- package/{guillotine → dist/guillotine}/fetchGuillotine.js +6 -6
- package/dist/guillotine/fetchGuillotine.js.map +1 -0
- package/{guillotine → dist/guillotine}/fetchMetaData.js +4 -4
- package/dist/guillotine/fetchMetaData.js.map +1 -0
- package/{guillotine → dist/guillotine}/getCleanContentPathArrayOrThrow400.js +1 -1
- package/dist/guillotine/getCleanContentPathArrayOrThrow400.js.map +1 -0
- package/dist/guillotine/getComponentConfig.js.map +1 -0
- package/dist/guillotine/getContentAndComponentPaths.js.map +1 -0
- package/dist/guillotine/getMetaData.js.map +1 -0
- package/{guillotine → dist/guillotine}/getParentRegion.js +1 -1
- package/dist/guillotine/getParentRegion.js.map +1 -0
- package/{guillotine → dist/guillotine}/getQueryAndVariables.js +2 -2
- package/dist/guillotine/getQueryAndVariables.js.map +1 -0
- package/dist/guillotine/metadata/configQuery.js.map +1 -0
- package/dist/guillotine/metadata/richTextQuery.js.map +1 -0
- package/{guillotine → dist/guillotine}/parseComponentPath.js +3 -3
- package/dist/guillotine/parseComponentPath.js.map +1 -0
- package/dist/guillotine/prefixFragmentCmpPath.js.map +1 -0
- package/dist/guillotine/processComponentConfig.js.map +1 -0
- package/dist/guillotine/restrictComponentsToPath.js.map +1 -0
- package/dist/guillotine/validateData.js.map +1 -0
- package/dist/guillotine/validateNotFound.js.map +1 -0
- package/dist/guillotine/validateShortcut.js.map +1 -0
- package/{i18n → dist/i18n}/LocaleContext.d.ts +1 -1
- package/{i18n → dist/i18n}/LocaleContext.jsx +3 -3
- package/dist/i18n/LocaleContext.jsx.map +1 -0
- package/dist/i18n/i18n.js.map +1 -0
- package/{index.d.ts → dist/index.d.ts} +3 -3
- package/{index.js → dist/index.js} +3 -3
- package/dist/index.js.map +1 -0
- package/dist/query/Shortcut.js.map +1 -0
- package/dist/server/getServerRenderedHtml.js.map +1 -0
- package/dist/server.js.map +1 -0
- package/{types → dist/types}/component.js.map +1 -1
- package/{types → dist/types}/componentProps.d.ts +2 -1
- package/dist/types/componentProps.js.map +1 -0
- package/{types → dist/types}/guillotine.d.ts +1 -1
- package/{types → dist/types}/guillotine.js.map +1 -1
- package/dist/types/i18n.js.map +1 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/next.js.map +1 -0
- package/dist/types/util.js.map +1 -0
- package/dist/utils/addLineNumbers.js.map +1 -0
- package/{utils → dist/utils}/buildGuillotineRequestHeaders.d.ts +1 -1
- package/{utils → dist/utils}/buildGuillotineRequestHeaders.js +3 -3
- package/dist/utils/buildGuillotineRequestHeaders.js.map +1 -0
- package/dist/utils/commonChars.js.map +1 -0
- package/dist/utils/enonicLog.js.map +1 -0
- package/dist/utils/fixDoubleSlashes.js.map +1 -0
- package/dist/utils/getAllLocales.js.map +1 -0
- package/dist/utils/getContentApiUrl.js.map +1 -0
- package/dist/utils/getLocaleMapping.js.map +1 -0
- package/dist/utils/getLocaleMappingByLocale.js.map +1 -0
- package/dist/utils/getLocaleMappingByProjectId.js.map +1 -0
- package/{utils → dist/utils}/getLocaleMappings.js +1 -1
- package/dist/utils/getLocaleMappings.js.map +1 -0
- package/{utils → dist/utils}/getRenderMode.js +1 -1
- package/dist/utils/getRenderMode.js.map +1 -0
- package/dist/utils/getRequestLocaleInfo.js.map +1 -0
- package/dist/utils/getXpBaseUrl.js.map +1 -0
- package/dist/utils/indent.js.map +1 -0
- package/dist/utils/sanitizeGraphqlName.js.map +1 -0
- package/{views → dist/views}/BaseComponent.d.ts +1 -1
- package/{views → dist/views}/BaseComponent.jsx +5 -5
- package/dist/views/BaseComponent.jsx.map +1 -0
- package/{views → dist/views}/BaseContent.jsx +1 -1
- package/dist/views/BaseContent.jsx.map +1 -0
- package/dist/views/BaseLayout.jsx.map +1 -0
- package/dist/views/BaseMacro.jsx.map +1 -0
- package/dist/views/BasePage.jsx.map +1 -0
- package/dist/views/BasePart.jsx.map +1 -0
- package/dist/views/Empty.jsx.map +1 -0
- package/dist/views/Fragment.jsx.map +1 -0
- package/dist/views/MainView.jsx.map +1 -0
- package/{views → dist/views}/PropsView.jsx +1 -1
- package/dist/views/PropsView.jsx.map +1 -0
- package/dist/views/Region.jsx.map +1 -0
- package/dist/views/RichTextView.jsx +65 -0
- package/dist/views/RichTextView.jsx.map +1 -0
- package/dist/views/SingleComponent.jsx.map +1 -0
- package/dist/views/StaticContent.jsx.map +1 -0
- package/dist/views/Text.jsx.map +1 -0
- package/dist/views/macros/DefaultMacro.jsx.map +1 -0
- package/dist/views/macros/DisableMacro.jsx.map +1 -0
- package/package.json +49 -42
- package/baseMappings.js.map +0 -1
- package/client/getClientHydratedHtml.jsx.map +0 -1
- package/client.js.map +0 -1
- package/common/ComponentRegistry.js.map +0 -1
- package/common/UrlProcessor.js.map +0 -1
- package/common/constants.js.map +0 -1
- package/common/env.js.map +0 -1
- package/guillotine/applyProcessors.js.map +0 -1
- package/guillotine/buildComponentTree.js.map +0 -1
- package/guillotine/buildErrorResponse.js.map +0 -1
- package/guillotine/buildPage.js.map +0 -1
- package/guillotine/collectComponentDescriptors.js.map +0 -1
- package/guillotine/combineMultipleQueries.js.map +0 -1
- package/guillotine/createMetaData.js.map +0 -1
- package/guillotine/fetchContent.js.map +0 -1
- package/guillotine/fetchContentData.js.map +0 -1
- package/guillotine/fetchContentPathsForAllLocales.js.map +0 -1
- package/guillotine/fetchContentPathsForLocale.js.map +0 -1
- package/guillotine/fetchFromApi.js.map +0 -1
- package/guillotine/fetchGuillotine.js.map +0 -1
- package/guillotine/fetchMetaData.js.map +0 -1
- package/guillotine/getCleanContentPathArrayOrThrow400.js.map +0 -1
- package/guillotine/getComponentConfig.js.map +0 -1
- package/guillotine/getContentAndComponentPaths.js.map +0 -1
- package/guillotine/getMetaData.js.map +0 -1
- package/guillotine/getParentRegion.js.map +0 -1
- package/guillotine/getQueryAndVariables.js.map +0 -1
- package/guillotine/metadata/configQuery.js.map +0 -1
- package/guillotine/metadata/richTextQuery.js.map +0 -1
- package/guillotine/parseComponentPath.js.map +0 -1
- package/guillotine/prefixFragmentCmpPath.js.map +0 -1
- package/guillotine/processComponentConfig.js.map +0 -1
- package/guillotine/restrictComponentsToPath.js.map +0 -1
- package/guillotine/validateData.js.map +0 -1
- package/guillotine/validateNotFound.js.map +0 -1
- package/guillotine/validateShortcut.js.map +0 -1
- package/i18n/LocaleContext.jsx.map +0 -1
- package/i18n/i18n.js.map +0 -1
- package/index.js.map +0 -1
- package/query/Shortcut.js.map +0 -1
- package/server/getServerRenderedHtml.js.map +0 -1
- package/server.js.map +0 -1
- package/src/baseMappings.ts +0 -53
- package/src/client/getClientHydratedHtml.tsx +0 -12
- package/src/client.ts +0 -2
- package/src/common/ComponentRegistry.ts +0 -162
- package/src/common/UrlProcessor.ts +0 -172
- package/src/common/constants.ts +0 -92
- package/src/common/env.ts +0 -41
- package/src/guillotine/applyProcessors.ts +0 -38
- package/src/guillotine/buildComponentTree.ts +0 -57
- package/src/guillotine/buildErrorResponse.ts +0 -35
- package/src/guillotine/buildPage.ts +0 -15
- package/src/guillotine/collectComponentDescriptors.ts +0 -63
- package/src/guillotine/combineMultipleQueries.ts +0 -75
- package/src/guillotine/createMetaData.ts +0 -72
- package/src/guillotine/fetchContent.ts +0 -246
- package/src/guillotine/fetchContentData.ts +0 -37
- 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/getCleanContentPathArrayOrThrow400.ts +0 -22
- package/src/guillotine/getComponentConfig.ts +0 -7
- package/src/guillotine/getContentAndComponentPaths.ts +0 -11
- package/src/guillotine/getMetaData.ts +0 -74
- package/src/guillotine/getParentRegion.ts +0 -54
- package/src/guillotine/getQueryAndVariables.ts +0 -52
- package/src/guillotine/metadata/configQuery.ts +0 -46
- package/src/guillotine/metadata/richTextQuery.ts +0 -49
- package/src/guillotine/parseComponentPath.ts +0 -29
- package/src/guillotine/prefixFragmentCmpPath.ts +0 -13
- package/src/guillotine/processComponentConfig.ts +0 -38
- package/src/guillotine/restrictComponentsToPath.ts +0 -48
- package/src/guillotine/validateData.ts +0 -11
- package/src/guillotine/validateNotFound.ts +0 -20
- package/src/guillotine/validateShortcut.ts +0 -43
- package/src/i18n/LocaleContext.tsx +0 -59
- package/src/i18n/i18n.ts +0 -57
- package/src/index.ts +0 -42
- package/src/query/Shortcut.ts +0 -18
- package/src/server/getServerRenderedHtml.ts +0 -3
- package/src/server.ts +0 -5
- package/src/types/component.ts +0 -131
- package/src/types/componentProps.ts +0 -142
- package/src/types/guillotine.ts +0 -428
- package/src/types/i18n.ts +0 -8
- package/src/types/index.ts +0 -62
- 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 -32
- package/src/utils/commonChars.ts +0 -16
- 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/getLocaleMappings.ts +0 -36
- package/src/utils/getRenderMode.ts +0 -14
- package/src/utils/getRequestLocaleInfo.ts +0 -30
- package/src/utils/getXpBaseUrl.ts +0 -12
- package/src/utils/indent.ts +0 -4
- package/src/utils/sanitizeGraphqlName.ts +0 -11
- package/src/views/BaseComponent.tsx +0 -156
- package/src/views/BaseContent.tsx +0 -47
- package/src/views/BaseLayout.tsx +0 -33
- package/src/views/BaseMacro.tsx +0 -105
- package/src/views/BasePage.tsx +0 -42
- package/src/views/BasePart.tsx +0 -34
- package/src/views/Empty.tsx +0 -5
- package/src/views/Fragment.tsx +0 -41
- package/src/views/MainView.tsx +0 -22
- package/src/views/PropsView.tsx +0 -38
- package/src/views/Region.tsx +0 -76
- package/src/views/RichTextView.tsx +0 -63
- 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
- package/types/componentProps.js.map +0 -1
- package/types/i18n.js.map +0 -1
- package/types/index.js.map +0 -1
- package/types/next.js.map +0 -1
- package/types/util.js.map +0 -1
- package/utils/addLineNumbers.js.map +0 -1
- package/utils/buildGuillotineRequestHeaders.js.map +0 -1
- package/utils/commonChars.js.map +0 -1
- package/utils/enonicLog.js.map +0 -1
- package/utils/fixDoubleSlashes.js.map +0 -1
- package/utils/getAllLocales.js.map +0 -1
- package/utils/getContentApiUrl.js.map +0 -1
- package/utils/getLocaleMapping.js.map +0 -1
- package/utils/getLocaleMappingByLocale.js.map +0 -1
- package/utils/getLocaleMappingByProjectId.js.map +0 -1
- package/utils/getLocaleMappings.js.map +0 -1
- package/utils/getRenderMode.js.map +0 -1
- package/utils/getRequestLocaleInfo.js.map +0 -1
- package/utils/getXpBaseUrl.js.map +0 -1
- package/utils/indent.js.map +0 -1
- package/utils/sanitizeGraphqlName.js.map +0 -1
- package/views/BaseComponent.jsx.map +0 -1
- package/views/BaseContent.jsx.map +0 -1
- package/views/BaseLayout.jsx.map +0 -1
- package/views/BaseMacro.jsx.map +0 -1
- package/views/BasePage.jsx.map +0 -1
- package/views/BasePart.jsx.map +0 -1
- package/views/Empty.jsx.map +0 -1
- package/views/Fragment.jsx.map +0 -1
- package/views/MainView.jsx.map +0 -1
- package/views/PropsView.jsx.map +0 -1
- package/views/Region.jsx.map +0 -1
- package/views/RichTextView.jsx +0 -39
- package/views/RichTextView.jsx.map +0 -1
- package/views/SingleComponent.jsx.map +0 -1
- package/views/StaticContent.jsx.map +0 -1
- package/views/Text.jsx.map +0 -1
- package/views/macros/DefaultMacro.jsx.map +0 -1
- package/views/macros/DisableMacro.jsx.map +0 -1
- /package/{baseMappings.d.ts → dist/baseMappings.d.ts} +0 -0
- /package/{client → dist/client}/getClientHydratedHtml.d.ts +0 -0
- /package/{client → dist/client}/getClientHydratedHtml.jsx +0 -0
- /package/{client.d.ts → dist/client.d.ts} +0 -0
- /package/{client.js → dist/client.js} +0 -0
- /package/{common → dist/common}/ComponentRegistry.d.ts +0 -0
- /package/{common → dist/common}/UrlProcessor.d.ts +0 -0
- /package/{common → dist/common}/UrlProcessor.js +0 -0
- /package/{common → dist/common}/constants.d.ts +0 -0
- /package/{common → dist/common}/constants.js +0 -0
- /package/{common → dist/common}/env.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/applyProcessors.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/applyProcessors.js +0 -0
- /package/{guillotine → dist/guillotine}/buildComponentTree.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/buildComponentTree.js +0 -0
- /package/{guillotine → dist/guillotine}/buildErrorResponse.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/buildPage.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/combineMultipleQueries.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/fetchContent.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/fetchContentData.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/fetchContentPathsForAllLocales.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/fetchContentPathsForAllLocales.js +0 -0
- /package/{guillotine → dist/guillotine}/fetchContentPathsForLocale.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/fetchFromApi.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/fetchGuillotine.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/fetchMetaData.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/getCleanContentPathArrayOrThrow400.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/getComponentConfig.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/getComponentConfig.js +0 -0
- /package/{guillotine → dist/guillotine}/getContentAndComponentPaths.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/getContentAndComponentPaths.js +0 -0
- /package/{guillotine → dist/guillotine}/getMetaData.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/getMetaData.js +0 -0
- /package/{guillotine → dist/guillotine}/getParentRegion.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/getQueryAndVariables.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/metadata/configQuery.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/metadata/configQuery.js +0 -0
- /package/{guillotine → dist/guillotine}/metadata/richTextQuery.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/metadata/richTextQuery.js +0 -0
- /package/{guillotine → dist/guillotine}/parseComponentPath.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/prefixFragmentCmpPath.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/prefixFragmentCmpPath.js +0 -0
- /package/{guillotine → dist/guillotine}/processComponentConfig.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/processComponentConfig.js +0 -0
- /package/{guillotine → dist/guillotine}/restrictComponentsToPath.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/restrictComponentsToPath.js +0 -0
- /package/{guillotine → dist/guillotine}/validateData.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/validateData.js +0 -0
- /package/{guillotine → dist/guillotine}/validateNotFound.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/validateNotFound.js +0 -0
- /package/{guillotine → dist/guillotine}/validateShortcut.d.ts +0 -0
- /package/{guillotine → dist/guillotine}/validateShortcut.js +0 -0
- /package/{i18n → dist/i18n}/i18n.d.ts +0 -0
- /package/{i18n → dist/i18n}/i18n.js +0 -0
- /package/{query → dist/query}/Shortcut.d.ts +0 -0
- /package/{query → dist/query}/Shortcut.js +0 -0
- /package/{server → dist/server}/getServerRenderedHtml.d.ts +0 -0
- /package/{server → dist/server}/getServerRenderedHtml.js +0 -0
- /package/{server.d.ts → dist/server.d.ts} +0 -0
- /package/{server.js → dist/server.js} +0 -0
- /package/{types → dist/types}/component.d.ts +0 -0
- /package/{types → dist/types}/component.js +0 -0
- /package/{types → dist/types}/componentProps.js +0 -0
- /package/{types → dist/types}/guillotine.js +0 -0
- /package/{types → dist/types}/i18n.d.ts +0 -0
- /package/{types → dist/types}/i18n.js +0 -0
- /package/{types → dist/types}/index.d.ts +0 -0
- /package/{types → dist/types}/index.js +0 -0
- /package/{types → dist/types}/next.d.ts +0 -0
- /package/{types → dist/types}/next.js +0 -0
- /package/{types → dist/types}/util.d.ts +0 -0
- /package/{types → dist/types}/util.js +0 -0
- /package/{utils → dist/utils}/addLineNumbers.d.ts +0 -0
- /package/{utils → dist/utils}/addLineNumbers.js +0 -0
- /package/{utils → dist/utils}/commonChars.d.ts +0 -0
- /package/{utils → dist/utils}/commonChars.js +0 -0
- /package/{utils → dist/utils}/enonicLog.d.ts +0 -0
- /package/{utils → dist/utils}/enonicLog.js +0 -0
- /package/{utils → dist/utils}/fixDoubleSlashes.d.ts +0 -0
- /package/{utils → dist/utils}/fixDoubleSlashes.js +0 -0
- /package/{utils → dist/utils}/getAllLocales.d.ts +0 -0
- /package/{utils → dist/utils}/getAllLocales.js +0 -0
- /package/{utils → dist/utils}/getContentApiUrl.d.ts +0 -0
- /package/{utils → dist/utils}/getContentApiUrl.js +0 -0
- /package/{utils → dist/utils}/getLocaleMapping.d.ts +0 -0
- /package/{utils → dist/utils}/getLocaleMapping.js +0 -0
- /package/{utils → dist/utils}/getLocaleMappingByLocale.d.ts +0 -0
- /package/{utils → dist/utils}/getLocaleMappingByLocale.js +0 -0
- /package/{utils → dist/utils}/getLocaleMappingByProjectId.d.ts +0 -0
- /package/{utils → dist/utils}/getLocaleMappingByProjectId.js +0 -0
- /package/{utils → dist/utils}/getLocaleMappings.d.ts +0 -0
- /package/{utils → dist/utils}/getRenderMode.d.ts +0 -0
- /package/{utils → dist/utils}/getRequestLocaleInfo.d.ts +0 -0
- /package/{utils → dist/utils}/getRequestLocaleInfo.js +0 -0
- /package/{utils → dist/utils}/getXpBaseUrl.d.ts +0 -0
- /package/{utils → dist/utils}/getXpBaseUrl.js +0 -0
- /package/{utils → dist/utils}/indent.d.ts +0 -0
- /package/{utils → dist/utils}/indent.js +0 -0
- /package/{utils → dist/utils}/sanitizeGraphqlName.d.ts +0 -0
- /package/{utils → dist/utils}/sanitizeGraphqlName.js +0 -0
- /package/{views → dist/views}/BaseContent.d.ts +0 -0
- /package/{views → dist/views}/BaseLayout.d.ts +0 -0
- /package/{views → dist/views}/BaseLayout.jsx +0 -0
- /package/{views → dist/views}/BaseMacro.d.ts +0 -0
- /package/{views → dist/views}/BaseMacro.jsx +0 -0
- /package/{views → dist/views}/BasePage.d.ts +0 -0
- /package/{views → dist/views}/BasePage.jsx +0 -0
- /package/{views → dist/views}/BasePart.d.ts +0 -0
- /package/{views → dist/views}/BasePart.jsx +0 -0
- /package/{views → dist/views}/Empty.d.ts +0 -0
- /package/{views → dist/views}/Empty.jsx +0 -0
- /package/{views → dist/views}/Fragment.d.ts +0 -0
- /package/{views → dist/views}/Fragment.jsx +0 -0
- /package/{views → dist/views}/MainView.d.ts +0 -0
- /package/{views → dist/views}/MainView.jsx +0 -0
- /package/{views → dist/views}/PropsView.d.ts +0 -0
- /package/{views → dist/views}/Region.d.ts +0 -0
- /package/{views → dist/views}/Region.jsx +0 -0
- /package/{views → dist/views}/RichTextView.d.ts +0 -0
- /package/{views → dist/views}/SingleComponent.d.ts +0 -0
- /package/{views → dist/views}/SingleComponent.jsx +0 -0
- /package/{views → dist/views}/StaticContent.d.ts +0 -0
- /package/{views → dist/views}/StaticContent.jsx +0 -0
- /package/{views → dist/views}/Text.d.ts +0 -0
- /package/{views → dist/views}/Text.jsx +0 -0
- /package/{views → dist/views}/macros/DefaultMacro.d.ts +0 -0
- /package/{views → dist/views}/macros/DefaultMacro.jsx +0 -0
- /package/{views → dist/views}/macros/DisableMacro.d.ts +0 -0
- /package/{views → dist/views}/macros/DisableMacro.jsx +0 -0
package/src/types/guillotine.ts
DELETED
|
@@ -1,428 +0,0 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
export interface GuillotineError {
|
|
9
|
-
errorType: string
|
|
10
|
-
locations: {
|
|
11
|
-
line: number
|
|
12
|
-
column: number
|
|
13
|
-
}[]
|
|
14
|
-
message: string
|
|
15
|
-
validationErrorType?: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// A specific observed error
|
|
19
|
-
// export interface GuillotineValidationError extends GuillotineError {
|
|
20
|
-
// errorType: 'ValidationError'
|
|
21
|
-
// validationErrorType: string // 'FieldUndefined'
|
|
22
|
-
// }
|
|
23
|
-
|
|
24
|
-
// export interface GuillotineErrorResponseJson {
|
|
25
|
-
// errors: GuillotineError[]
|
|
26
|
-
// }
|
|
27
|
-
|
|
28
|
-
// export interface GuillotineOkResponseJson<Data = Record<string,unknown>> {
|
|
29
|
-
// data: Data
|
|
30
|
-
// }
|
|
31
|
-
|
|
32
|
-
// export type GuillotineResponseJson<Data> = GuillotineOkResponseJson<Data> | GuillotineErrorResponseJson;
|
|
33
|
-
|
|
34
|
-
export interface GuillotineResponseJson<Guillotine = RecursivePartial<HeadlessCms>> {
|
|
35
|
-
// NOTE: guillotine is the actual field on the top Query, but can be used multiple times via aliases
|
|
36
|
-
data?: Record<string, Guillotine>
|
|
37
|
-
errors?: GuillotineError[]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface GuillotineResponse<Data = Record<string,unknown>> {
|
|
41
|
-
json: () => Promise<GuillotineResponseJson<Data>>
|
|
42
|
-
text: () => Promise<string>
|
|
43
|
-
ok: boolean
|
|
44
|
-
status: number
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 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.
|
|
49
|
-
* @param contentPath string or string array: pre-split or slash-delimited _path to a content available on the API
|
|
50
|
-
* @returns FetchContentResult object: {data?: T, error?: {code, message}}
|
|
51
|
-
*/
|
|
52
|
-
export type ContentFetcher = (context: Context) => Promise<FetchContentResult>;
|
|
53
|
-
|
|
54
|
-
export interface ContentResult<Content = Record<string, unknown>> extends Result {
|
|
55
|
-
contents?: Content[]
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface FetchContentResult extends Result {
|
|
59
|
-
data: Record<string, any> | null
|
|
60
|
-
common: Record<string, any> | null
|
|
61
|
-
meta: MetaData
|
|
62
|
-
page: PageComponent | null
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Seems like NodeJS.fetch lowercases all headers, so we need to lowercase the
|
|
66
|
-
// header names here.
|
|
67
|
-
export interface GuillotineRequestHeaders {
|
|
68
|
-
[key: string]: string;
|
|
69
|
-
Cookie?: string
|
|
70
|
-
locale: string
|
|
71
|
-
locales: string
|
|
72
|
-
'default-locale': string
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export type GuillotineResult = Result & Record<string, any>;
|
|
76
|
-
|
|
77
|
-
export interface MetaResult extends Result {
|
|
78
|
-
meta?: {
|
|
79
|
-
_id: string
|
|
80
|
-
_path: string
|
|
81
|
-
type: string
|
|
82
|
-
pageAsJson?: PageData
|
|
83
|
-
components?: PageComponent[]
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface Result {
|
|
88
|
-
error?: {
|
|
89
|
-
code: string
|
|
90
|
-
message: string
|
|
91
|
-
} | null
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Types from Query Playground Docs:
|
|
95
|
-
|
|
96
|
-
interface AccessControlEntry {
|
|
97
|
-
principal: PrincipalKey
|
|
98
|
-
allow: [Permission]
|
|
99
|
-
deny: [Permission]
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
interface Attachment {
|
|
103
|
-
name: string
|
|
104
|
-
label: string
|
|
105
|
-
size: number
|
|
106
|
-
mimeType: string
|
|
107
|
-
attachmentUrl: string
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
type DateTime = string;
|
|
111
|
-
|
|
112
|
-
export interface Component {
|
|
113
|
-
type: ComponentType
|
|
114
|
-
path: string
|
|
115
|
-
page?: PageComponentData | null
|
|
116
|
-
layout?: LayoutComponentData | null
|
|
117
|
-
image?: ImageComponentData | null
|
|
118
|
-
part?: PartComponentData | null
|
|
119
|
-
text?: TextComponentData | null
|
|
120
|
-
fragment?: FragmentComponentData | null
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
type ComponentType = 'page' | 'layout' | 'image' | 'part' | 'text' | 'fragment';
|
|
124
|
-
|
|
125
|
-
interface Content {
|
|
126
|
-
_id: string // !
|
|
127
|
-
_name: string // !
|
|
128
|
-
_path: string // !
|
|
129
|
-
_references?: Content[]
|
|
130
|
-
_score?: number
|
|
131
|
-
creator?: PrincipalKey
|
|
132
|
-
modifier?: PrincipalKey
|
|
133
|
-
createdTime?: DateTime
|
|
134
|
-
modifiedTime?: DateTime
|
|
135
|
-
owner?: PrincipalKey
|
|
136
|
-
type?: string
|
|
137
|
-
contentType?: ContentType
|
|
138
|
-
displayName?: string
|
|
139
|
-
hasChildren?: boolean
|
|
140
|
-
language?: string
|
|
141
|
-
valid?: boolean
|
|
142
|
-
dataAsJson?: JSON
|
|
143
|
-
x?: ExtraData
|
|
144
|
-
xAsJson?: JSON
|
|
145
|
-
pageAsJson?: JSON
|
|
146
|
-
pageTemplate?: Content
|
|
147
|
-
components?: Component[]
|
|
148
|
-
attachments?: Attachment[]
|
|
149
|
-
publish?: PublishInfo
|
|
150
|
-
pageUrl?: string
|
|
151
|
-
site?: portal_Site
|
|
152
|
-
parent?: Content
|
|
153
|
-
children?: Content[]
|
|
154
|
-
childrenConnection?: ContentConnection
|
|
155
|
-
permissions?: Permissions
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
interface ContentConnection {
|
|
159
|
-
totalCount: Int
|
|
160
|
-
edges: ContentEdge[]
|
|
161
|
-
pageInfo: PageInfo
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
interface ContentEdge {
|
|
165
|
-
node: Content
|
|
166
|
-
cursor: string
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
interface ContentType {
|
|
170
|
-
name: string
|
|
171
|
-
displayName: string
|
|
172
|
-
description: string
|
|
173
|
-
superType: string
|
|
174
|
-
abstract: boolean
|
|
175
|
-
final: boolean
|
|
176
|
-
allowChildContent: boolean
|
|
177
|
-
contentDisplayNameScript: string
|
|
178
|
-
icon: Icon
|
|
179
|
-
form: FormItem[]
|
|
180
|
-
formAsJson: JSON
|
|
181
|
-
getInstances: Content[]
|
|
182
|
-
getInstanceConnection: ContentConnection
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
type ExtraData<App = Record<string,unknown>> = App & {
|
|
186
|
-
media: XData_media_ApplicationConfig
|
|
187
|
-
base: XData_base_ApplicationConfig
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
type Float = number;
|
|
191
|
-
|
|
192
|
-
interface FormItem {
|
|
193
|
-
formItemType: FormItemType
|
|
194
|
-
name: string
|
|
195
|
-
label: string
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
type FormItemType = 'ItemSet' | 'Layout' | 'Input' | 'OptionSet';
|
|
199
|
-
|
|
200
|
-
interface FragmentComponentData {
|
|
201
|
-
id: string
|
|
202
|
-
fragment: Content
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
interface GeoPoint {
|
|
206
|
-
value: string
|
|
207
|
-
latitude: Float
|
|
208
|
-
longitude: Float
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export interface HeadlessCms {
|
|
212
|
-
get?: Content
|
|
213
|
-
getChildren?: Content[]
|
|
214
|
-
getChildrenConnection?: ContentConnection
|
|
215
|
-
getPermissions?: Permissions
|
|
216
|
-
getSite?: portal_Site
|
|
217
|
-
getType?: ContentType
|
|
218
|
-
getTypes?: ContentType[]
|
|
219
|
-
query?: Content[]
|
|
220
|
-
queryConnection?: QueryContentConnection
|
|
221
|
-
queryDsl?: Content[]
|
|
222
|
-
queryDslConnection?: QueryDSLContentConnection
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
interface Icon {
|
|
226
|
-
mimeType: string
|
|
227
|
-
modifiedTime: string
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
interface Image {
|
|
231
|
-
image: Content
|
|
232
|
-
ref: string
|
|
233
|
-
style: ImageStyle
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
interface ImageComponentData {
|
|
237
|
-
id: string
|
|
238
|
-
caption?: string
|
|
239
|
-
image: media_Image
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
interface ImageStyle {
|
|
243
|
-
name: string
|
|
244
|
-
aspectRatio: string
|
|
245
|
-
filter: string
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
type Int = number;
|
|
249
|
-
|
|
250
|
-
type JSON = Record<string, unknown>;
|
|
251
|
-
|
|
252
|
-
interface LayoutComponentData {
|
|
253
|
-
descriptor: string
|
|
254
|
-
configAsJson: JSON | null
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
interface Link {
|
|
258
|
-
ref: string
|
|
259
|
-
uri: string
|
|
260
|
-
media: Media
|
|
261
|
-
content: Content
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
type LocalDateTime = string;
|
|
265
|
-
|
|
266
|
-
interface Macro_system_disable_DataConfig {
|
|
267
|
-
body: string
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
interface Macro_system_embed_DataConfig {
|
|
271
|
-
body: string
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
interface Macro {
|
|
275
|
-
ref: string
|
|
276
|
-
name: string
|
|
277
|
-
descriptor: string
|
|
278
|
-
config: MacroConfig
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
interface MacroConfig {
|
|
282
|
-
disable: Macro_system_disable_DataConfig
|
|
283
|
-
embed: Macro_system_embed_DataConfig
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
interface Media {
|
|
287
|
-
content: Content
|
|
288
|
-
intent: MediaIntentType
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
type MediaIntentType = 'download' | 'inline';
|
|
292
|
-
|
|
293
|
-
interface media_Image extends Content {
|
|
294
|
-
mediaUrl: string
|
|
295
|
-
imageUrl: string
|
|
296
|
-
data: media_Image_Data
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
interface media_Image_Data {
|
|
300
|
-
media: MediaUploader
|
|
301
|
-
caption: string
|
|
302
|
-
altText: string
|
|
303
|
-
artist: string[]
|
|
304
|
-
copyright: string
|
|
305
|
-
tags: string[]
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
interface MediaFocalPoint {
|
|
309
|
-
x: number
|
|
310
|
-
y: number
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
interface MediaUploader {
|
|
314
|
-
attachment: string
|
|
315
|
-
focalPoint: MediaFocalPoint
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
interface PageComponentData {
|
|
319
|
-
descriptor?: string
|
|
320
|
-
customized?: boolean
|
|
321
|
-
configAsJson?: JSON
|
|
322
|
-
template?: Content | null
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
interface PageInfo {
|
|
326
|
-
startCursor: string // !
|
|
327
|
-
endCursor: string // !
|
|
328
|
-
hasNext: boolean // !
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
interface PartComponentData<Config = Record<string, unknown>> {
|
|
332
|
-
descriptor: string
|
|
333
|
-
config: Config
|
|
334
|
-
configAsJson: JSON
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
type Permission = 'READ' | 'CREATE' | 'MODIFY' | 'DELETE' | 'PUBLISH' | 'READ_PERMISSIONS' | 'WRITE_PERMISSIONS';
|
|
338
|
-
|
|
339
|
-
interface Permissions {
|
|
340
|
-
inheritsPermissions: boolean
|
|
341
|
-
permissions: AccessControlEntry[]
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
interface portal_Site extends Content {
|
|
345
|
-
data: portal_Site_Data
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
interface portal_Site_Data {
|
|
349
|
-
description: string
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
type PrincipalType = 'user' | 'group' | 'role';
|
|
353
|
-
|
|
354
|
-
interface PrincipalKey {
|
|
355
|
-
value: string
|
|
356
|
-
type: PrincipalType
|
|
357
|
-
idProvider: string
|
|
358
|
-
principalId: string
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
interface QueryContentConnection extends ContentConnection {
|
|
362
|
-
aggregationsAsJson: JSON
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
interface QueryDSLContentConnection extends QueryContentConnection {
|
|
366
|
-
highlightAsJson: JSON
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
interface RichText {
|
|
370
|
-
raw: string
|
|
371
|
-
processedHtml: string
|
|
372
|
-
macrosAsJson: JSON
|
|
373
|
-
macros: Macro[]
|
|
374
|
-
images: Image[]
|
|
375
|
-
links: Link[]
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
interface TextComponentData {
|
|
379
|
-
value: RichText
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
interface XData_base_ApplicationConfig {
|
|
383
|
-
gpsInfo: XData_base_gpsInfo_DataConfig
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
interface XData_base_gpsInfo_DataConfig {
|
|
387
|
-
geoPoint: GeoPoint
|
|
388
|
-
altitude: string
|
|
389
|
-
direction: string
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
interface XData_media_ApplicationConfig {
|
|
393
|
-
imageInfo: XData_media_imageInfo_DataConfig
|
|
394
|
-
cameraInfo: XData_media_cameraInfo_DataConfig
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
interface XData_media_imageInfo_DataConfig {
|
|
398
|
-
pixelSize: number
|
|
399
|
-
imageHeight: number
|
|
400
|
-
imageWidth: number
|
|
401
|
-
contentType: string
|
|
402
|
-
description: string
|
|
403
|
-
byteSize: number
|
|
404
|
-
colorSpace: string[]
|
|
405
|
-
fileSource: string
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
interface XData_media_cameraInfo_DataConfig {
|
|
409
|
-
date: LocalDateTime
|
|
410
|
-
make: string
|
|
411
|
-
model: string
|
|
412
|
-
lens: string
|
|
413
|
-
iso: string
|
|
414
|
-
focalLength: string
|
|
415
|
-
focalLength35: string
|
|
416
|
-
exposureBias: string
|
|
417
|
-
aperture: string[]
|
|
418
|
-
shutterTime: string
|
|
419
|
-
flash: string
|
|
420
|
-
autoFlashCompensation: string
|
|
421
|
-
whiteBalance: string
|
|
422
|
-
exposureProgram: string
|
|
423
|
-
shootingMode: string
|
|
424
|
-
meteringMode: string
|
|
425
|
-
exposureMode: string
|
|
426
|
-
focusDistance: string
|
|
427
|
-
orientation: string
|
|
428
|
-
}
|
package/src/types/i18n.ts
DELETED
package/src/types/index.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
export type * from './component';
|
|
4
|
-
export type * from './componentProps';
|
|
5
|
-
export type * from './guillotine';
|
|
6
|
-
export type * from './i18n';
|
|
7
|
-
export type * from './next';
|
|
8
|
-
export type * from './util';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// Shape of content base-data API body
|
|
12
|
-
export interface ContentApiBaseBody {
|
|
13
|
-
query?: string, // Override the default base-data query
|
|
14
|
-
variables?: ContentApiBaseBodyVariables // GraphQL variables inserted into the query
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ContentApiBaseBodyVariables {
|
|
18
|
-
path?: string, // Full content item _path
|
|
19
|
-
[key: string]: string | number | undefined,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ContentPathItem {
|
|
23
|
-
contentPath: string[]
|
|
24
|
-
locale: string,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface PathFragment {
|
|
28
|
-
index: number
|
|
29
|
-
region: string
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface PreviewParams {
|
|
33
|
-
contentPath: string[]
|
|
34
|
-
headers: Record<string, string>
|
|
35
|
-
params: Record<string, string>
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface LocaleMapping {
|
|
39
|
-
default: boolean
|
|
40
|
-
project: string
|
|
41
|
-
site: string
|
|
42
|
-
locale: string
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export type LocaleMappings = Record<string, LocaleMapping>;
|
|
46
|
-
|
|
47
|
-
export type SelectorName = 'contentType' | 'page' | 'component' | 'part' | 'layout' | 'macro';
|
|
48
|
-
|
|
49
|
-
// https://nextjs.org/docs/app/api-reference/functions/fetch
|
|
50
|
-
export type FetchOptions = Omit<RequestInit, 'body'> & {
|
|
51
|
-
body?: ContentApiBaseBody,
|
|
52
|
-
next?: {
|
|
53
|
-
revalidate?: boolean | number,
|
|
54
|
-
tags?: string[],
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export interface StaticContentProps extends Record<string, any> {
|
|
59
|
-
children?: React.ReactNode;
|
|
60
|
-
element?: string;
|
|
61
|
-
condition: boolean;
|
|
62
|
-
}
|
package/src/types/next.ts
DELETED
package/src/types/util.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type {Context, GuillotineRequestHeaders} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
GUILLOTINE_REQUEST_HEADERS,
|
|
6
|
-
JSESSIONID_HEADER,
|
|
7
|
-
} from '../common/constants';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export function buildGuillotineRequestHeaders({
|
|
11
|
-
context,
|
|
12
|
-
defaultLocale,
|
|
13
|
-
locale,
|
|
14
|
-
locales,
|
|
15
|
-
}: {
|
|
16
|
-
context: Context
|
|
17
|
-
defaultLocale: string
|
|
18
|
-
locale: string
|
|
19
|
-
locales: string[]
|
|
20
|
-
}): GuillotineRequestHeaders {
|
|
21
|
-
const guillotineRequestHeaders: GuillotineRequestHeaders = {
|
|
22
|
-
[GUILLOTINE_REQUEST_HEADERS.DEFAULT_LOCALE]: defaultLocale,
|
|
23
|
-
[GUILLOTINE_REQUEST_HEADERS.LOCALE]: locale,
|
|
24
|
-
[GUILLOTINE_REQUEST_HEADERS.LOCALES]: JSON.stringify(locales),
|
|
25
|
-
};
|
|
26
|
-
const jsessionid = context.headers?.get(JSESSIONID_HEADER);
|
|
27
|
-
if (jsessionid) {
|
|
28
|
-
guillotineRequestHeaders[GUILLOTINE_REQUEST_HEADERS.COOKIE] =
|
|
29
|
-
`${JSESSIONID_HEADER}=${jsessionid}`;
|
|
30
|
-
}
|
|
31
|
-
return guillotineRequestHeaders;
|
|
32
|
-
}
|
package/src/utils/commonChars.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const commonChars = (s1?: string, s2?: string) => {
|
|
2
|
-
let result = '';
|
|
3
|
-
if (!s1 || s1.length === 0 || !s2 || s2.length === 0) {
|
|
4
|
-
return result;
|
|
5
|
-
}
|
|
6
|
-
for (let i = 0; i < s1.length; i++) {
|
|
7
|
-
const s1Element = s1[i];
|
|
8
|
-
if (s2[i] === s1Element) {
|
|
9
|
-
result += s1Element;
|
|
10
|
-
} else {
|
|
11
|
-
break;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return result;
|
|
16
|
-
};
|
package/src/utils/enonicLog.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {LOGGING} from '../common/env';
|
|
2
|
-
|
|
3
|
-
export const enonicDebug = (s?: string, ...params: any[]) => {
|
|
4
|
-
enonicPrint('debug', s, ...params);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const enonicLog = (s?: string, ...params: any[]) => {
|
|
8
|
-
enonicPrint('log', s, ...params);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const enonicInfo = (s?: string, ...params: any[]) => {
|
|
12
|
-
enonicPrint('info', s, ...params);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const enonicWarn = (s?: string, ...params: any[]) => {
|
|
16
|
-
enonicPrint('warn', s, ...params);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const enonicError = (s?: string, ...params: any[]) => {
|
|
20
|
-
enonicPrint('error', s, ...params);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const enonicPrint = (type: 'log' | 'debug' | 'info' | 'warn' | 'error', s?: string, ...params: any[]) => {
|
|
24
|
-
if (LOGGING) {
|
|
25
|
-
const m = `\n[${new Date().toLocaleTimeString()}] ${s}:\n`;
|
|
26
|
-
console[type](m, ...params, '\n');
|
|
27
|
-
}
|
|
28
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type {Context} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {RENDER_MODE} from '../common/constants';
|
|
5
|
-
import {API_URL} from '../common/env';
|
|
6
|
-
import {getLocaleMapping} from './getLocaleMapping';
|
|
7
|
-
import {fixDoubleSlashes} from './fixDoubleSlashes';
|
|
8
|
-
import {getRenderMode} from './getRenderMode';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export function getContentApiUrl(context: Context): string {
|
|
12
|
-
const project = getLocaleMapping(context).project;
|
|
13
|
-
const branch = getRenderMode(context) === RENDER_MODE.NEXT
|
|
14
|
-
? 'master'
|
|
15
|
-
: getRenderMode(context) === RENDER_MODE.LIVE
|
|
16
|
-
? 'master'
|
|
17
|
-
: 'draft';
|
|
18
|
-
|
|
19
|
-
return fixDoubleSlashes(`${API_URL}/${project}/${branch}`);
|
|
20
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type {Context, LocaleMapping} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {PROJECT_ID_HEADER} from '../common/constants';
|
|
5
|
-
import {getLocaleMappingByProjectId} from './getLocaleMappingByProjectId';
|
|
6
|
-
import {getLocaleMappingByLocale} from './getLocaleMappingByLocale';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function getLocaleMapping(context: Context): LocaleMapping {
|
|
10
|
-
const projectId = context.headers?.get(PROJECT_ID_HEADER);
|
|
11
|
-
|
|
12
|
-
let config: LocaleMapping;
|
|
13
|
-
if (projectId) {
|
|
14
|
-
// first use project id header
|
|
15
|
-
config = getLocaleMappingByProjectId(projectId, false);
|
|
16
|
-
}
|
|
17
|
-
if (!config) {
|
|
18
|
-
// next try to use locale from url
|
|
19
|
-
// it will fall back to default locale if not found
|
|
20
|
-
config = getLocaleMappingByLocale(context.locale);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return config;
|
|
24
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type {LocaleMapping} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {getLocaleMappings} from './getLocaleMappings';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export function getLocaleMappingByLocale(locale?: string, useDefault = true): LocaleMapping {
|
|
8
|
-
const mappings = getLocaleMappings();
|
|
9
|
-
|
|
10
|
-
let config: LocaleMapping;
|
|
11
|
-
if (locale) {
|
|
12
|
-
config = mappings[locale];
|
|
13
|
-
}
|
|
14
|
-
if (!config && useDefault) {
|
|
15
|
-
config = Object.values(mappings).find(c => c.default);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return config;
|
|
19
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type {LocaleMapping} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {getLocaleMappings} from './getLocaleMappings';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export function getLocaleMappingByProjectId(projectId?: string, useDefault = true): LocaleMapping {
|
|
8
|
-
const mappings = getLocaleMappings();
|
|
9
|
-
|
|
10
|
-
let config: LocaleMapping;
|
|
11
|
-
if (projectId) {
|
|
12
|
-
config = Object.values(mappings).find(p => {
|
|
13
|
-
return p?.project?.toLowerCase() === projectId.toLowerCase();
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
if (!config && useDefault) {
|
|
17
|
-
config = Object.values(mappings).find(c => c.default);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return config;
|
|
21
|
-
}
|