@prezly/theme-kit-nextjs 4.1.1-alpha.0 → 4.2.0-alpha.1
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/build/cjs/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -0
- package/build/cjs/adapter-nextjs/api-handlers/fetchStories.js.map +1 -0
- package/build/cjs/adapter-nextjs/api-handlers/index.js.map +1 -0
- package/build/cjs/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -0
- package/build/cjs/adapter-nextjs/getNewsroomStaticProps.js.map +1 -0
- package/build/cjs/adapter-nextjs/index.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/category.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/gallery.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/galleryAlbum.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/home.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/index.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/lib/types.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/search.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/sitemap/createPaths.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/sitemap/index.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/sitemap/types.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/story.js.map +1 -0
- package/build/cjs/adapter-nextjs/page-props/storyPreview.js.map +1 -0
- package/build/cjs/adapter-nextjs/processRequest.js.map +1 -0
- package/build/cjs/adapter-nextjs/processStaticRequest.js.map +1 -0
- package/build/{components-nextjs → cjs/components-nextjs}/PageSeo/PageSeo.js +0 -1
- package/build/cjs/components-nextjs/PageSeo/PageSeo.js.map +1 -0
- package/build/cjs/components-nextjs/PageSeo/index.js.map +1 -0
- package/build/cjs/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +1 -0
- package/build/cjs/components-nextjs/PageSeo/lib/index.js.map +1 -0
- package/build/cjs/components-nextjs/StorySeo/StorySeo.js.map +1 -0
- package/build/cjs/components-nextjs/StorySeo/index.js.map +1 -0
- package/build/cjs/components-nextjs/document.js.map +1 -0
- package/build/cjs/components-nextjs/index.js.map +1 -0
- package/build/cjs/data-fetching/NextPrezlyApi.js.map +1 -0
- package/build/cjs/data-fetching/getNextPrezlyApi.js.map +1 -0
- package/build/cjs/data-fetching/index.js.map +1 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/infinite-loading/index.js.map +1 -0
- package/build/cjs/infinite-loading/types.js.map +1 -0
- package/build/cjs/infinite-loading/useInfiniteGalleriesLoading.js.map +1 -0
- package/build/cjs/infinite-loading/useInfiniteLoading.js.map +1 -0
- package/build/cjs/infinite-loading/useInfiniteStoriesLoading.js.map +1 -0
- package/build/cjs/intl/index.js.map +1 -0
- package/build/cjs/intl/languages.js.map +1 -0
- package/build/cjs/intl/locale.js.map +1 -0
- package/build/{newsroom-context → cjs/newsroom-context}/context.js +0 -1
- package/build/cjs/newsroom-context/context.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/index.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useCategories.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useCompanyInformation.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useCurrentCategory.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useCurrentLocale.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useCurrentStory.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useLanguages.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useNewsroom.js.map +1 -0
- package/build/cjs/newsroom-context/hooks/useNewsroomContext.js.map +1 -0
- package/build/cjs/newsroom-context/index.js.map +1 -0
- package/build/cjs/sentry/client.js.map +1 -0
- package/build/cjs/sentry/common.js.map +1 -0
- package/build/cjs/sentry/index.js.map +1 -0
- package/build/cjs/sentry/server.js.map +1 -0
- package/build/{infinite-loading → cjs}/types.js.map +1 -1
- package/build/esm/adapter-nextjs/api-handlers/fetchGalleries.js +19 -0
- package/build/esm/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -0
- package/build/esm/adapter-nextjs/api-handlers/fetchStories.js +29 -0
- package/build/esm/adapter-nextjs/api-handlers/fetchStories.js.map +1 -0
- package/build/esm/adapter-nextjs/api-handlers/index.js +3 -0
- package/build/esm/adapter-nextjs/api-handlers/index.js.map +1 -0
- package/build/esm/adapter-nextjs/getNewsroomServerSideProps.js +15 -0
- package/build/esm/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -0
- package/build/esm/adapter-nextjs/getNewsroomStaticProps.js +15 -0
- package/build/esm/adapter-nextjs/getNewsroomStaticProps.js.map +1 -0
- package/build/esm/adapter-nextjs/index.js +7 -0
- package/build/esm/adapter-nextjs/index.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/category.js +97 -0
- package/build/esm/adapter-nextjs/page-props/category.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/gallery.js +66 -0
- package/build/esm/adapter-nextjs/page-props/gallery.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/galleryAlbum.js +49 -0
- package/build/esm/adapter-nextjs/page-props/galleryAlbum.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/home.js +70 -0
- package/build/esm/adapter-nextjs/page-props/home.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/index.js +9 -0
- package/build/esm/adapter-nextjs/page-props/index.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/lib/types.js +2 -0
- package/build/esm/adapter-nextjs/page-props/lib/types.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/search.js +27 -0
- package/build/esm/adapter-nextjs/page-props/search.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +47 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/createPaths.js +15 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/createPaths.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/getServerSideProps.js +32 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/index.js +5 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/index.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/types.js +2 -0
- package/build/esm/adapter-nextjs/page-props/sitemap/types.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/story.js +63 -0
- package/build/esm/adapter-nextjs/page-props/story.js.map +1 -0
- package/build/esm/adapter-nextjs/page-props/storyPreview.js +22 -0
- package/build/esm/adapter-nextjs/page-props/storyPreview.js.map +1 -0
- package/build/esm/adapter-nextjs/processRequest.js +33 -0
- package/build/esm/adapter-nextjs/processRequest.js.map +1 -0
- package/build/esm/adapter-nextjs/processStaticRequest.js +22 -0
- package/build/esm/adapter-nextjs/processStaticRequest.js.map +1 -0
- package/build/esm/components-nextjs/PageSeo/PageSeo.js +77 -0
- package/build/esm/components-nextjs/PageSeo/PageSeo.js.map +1 -0
- package/build/esm/components-nextjs/PageSeo/index.js +2 -0
- package/build/esm/components-nextjs/PageSeo/index.js.map +1 -0
- package/build/esm/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +7 -0
- package/build/esm/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +1 -0
- package/build/esm/components-nextjs/PageSeo/lib/index.js +2 -0
- package/build/esm/components-nextjs/PageSeo/lib/index.js.map +1 -0
- package/build/esm/components-nextjs/StorySeo/StorySeo.js +52 -0
- package/build/esm/components-nextjs/StorySeo/StorySeo.js.map +1 -0
- package/build/esm/components-nextjs/StorySeo/index.js +2 -0
- package/build/esm/components-nextjs/StorySeo/index.js.map +1 -0
- package/build/esm/components-nextjs/document.js +21 -0
- package/build/esm/components-nextjs/document.js.map +1 -0
- package/build/esm/components-nextjs/index.js +4 -0
- package/build/esm/components-nextjs/index.js.map +1 -0
- package/build/esm/data-fetching/NextPrezlyApi.js +36 -0
- package/build/esm/data-fetching/NextPrezlyApi.js.map +1 -0
- package/build/esm/data-fetching/getNextPrezlyApi.js +17 -0
- package/build/esm/data-fetching/getNextPrezlyApi.js.map +1 -0
- package/build/esm/data-fetching/index.js +2 -0
- package/build/esm/data-fetching/index.js.map +1 -0
- package/build/esm/index.js +9 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/infinite-loading/index.js +5 -0
- package/build/esm/infinite-loading/index.js.map +1 -0
- package/build/esm/infinite-loading/types.js +2 -0
- package/build/esm/infinite-loading/types.js.map +1 -0
- package/build/esm/infinite-loading/useInfiniteGalleriesLoading.js +41 -0
- package/build/esm/infinite-loading/useInfiniteGalleriesLoading.js.map +1 -0
- package/build/esm/infinite-loading/useInfiniteLoading.js +40 -0
- package/build/esm/infinite-loading/useInfiniteLoading.js.map +1 -0
- package/build/esm/infinite-loading/useInfiniteStoriesLoading.js +58 -0
- package/build/esm/infinite-loading/useInfiniteStoriesLoading.js.map +1 -0
- package/build/esm/intl/index.js +3 -0
- package/build/esm/intl/index.js.map +1 -0
- package/build/esm/intl/languages.js +26 -0
- package/build/esm/intl/languages.js.map +1 -0
- package/build/esm/intl/locale.js +25 -0
- package/build/esm/intl/locale.js.map +1 -0
- package/build/esm/newsroom-context/context.js +25 -0
- package/build/esm/newsroom-context/context.js.map +1 -0
- package/build/esm/newsroom-context/hooks/index.js +12 -0
- package/build/esm/newsroom-context/hooks/index.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useAlgoliaSettings.js +6 -0
- package/build/esm/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useCategories.js +6 -0
- package/build/esm/newsroom-context/hooks/useCategories.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useCompanyInformation.js +6 -0
- package/build/esm/newsroom-context/hooks/useCompanyInformation.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useCurrentCategory.js +6 -0
- package/build/esm/newsroom-context/hooks/useCurrentCategory.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useCurrentLocale.js +6 -0
- package/build/esm/newsroom-context/hooks/useCurrentLocale.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useCurrentStory.js +6 -0
- package/build/esm/newsroom-context/hooks/useCurrentStory.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useGetLinkLocaleSlug.js +25 -0
- package/build/esm/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useGetTranslationUrl.js +71 -0
- package/build/esm/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useLanguages.js +6 -0
- package/build/esm/newsroom-context/hooks/useLanguages.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useNewsroom.js +6 -0
- package/build/esm/newsroom-context/hooks/useNewsroom.js.map +1 -0
- package/build/esm/newsroom-context/hooks/useNewsroomContext.js +12 -0
- package/build/esm/newsroom-context/hooks/useNewsroomContext.js.map +1 -0
- package/build/esm/newsroom-context/index.js +3 -0
- package/build/esm/newsroom-context/index.js.map +1 -0
- package/build/esm/sentry/client.js +5 -0
- package/build/esm/sentry/client.js.map +1 -0
- package/build/esm/sentry/common.js +62 -0
- package/build/{sentry → esm/sentry}/common.js.map +1 -1
- package/build/esm/sentry/index.js +3 -0
- package/build/esm/sentry/index.js.map +1 -0
- package/build/esm/sentry/server.js +5 -0
- package/build/esm/sentry/server.js.map +1 -0
- package/build/esm/types.js +2 -0
- package/build/esm/types.js.map +1 -0
- package/build/tsconfig.cjs.tsbuildinfo +1 -0
- package/build/tsconfig.esm.tsbuildinfo +1 -0
- package/build/types/adapter-nextjs/api-handlers/fetchGalleries.d.ts +2 -0
- package/build/types/adapter-nextjs/api-handlers/fetchStories.d.ts +2 -0
- package/build/types/adapter-nextjs/api-handlers/index.d.ts +2 -0
- package/build/types/adapter-nextjs/getNewsroomServerSideProps.d.ts +15 -0
- package/build/types/adapter-nextjs/getNewsroomStaticProps.d.ts +15 -0
- package/build/types/adapter-nextjs/index.d.ts +6 -0
- package/build/types/adapter-nextjs/page-props/category.d.ts +16 -0
- package/build/types/adapter-nextjs/page-props/gallery.d.ts +14 -0
- package/build/types/adapter-nextjs/page-props/galleryAlbum.d.ts +9 -0
- package/build/types/adapter-nextjs/page-props/home.d.ts +22 -0
- package/build/types/adapter-nextjs/page-props/index.d.ts +8 -0
- package/build/types/adapter-nextjs/page-props/lib/types.d.ts +3 -0
- package/build/types/adapter-nextjs/page-props/search.d.ts +4 -0
- package/build/types/adapter-nextjs/page-props/sitemap/SitemapBuilder.d.ts +11 -0
- package/build/types/adapter-nextjs/page-props/sitemap/createPaths.d.ts +2 -0
- package/build/types/adapter-nextjs/page-props/sitemap/getServerSideProps.d.ts +7 -0
- package/build/types/adapter-nextjs/page-props/sitemap/index.d.ts +4 -0
- package/build/types/adapter-nextjs/page-props/sitemap/types.d.ts +5 -0
- package/build/types/adapter-nextjs/page-props/story.d.ts +14 -0
- package/build/types/adapter-nextjs/page-props/storyPreview.d.ts +3 -0
- package/build/types/adapter-nextjs/processRequest.d.ts +12 -0
- package/build/types/adapter-nextjs/processStaticRequest.d.ts +11 -0
- package/build/types/components-nextjs/PageSeo/PageSeo.d.ts +12 -0
- package/build/types/components-nextjs/PageSeo/index.d.ts +1 -0
- package/build/types/components-nextjs/PageSeo/lib/getAbsoluteUrl.d.ts +1 -0
- package/build/types/components-nextjs/PageSeo/lib/index.d.ts +1 -0
- package/build/types/components-nextjs/StorySeo/StorySeo.d.ts +12 -0
- package/build/types/components-nextjs/StorySeo/index.d.ts +1 -0
- package/build/types/components-nextjs/document.d.ts +6 -0
- package/build/types/components-nextjs/index.d.ts +3 -0
- package/build/types/data-fetching/NextPrezlyApi.d.ts +8 -0
- package/build/types/data-fetching/getNextPrezlyApi.d.ts +4 -0
- package/build/types/data-fetching/index.d.ts +1 -0
- package/build/types/index.d.ts +8 -0
- package/build/types/infinite-loading/index.d.ts +4 -0
- package/build/types/infinite-loading/types.d.ts +9 -0
- package/build/types/infinite-loading/useInfiniteGalleriesLoading.d.ts +13 -0
- package/build/types/infinite-loading/useInfiniteLoading.d.ts +16 -0
- package/build/types/infinite-loading/useInfiniteStoriesLoading.d.ts +13 -0
- package/build/types/intl/index.d.ts +2 -0
- package/build/types/intl/languages.d.ts +6 -0
- package/build/types/intl/locale.d.ts +5 -0
- package/build/types/newsroom-context/context.d.ts +62 -0
- package/build/types/newsroom-context/hooks/index.d.ts +11 -0
- package/build/types/newsroom-context/hooks/useAlgoliaSettings.d.ts +1 -0
- package/build/types/newsroom-context/hooks/useCategories.d.ts +1 -0
- package/build/types/newsroom-context/hooks/useCompanyInformation.d.ts +1 -0
- package/build/types/newsroom-context/hooks/useCurrentCategory.d.ts +1 -0
- package/build/types/newsroom-context/hooks/useCurrentLocale.d.ts +1 -0
- package/build/types/newsroom-context/hooks/useCurrentStory.d.ts +1 -0
- package/build/types/newsroom-context/hooks/useGetLinkLocaleSlug.d.ts +2 -0
- package/build/types/newsroom-context/hooks/useGetTranslationUrl.d.ts +6 -0
- package/build/types/newsroom-context/hooks/useLanguages.d.ts +1 -0
- package/build/types/newsroom-context/hooks/useNewsroom.d.ts +1 -0
- package/build/types/newsroom-context/hooks/useNewsroomContext.d.ts +2 -0
- package/build/types/newsroom-context/index.d.ts +2 -0
- package/build/types/sentry/client.d.ts +2 -0
- package/build/types/sentry/common.d.ts +2 -0
- package/build/types/sentry/index.d.ts +2 -0
- package/build/types/sentry/server.d.ts +2 -0
- package/build/types/types.d.ts +14 -0
- package/package.json +14 -7
- package/src/components-nextjs/PageSeo/PageSeo.tsx +0 -2
- package/src/newsroom-context/context.tsx +0 -2
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +0 -1
- package/build/adapter-nextjs/api-handlers/fetchStories.js.map +0 -1
- package/build/adapter-nextjs/api-handlers/index.js.map +0 -1
- package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +0 -1
- package/build/adapter-nextjs/getNewsroomStaticProps.js.map +0 -1
- package/build/adapter-nextjs/index.js.map +0 -1
- package/build/adapter-nextjs/page-props/category.js.map +0 -1
- package/build/adapter-nextjs/page-props/gallery.js.map +0 -1
- package/build/adapter-nextjs/page-props/galleryAlbum.js.map +0 -1
- package/build/adapter-nextjs/page-props/home.js.map +0 -1
- package/build/adapter-nextjs/page-props/index.js.map +0 -1
- package/build/adapter-nextjs/page-props/lib/types.js.map +0 -1
- package/build/adapter-nextjs/page-props/search.js.map +0 -1
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +0 -1
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js.map +0 -1
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +0 -1
- package/build/adapter-nextjs/page-props/sitemap/index.js.map +0 -1
- package/build/adapter-nextjs/page-props/sitemap/types.js.map +0 -1
- package/build/adapter-nextjs/page-props/story.js.map +0 -1
- package/build/adapter-nextjs/page-props/storyPreview.js.map +0 -1
- package/build/adapter-nextjs/processRequest.js.map +0 -1
- package/build/adapter-nextjs/processStaticRequest.js.map +0 -1
- package/build/components-nextjs/PageSeo/PageSeo.js.map +0 -1
- package/build/components-nextjs/PageSeo/index.js.map +0 -1
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +0 -1
- package/build/components-nextjs/PageSeo/lib/index.js.map +0 -1
- package/build/components-nextjs/StorySeo/StorySeo.js.map +0 -1
- package/build/components-nextjs/StorySeo/index.js.map +0 -1
- package/build/components-nextjs/document.js.map +0 -1
- package/build/components-nextjs/index.js.map +0 -1
- package/build/data-fetching/NextPrezlyApi.js.map +0 -1
- package/build/data-fetching/getNextPrezlyApi.js.map +0 -1
- package/build/data-fetching/index.js.map +0 -1
- package/build/index.js.map +0 -1
- package/build/infinite-loading/index.js.map +0 -1
- package/build/infinite-loading/useInfiniteGalleriesLoading.js.map +0 -1
- package/build/infinite-loading/useInfiniteLoading.js.map +0 -1
- package/build/infinite-loading/useInfiniteStoriesLoading.js.map +0 -1
- package/build/intl/index.js.map +0 -1
- package/build/intl/languages.js.map +0 -1
- package/build/intl/locale.js.map +0 -1
- package/build/newsroom-context/context.js.map +0 -1
- package/build/newsroom-context/hooks/index.js.map +0 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +0 -1
- package/build/newsroom-context/hooks/useCategories.js.map +0 -1
- package/build/newsroom-context/hooks/useCompanyInformation.js.map +0 -1
- package/build/newsroom-context/hooks/useCurrentCategory.js.map +0 -1
- package/build/newsroom-context/hooks/useCurrentLocale.js.map +0 -1
- package/build/newsroom-context/hooks/useCurrentStory.js.map +0 -1
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +0 -1
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +0 -1
- package/build/newsroom-context/hooks/useLanguages.js.map +0 -1
- package/build/newsroom-context/hooks/useNewsroom.js.map +0 -1
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +0 -1
- package/build/newsroom-context/index.js.map +0 -1
- package/build/sentry/client.js.map +0 -1
- package/build/sentry/index.js.map +0 -1
- package/build/sentry/server.js.map +0 -1
- package/build/types.js.map +0 -1
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/api-handlers/fetchGalleries.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/api-handlers/fetchGalleries.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/api-handlers/fetchStories.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/api-handlers/fetchStories.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/api-handlers/index.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/api-handlers/index.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/getNewsroomServerSideProps.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/getNewsroomServerSideProps.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/getNewsroomStaticProps.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/getNewsroomStaticProps.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/index.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/index.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/category.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/category.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/gallery.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/gallery.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/galleryAlbum.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/galleryAlbum.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/home.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/home.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/index.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/index.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/lib/types.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/lib/types.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/search.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/search.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/SitemapBuilder.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/SitemapBuilder.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/createPaths.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/createPaths.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/getServerSideProps.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/getServerSideProps.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/index.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/index.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/types.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/sitemap/types.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/story.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/story.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/storyPreview.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/page-props/storyPreview.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/processRequest.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/processRequest.js +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/processStaticRequest.d.ts +0 -0
- /package/build/{adapter-nextjs → cjs/adapter-nextjs}/processStaticRequest.js +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/PageSeo/PageSeo.d.ts +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/PageSeo/index.d.ts +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/PageSeo/index.js +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/PageSeo/lib/getAbsoluteUrl.d.ts +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/PageSeo/lib/getAbsoluteUrl.js +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/PageSeo/lib/index.d.ts +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/PageSeo/lib/index.js +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/StorySeo/StorySeo.d.ts +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/StorySeo/StorySeo.js +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/StorySeo/index.d.ts +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/StorySeo/index.js +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/document.d.ts +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/document.js +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/index.d.ts +0 -0
- /package/build/{components-nextjs → cjs/components-nextjs}/index.js +0 -0
- /package/build/{data-fetching → cjs/data-fetching}/NextPrezlyApi.d.ts +0 -0
- /package/build/{data-fetching → cjs/data-fetching}/NextPrezlyApi.js +0 -0
- /package/build/{data-fetching → cjs/data-fetching}/getNextPrezlyApi.d.ts +0 -0
- /package/build/{data-fetching → cjs/data-fetching}/getNextPrezlyApi.js +0 -0
- /package/build/{data-fetching → cjs/data-fetching}/index.d.ts +0 -0
- /package/build/{data-fetching → cjs/data-fetching}/index.js +0 -0
- /package/build/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/build/{index.js → cjs/index.js} +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/index.d.ts +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/index.js +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/types.d.ts +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/types.js +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/useInfiniteGalleriesLoading.d.ts +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/useInfiniteGalleriesLoading.js +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/useInfiniteLoading.d.ts +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/useInfiniteLoading.js +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/useInfiniteStoriesLoading.d.ts +0 -0
- /package/build/{infinite-loading → cjs/infinite-loading}/useInfiniteStoriesLoading.js +0 -0
- /package/build/{intl → cjs/intl}/index.d.ts +0 -0
- /package/build/{intl → cjs/intl}/index.js +0 -0
- /package/build/{intl → cjs/intl}/languages.d.ts +0 -0
- /package/build/{intl → cjs/intl}/languages.js +0 -0
- /package/build/{intl → cjs/intl}/locale.d.ts +0 -0
- /package/build/{intl → cjs/intl}/locale.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/context.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/index.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/index.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useAlgoliaSettings.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useAlgoliaSettings.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCategories.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCategories.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCompanyInformation.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCompanyInformation.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCurrentCategory.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCurrentCategory.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCurrentLocale.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCurrentLocale.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCurrentStory.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useCurrentStory.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useGetLinkLocaleSlug.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useGetLinkLocaleSlug.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useGetTranslationUrl.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useGetTranslationUrl.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useLanguages.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useLanguages.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useNewsroom.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useNewsroom.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useNewsroomContext.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/hooks/useNewsroomContext.js +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/index.d.ts +0 -0
- /package/build/{newsroom-context → cjs/newsroom-context}/index.js +0 -0
- /package/build/{sentry → cjs/sentry}/client.d.ts +0 -0
- /package/build/{sentry → cjs/sentry}/client.js +0 -0
- /package/build/{sentry → cjs/sentry}/common.d.ts +0 -0
- /package/build/{sentry → cjs/sentry}/common.js +0 -0
- /package/build/{sentry → cjs/sentry}/index.d.ts +0 -0
- /package/build/{sentry → cjs/sentry}/index.js +0 -0
- /package/build/{sentry → cjs/sentry}/server.d.ts +0 -0
- /package/build/{sentry → cjs/sentry}/server.js +0 -0
- /package/build/{types.d.ts → cjs/types.d.ts} +0 -0
- /package/build/{types.js → cjs/types.js} +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DEFAULT_GALLERY_PAGE_SIZE } from '@prezly/theme-kit-core';
|
|
2
|
+
import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
|
|
3
|
+
import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
|
|
4
|
+
import { processRequest } from '../processRequest';
|
|
5
|
+
import { processStaticRequest } from '../processStaticRequest';
|
|
6
|
+
export function getGalleryPageServerSideProps(customProps, options) {
|
|
7
|
+
const { pageSize = DEFAULT_GALLERY_PAGE_SIZE } = options || {};
|
|
8
|
+
return async function getServerSideProps(context) {
|
|
9
|
+
const { api, serverSideProps } = await getNewsroomServerSideProps(context);
|
|
10
|
+
const { query } = context;
|
|
11
|
+
const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
|
|
12
|
+
const { galleries, pagination } = await api.getGalleries({ page, pageSize });
|
|
13
|
+
// If there's only one gallery, redirect to it immediately
|
|
14
|
+
if (galleries.length === 1) {
|
|
15
|
+
const { uuid } = galleries[0];
|
|
16
|
+
return {
|
|
17
|
+
redirect: {
|
|
18
|
+
destination: `/media/album/${uuid}`,
|
|
19
|
+
permanent: false,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return processRequest(context, {
|
|
24
|
+
...serverSideProps,
|
|
25
|
+
galleries,
|
|
26
|
+
pagination: {
|
|
27
|
+
itemsTotal: pagination.matched_records_number,
|
|
28
|
+
currentPage: page ?? 1,
|
|
29
|
+
pageSize,
|
|
30
|
+
},
|
|
31
|
+
...(typeof customProps === 'function'
|
|
32
|
+
? await customProps(context, serverSideProps)
|
|
33
|
+
: customProps),
|
|
34
|
+
}, '/media');
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function getGalleryPageStaticProps(customProps, options) {
|
|
38
|
+
const { pageSize = DEFAULT_GALLERY_PAGE_SIZE } = options || {};
|
|
39
|
+
return async function getStaticProps(context) {
|
|
40
|
+
const { api, staticProps } = await getNewsroomStaticProps(context);
|
|
41
|
+
const { galleries, pagination } = await api.getGalleries({ pageSize });
|
|
42
|
+
// If there's only one gallery, redirect to it immediately
|
|
43
|
+
if (galleries.length === 1) {
|
|
44
|
+
const { uuid } = galleries[0];
|
|
45
|
+
return {
|
|
46
|
+
redirect: {
|
|
47
|
+
destination: `/media/album/${uuid}`,
|
|
48
|
+
permanent: false,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return processStaticRequest(context, {
|
|
53
|
+
...staticProps,
|
|
54
|
+
galleries,
|
|
55
|
+
pagination: {
|
|
56
|
+
itemsTotal: pagination.matched_records_number,
|
|
57
|
+
currentPage: 1,
|
|
58
|
+
pageSize,
|
|
59
|
+
},
|
|
60
|
+
...(typeof customProps === 'function'
|
|
61
|
+
? await customProps(context, staticProps)
|
|
62
|
+
: customProps),
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=gallery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gallery.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/gallery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AASnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAa/D,MAAM,UAAU,6BAA6B,CACzC,WAAqD,EACrD,OAAiB;IAEjB,MAAM,EAAE,QAAQ,GAAG,yBAAyB,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE/D,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,MAAM,0BAA0B,CAAC,OAAO,CAAC,CAAC;QAC3E,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAE1B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAA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SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YAE9B,OAAO;gBACH,QAAQ,EAAE;oBACN,WAAW,EAAE,gBAAgB,IAAI,EAAE;oBACnC,SAAS,EAAE,KAAK;iBACnB;aACJ,CAAC;SACL;QAED,OAAO,oBAAoB,CAAC,OAAO,EAAE;YACjC,GAAG,WAAW;YACd,SAAS;YACT,UAAU,EAAE;gBACR,UAAU,EAAE,UAAU,CAAC,sBAAsB;gBAC7C,WAAW,EAAE,CAAC;gBACd,QAAQ;aACX;YACD,GAAG,CAAC,OAAO,WAAW,KAAK,UAAU;gBACjC,CAAC,CAAC,MAAO,WAAiE,CACpE,OAAO,EACP,WAAW,CACd;gBACH,CAAC,CAAC,WAAW,CAAC;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getNextPrezlyApi } from '../../data-fetching';
|
|
2
|
+
import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
|
|
3
|
+
import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
|
|
4
|
+
import { processRequest } from '../processRequest';
|
|
5
|
+
import { processStaticRequest } from '../processStaticRequest';
|
|
6
|
+
export function getGalleryAlbumPageServerSideProps(customProps) {
|
|
7
|
+
return async function getServerSideProps(context) {
|
|
8
|
+
const { api, serverSideProps } = await getNewsroomServerSideProps(context);
|
|
9
|
+
const { uuid } = context.params;
|
|
10
|
+
const gallery = await api.getGallery(uuid);
|
|
11
|
+
if (!gallery || !gallery.images_number) {
|
|
12
|
+
return { notFound: true };
|
|
13
|
+
}
|
|
14
|
+
return processRequest(context, {
|
|
15
|
+
...serverSideProps,
|
|
16
|
+
gallery,
|
|
17
|
+
...(typeof customProps === 'function'
|
|
18
|
+
? await customProps(context, serverSideProps)
|
|
19
|
+
: customProps),
|
|
20
|
+
}, `/media/album/${uuid}`);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function getGalleryAlbumPageStaticProps(customProps) {
|
|
24
|
+
return async function getStaticProps(context) {
|
|
25
|
+
const { api, staticProps } = await getNewsroomStaticProps(context);
|
|
26
|
+
const { uuid } = context.params;
|
|
27
|
+
const gallery = await api.getGallery(uuid);
|
|
28
|
+
if (!gallery || !gallery.images_number) {
|
|
29
|
+
return { notFound: true };
|
|
30
|
+
}
|
|
31
|
+
return processStaticRequest(context, {
|
|
32
|
+
...staticProps,
|
|
33
|
+
gallery,
|
|
34
|
+
...(typeof customProps === 'function'
|
|
35
|
+
? await customProps(context, staticProps)
|
|
36
|
+
: customProps),
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export async function getGalleryAlbumPageStaticPaths() {
|
|
41
|
+
const api = getNextPrezlyApi();
|
|
42
|
+
const { galleries } = await api.getGalleries({});
|
|
43
|
+
const paths = galleries.map(({ uuid }) => ({ params: { uuid } }));
|
|
44
|
+
return {
|
|
45
|
+
paths,
|
|
46
|
+
fallback: 'blocking',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=galleryAlbum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"galleryAlbum.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/galleryAlbum.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAQ/D,MAAM,UAAU,kCAAkC,CAC9C,WAAqD;IAErD,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,EAA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;IACP,CAAC,CAAC;AACN,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,8BAA8B;IAChD,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAEjD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAElE,OAAO;QACH,KAAK;QACL,QAAQ,EAAE,UAAU;KACvB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { DEFAULT_PAGE_SIZE } from '@prezly/theme-kit-core';
|
|
2
|
+
import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
|
|
3
|
+
import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
|
|
4
|
+
import { processRequest } from '../processRequest';
|
|
5
|
+
import { processStaticRequest } from '../processStaticRequest';
|
|
6
|
+
export function getHomepageServerSideProps(customProps, options) {
|
|
7
|
+
const { pageSize = DEFAULT_PAGE_SIZE, extraStoryFields, pinning = false, withHighlightedStory = false, filterQuery, } = options || {};
|
|
8
|
+
return async function getServerSideProps(context) {
|
|
9
|
+
const { api, serverSideProps } = await getNewsroomServerSideProps(context, {
|
|
10
|
+
loadHomepageContacts: true,
|
|
11
|
+
});
|
|
12
|
+
const { query } = context;
|
|
13
|
+
const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
|
|
14
|
+
const { localeCode } = serverSideProps.newsroomContextProps;
|
|
15
|
+
const storiesPaginated = await api.getStories({
|
|
16
|
+
page,
|
|
17
|
+
pageSize,
|
|
18
|
+
pinning,
|
|
19
|
+
include: extraStoryFields,
|
|
20
|
+
localeCode,
|
|
21
|
+
withHighlightedStory,
|
|
22
|
+
filterQuery,
|
|
23
|
+
});
|
|
24
|
+
const { stories, storiesTotal } = storiesPaginated;
|
|
25
|
+
return processRequest(context, {
|
|
26
|
+
...serverSideProps,
|
|
27
|
+
// TODO: This is temporary until return types from API are figured out
|
|
28
|
+
stories: stories,
|
|
29
|
+
pagination: {
|
|
30
|
+
itemsTotal: storiesTotal,
|
|
31
|
+
currentPage: page ?? 1,
|
|
32
|
+
pageSize,
|
|
33
|
+
withHighlightedStory,
|
|
34
|
+
},
|
|
35
|
+
...(typeof customProps === 'function'
|
|
36
|
+
? await customProps(context, serverSideProps)
|
|
37
|
+
: customProps),
|
|
38
|
+
}, '/');
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function getHomepageStaticProps(customProps, options) {
|
|
42
|
+
const { pageSize = DEFAULT_PAGE_SIZE, extraStoryFields, pinning = false } = options || {};
|
|
43
|
+
return async function getStaticProps(context) {
|
|
44
|
+
const { api, staticProps } = await getNewsroomStaticProps(context, {
|
|
45
|
+
loadHomepageContacts: true,
|
|
46
|
+
});
|
|
47
|
+
const { localeCode } = staticProps.newsroomContextProps;
|
|
48
|
+
const storiesPaginated = await api.getStories({
|
|
49
|
+
pageSize,
|
|
50
|
+
pinning,
|
|
51
|
+
include: extraStoryFields,
|
|
52
|
+
localeCode,
|
|
53
|
+
});
|
|
54
|
+
const { stories, storiesTotal } = storiesPaginated;
|
|
55
|
+
return processStaticRequest(context, {
|
|
56
|
+
...staticProps,
|
|
57
|
+
// TODO: This is temporary until return types from API are figured out
|
|
58
|
+
stories: stories,
|
|
59
|
+
pagination: {
|
|
60
|
+
itemsTotal: storiesTotal,
|
|
61
|
+
currentPage: 1,
|
|
62
|
+
pageSize,
|
|
63
|
+
},
|
|
64
|
+
...(typeof customProps === 'function'
|
|
65
|
+
? await customProps(context, staticProps)
|
|
66
|
+
: customProps),
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=home.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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,CAAC,MAAO,WAAiE,CACpE,OAAO,EACP,WAAW,CACd;gBACH,CAAC,CAAC,WAAW,CAAC;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { getCategoryPageServerSideProps, getCategoryPageStaticPaths, getCategoryPageStaticProps, } from './category';
|
|
2
|
+
export { getGalleryPageServerSideProps, getGalleryPageStaticProps, } from './gallery';
|
|
3
|
+
export { getGalleryAlbumPageServerSideProps, getGalleryAlbumPageStaticPaths, getGalleryAlbumPageStaticProps, } from './galleryAlbum';
|
|
4
|
+
export { getHomepageServerSideProps, getHomepageStaticProps } from './home';
|
|
5
|
+
export { getSearchPageServerSideProps, getSearchPageStaticProps } from './search';
|
|
6
|
+
export * from './sitemap';
|
|
7
|
+
export { getStoryPageServerSideProps, getStoryPageStaticPaths, getStoryPageStaticProps, } from './story';
|
|
8
|
+
export { getStoryPreviewPageServerSideProps } from './storyPreview';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,GAE7B,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,6BAA6B,EAC7B,yBAAyB,GAE5B,MAAM,WAAW,CAAC;AACnB,OAAO,EACH,kCAAkC,EAClC,8BAA8B,EAC9B,8BAA8B,GAEjC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAsB,MAAM,QAAQ,CAAC;AAChG,OAAO,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAClF,cAAc,WAAW,CAAC;AAC1B,OAAO,EACH,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,GAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kCAAkC,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/adapter-nextjs/page-props/lib/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
|
|
2
|
+
import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
|
|
3
|
+
import { processRequest } from '../processRequest';
|
|
4
|
+
import { processStaticRequest } from '../processStaticRequest';
|
|
5
|
+
export function getSearchPageServerSideProps(customProps) {
|
|
6
|
+
return async function getServerSideProps(context) {
|
|
7
|
+
const { serverSideProps } = await getNewsroomServerSideProps(context);
|
|
8
|
+
return processRequest(context, {
|
|
9
|
+
...serverSideProps,
|
|
10
|
+
...(typeof customProps === 'function'
|
|
11
|
+
? await customProps(context, serverSideProps)
|
|
12
|
+
: customProps),
|
|
13
|
+
}, '/search');
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function getSearchPageStaticProps(customProps) {
|
|
17
|
+
return async function getStaticProps(context) {
|
|
18
|
+
const { staticProps } = await getNewsroomStaticProps(context);
|
|
19
|
+
return processStaticRequest(context, {
|
|
20
|
+
...staticProps,
|
|
21
|
+
...(typeof customProps === 'function'
|
|
22
|
+
? await customProps(context, staticProps)
|
|
23
|
+
: customProps),
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/search.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAI/D,MAAM,UAAU,4BAA4B,CACxC,WAAqD;IAErD,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,0BAA0B,CAAC,OAAO,CAAC,CAAC;QAEtE,OAAO,cAAc,CACjB,OAAO,EACP;YACI,GAAG,eAAe;YAClB,GAAG,CAAC,OAAO,WAAW,KAAK,UAAU;gBACjC,CAAC,CAAC,MAAO,WAA0C,CAAC,OAAO,EAAE,eAAe,CAAC;gBAC7E,CAAC,CAAC,WAAW,CAAC;SACrB,EACD,SAAS,CACZ,CAAC;IACN,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,wBAAwB,CACpC,WAA4E;IAE5E,OAAO,KAAK,UAAU,cAAc,CAChC,OAAkC;QAElC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAE9D,OAAO,oBAAoB,CAAC,OAAO,EAAE;YACjC,GAAG,WAAW;YACd,GAAG,CAAC,OAAO,WAAW,KAAK,UAAU;gBACjC,CAAC,CAAC,MAAO,WAAiE,CACpE,OAAO,EACP,WAAW,CACd;gBACH,CAAC,CAAC,WAAW,CAAC;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export class SitemapBuilder {
|
|
2
|
+
baseUrl;
|
|
3
|
+
urls = [];
|
|
4
|
+
constructor(baseUrl) {
|
|
5
|
+
this.baseUrl = baseUrl;
|
|
6
|
+
}
|
|
7
|
+
addUrl(location) {
|
|
8
|
+
this.urls.push({
|
|
9
|
+
location: this.baseUrl + location,
|
|
10
|
+
changeFrequency: SitemapBuilder.guessFrequency(location),
|
|
11
|
+
priority: SitemapBuilder.guessPriority(location),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
static guessFrequency(location) {
|
|
15
|
+
if (location === '/')
|
|
16
|
+
return 'daily';
|
|
17
|
+
return 'weekly';
|
|
18
|
+
}
|
|
19
|
+
static guessPriority(location) {
|
|
20
|
+
if (location === '/')
|
|
21
|
+
return '0.9';
|
|
22
|
+
if (location.startsWith('/category/')) {
|
|
23
|
+
return '0.8';
|
|
24
|
+
}
|
|
25
|
+
return '0.7';
|
|
26
|
+
}
|
|
27
|
+
static serializeLocation(url) {
|
|
28
|
+
return [
|
|
29
|
+
'<url>',
|
|
30
|
+
url.location && `\t<loc>${url.location}</loc>`,
|
|
31
|
+
url.changeFrequency && `\t<changefreq>${url.changeFrequency}</changefreq>`,
|
|
32
|
+
url.priority && `\t<priority>${url.priority}</priority>`,
|
|
33
|
+
'</url>',
|
|
34
|
+
]
|
|
35
|
+
.filter(Boolean)
|
|
36
|
+
.join('\n');
|
|
37
|
+
}
|
|
38
|
+
serialize() {
|
|
39
|
+
return [
|
|
40
|
+
'<?xml version="1.0" encoding="UTF-8" ?>',
|
|
41
|
+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">',
|
|
42
|
+
this.urls.map(SitemapBuilder.serializeLocation).join('\n'),
|
|
43
|
+
'</urlset>',
|
|
44
|
+
].join('\n');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=SitemapBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SitemapBuilder.js","sourceRoot":"","sources":["../../../../../src/adapter-nextjs/page-props/sitemap/SitemapBuilder.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IACf,OAAO,CAAS;IAEhB,IAAI,GAAiB,EAAE,CAAC;IAEhC,YAAY,OAAe;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,QAAgB;QAC1B,IAAI,CAAC,IAAI,CAAC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categoriesUrls = categories
|
|
4
|
+
.map((category) => {
|
|
5
|
+
const translations = Object.values(category.i18n);
|
|
6
|
+
const allSlugs = translations
|
|
7
|
+
.map(({ slug }) => slug || '')
|
|
8
|
+
.filter(Boolean)
|
|
9
|
+
.reduce((slugs, slug) => (slugs.includes(slug) ? [...slugs] : [...slugs, slug]), []);
|
|
10
|
+
return allSlugs.map((slug) => `/category/${slug}`);
|
|
11
|
+
})
|
|
12
|
+
.flat();
|
|
13
|
+
return [...storiesUrls, ...categoriesUrls];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=createPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPaths.js","sourceRoot":"","sources":["../../../../../src/adapter-nextjs/page-props/sitemap/createPaths.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,UAAsB;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAC1D,MAAM,cAAc,GAAG,UAAU;SAC5B,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QACd,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,QAAQ,GAAG,YAAY;aACxB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;aAC7B,MAAM,CAAC,OAAO,CAAC;aACf,MAAM,CACH,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,EACvE,EAAE,CACL,CAAC;QAEN,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC;SACD,IAAI,EAAE,CAAC;IAEZ,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,cAAc,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getNextPrezlyApi } from '../../../data-fetching';
|
|
2
|
+
import { createPaths } from './createPaths';
|
|
3
|
+
import { SitemapBuilder } from './SitemapBuilder';
|
|
4
|
+
export function getSitemapServerSideProps(options = {}) {
|
|
5
|
+
return async function getServerSideProps(ctx) {
|
|
6
|
+
const { res, req } = ctx;
|
|
7
|
+
if (!req || !res) {
|
|
8
|
+
// client side
|
|
9
|
+
return {
|
|
10
|
+
props: {},
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const baseUrl = req.headers.host || '/';
|
|
14
|
+
const api = getNextPrezlyApi(req);
|
|
15
|
+
const stories = await api.getAllStories({
|
|
16
|
+
pinning: options.pinning ?? false,
|
|
17
|
+
});
|
|
18
|
+
const categories = await api.getCategories();
|
|
19
|
+
const paths = createPaths(stories, categories);
|
|
20
|
+
const sitemapBuilder = new SitemapBuilder(baseUrl);
|
|
21
|
+
sitemapBuilder.addUrl('/');
|
|
22
|
+
paths.forEach((path) => sitemapBuilder.addUrl(path));
|
|
23
|
+
options.additionalPaths?.forEach((path) => sitemapBuilder.addUrl(path));
|
|
24
|
+
res.setHeader('Content-Type', 'text/xml');
|
|
25
|
+
res.write(sitemapBuilder.serialize());
|
|
26
|
+
res.end();
|
|
27
|
+
return {
|
|
28
|
+
props: {},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=getServerSideProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getServerSideProps.js","sourceRoot":"","sources":["../../../../../src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts"],"names":[],"mappings":"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AAC,SAAS,EAAE,CAAC,CAAC;QACtC,GAAG,CAAC,GAAG,EAAE,CAAC;QAEV,OAAO;YACH,KAAK,EAAE,EAAE;SACZ,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/adapter-nextjs/page-props/sitemap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/adapter-nextjs/page-props/sitemap/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { getNextPrezlyApi } from '../../data-fetching';
|
|
2
|
+
import { DUMMY_DEFAULT_LOCALE } from '../../intl';
|
|
3
|
+
import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
|
|
4
|
+
import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
|
|
5
|
+
import { processRequest } from '../processRequest';
|
|
6
|
+
import { processStaticRequest } from '../processStaticRequest';
|
|
7
|
+
export function getStoryPageServerSideProps(customProps) {
|
|
8
|
+
return async function getServerSideProps(context) {
|
|
9
|
+
const api = getNextPrezlyApi(context.req);
|
|
10
|
+
const { slug } = context.params;
|
|
11
|
+
const story = slug ? await api.getStoryBySlug(slug) : null;
|
|
12
|
+
if (!story) {
|
|
13
|
+
return { notFound: true };
|
|
14
|
+
}
|
|
15
|
+
const { serverSideProps } = await getNewsroomServerSideProps(context, { story });
|
|
16
|
+
const { locale } = context;
|
|
17
|
+
if (locale && locale !== DUMMY_DEFAULT_LOCALE) {
|
|
18
|
+
return {
|
|
19
|
+
redirect: {
|
|
20
|
+
destination: `/${slug}`,
|
|
21
|
+
permanent: true,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
serverSideProps.newsroomContextProps.currentStory = story;
|
|
26
|
+
return processRequest(context, {
|
|
27
|
+
...serverSideProps,
|
|
28
|
+
...(typeof customProps === 'function'
|
|
29
|
+
? await customProps(context, serverSideProps)
|
|
30
|
+
: customProps),
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function getStoryPageStaticProps(customProps) {
|
|
35
|
+
return async function getStaticProps(context) {
|
|
36
|
+
const api = getNextPrezlyApi();
|
|
37
|
+
const { slug } = context.params;
|
|
38
|
+
const story = slug ? await api.getStoryBySlug(slug) : null;
|
|
39
|
+
if (!story) {
|
|
40
|
+
return { notFound: true };
|
|
41
|
+
}
|
|
42
|
+
const { staticProps } = await getNewsroomStaticProps(context, { story });
|
|
43
|
+
staticProps.newsroomContextProps.currentStory = story;
|
|
44
|
+
return processStaticRequest(context, {
|
|
45
|
+
...staticProps,
|
|
46
|
+
...(typeof customProps === 'function'
|
|
47
|
+
? await customProps(context, staticProps)
|
|
48
|
+
: customProps),
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export async function getStoryPageStaticPaths(options = {}) {
|
|
53
|
+
const api = getNextPrezlyApi();
|
|
54
|
+
const stories = await api.getAllStories({
|
|
55
|
+
pinning: options.pinning ?? false,
|
|
56
|
+
});
|
|
57
|
+
const paths = stories.map(({ slug }) => ({ params: { slug } }));
|
|
58
|
+
return {
|
|
59
|
+
paths,
|
|
60
|
+
fallback: 'blocking',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/story.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBA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CAAC,CAAC;IAEhE,OAAO;QACH,KAAK;QACL,QAAQ,EAAE,UAAU;KACvB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getNextPrezlyApi } from '../../data-fetching';
|
|
2
|
+
import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
|
|
3
|
+
import { processRequest } from '../processRequest';
|
|
4
|
+
export function getStoryPreviewPageServerSideProps(customProps) {
|
|
5
|
+
return async function getServerSideProps(context) {
|
|
6
|
+
const api = getNextPrezlyApi(context.req);
|
|
7
|
+
const { uuid } = context.params;
|
|
8
|
+
const story = await api.getStory(uuid);
|
|
9
|
+
if (!story) {
|
|
10
|
+
return { notFound: true };
|
|
11
|
+
}
|
|
12
|
+
const { serverSideProps } = await getNewsroomServerSideProps(context, { story });
|
|
13
|
+
serverSideProps.newsroomContextProps.currentStory = story;
|
|
14
|
+
return processRequest(context, {
|
|
15
|
+
...serverSideProps,
|
|
16
|
+
...(typeof customProps === 'function'
|
|
17
|
+
? await customProps(context, serverSideProps)
|
|
18
|
+
: customProps),
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=storyPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storyPreview.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/storyPreview.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD,MAAM,UAAU,kCAAkC,CAC9C,WAAqD;IAErD,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,GAAG,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAA0B,CAAC;QACpD,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7B;QAED,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,0BAA0B,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAEjF,eAAe,CAAC,oBAAoB,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1D,OAAO,cAAc,CAAC,OAAO,EAAE;YAC3B,GAAG,eAAe;YAClB,GAAG,CAAC,OAAO,WAAW,KAAK,UAAU;gBACjC,CAAC,CAAC,MAAO,WAA0C,CAAC,OAAO,EAAE,eAAe,CAAC;gBAC7E,CAAC,CAAC,WAAW,CAAC;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getShortestLocaleCode, LocaleObject } from '@prezly/theme-kit-core';
|
|
2
|
+
import { getRedirectToCanonicalLocale } from '../intl';
|
|
3
|
+
/**
|
|
4
|
+
* This function combines the props returned from `getNewsroomServerSideProps` and your optional custom props for the page.
|
|
5
|
+
* It also handles locale redirects, if `canonicalUrl` parameter is provided.
|
|
6
|
+
* See README for usage examples.
|
|
7
|
+
*
|
|
8
|
+
* @param context Next.js context passed to the `getServerSideProps` method of the page
|
|
9
|
+
* @param props Object containing the return of `getNewsroomServerSideProps` and your optional custom props.
|
|
10
|
+
* @param canonicalUrl Optional: a canonical URL for the current page without locale part. If provided, locale redirects will be handled by the function.
|
|
11
|
+
*/
|
|
12
|
+
export function processRequest(context, props, canonicalUrl) {
|
|
13
|
+
const { locale: nextLocale, query } = context;
|
|
14
|
+
const { localeResolved, ...pageProps } = props;
|
|
15
|
+
// If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
|
|
16
|
+
// In that case we won't show 404 page.
|
|
17
|
+
if (!localeResolved && nextLocale) {
|
|
18
|
+
return { notFound: true };
|
|
19
|
+
}
|
|
20
|
+
if (canonicalUrl) {
|
|
21
|
+
const { languages, localeCode } = pageProps.newsroomContextProps;
|
|
22
|
+
const currentLocale = LocaleObject.fromAnyCode(localeCode);
|
|
23
|
+
const shortestLocaleCode = getShortestLocaleCode(languages, currentLocale);
|
|
24
|
+
const redirect = getRedirectToCanonicalLocale(shortestLocaleCode, nextLocale, canonicalUrl, query);
|
|
25
|
+
if (redirect) {
|
|
26
|
+
return { redirect };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
props: pageProps,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=processRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/processRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAGvD;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC1B,OAAkC,EAClC,KAA8C,EAC9C,YAAqB;IAErB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE9C,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE;QAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,IAAI,YAAY,EAAE;QACd,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,oBAAoB,CAAC;QACjE,MAAM,aAAa,GAAG,YAAY,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3D,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,4BAA4B,CACzC,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,KAAK,CACR,CAAC;QACF,IAAI,QAAQ,EAAE;YACV,OAAO,EAAE,QAAQ,EAAE,CAAC;SACvB;KACJ;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;KACxC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function combines the props returned from `getNewsroomStaticProps` and your optional custom props for the page.
|
|
3
|
+
* See README for usage examples.
|
|
4
|
+
*
|
|
5
|
+
* @param context Next.js context passed to the `getStaticProps` method of the page
|
|
6
|
+
* @param props Object containing the return of `getNewsroomServerSideProps` and your optional custom props.
|
|
7
|
+
* @param revalidateTimeout Optional: timeout in seconds to use with Next ISR.
|
|
8
|
+
*/
|
|
9
|
+
export function processStaticRequest(context, props, revalidateTimeout) {
|
|
10
|
+
const { locale: nextLocale } = context;
|
|
11
|
+
const { localeResolved, ...pageProps } = props;
|
|
12
|
+
// If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
|
|
13
|
+
// In that case we won't show 404 page.
|
|
14
|
+
if (!localeResolved && nextLocale) {
|
|
15
|
+
return { notFound: true };
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
props: pageProps,
|
|
19
|
+
revalidate: revalidateTimeout,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=processStaticRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processStaticRequest.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/processStaticRequest.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAChC,OAA8B,EAC9B,KAA8C,EAC9C,iBAA0B;IAE1B,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE;QAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;QACrC,UAAU,EAAE,iBAAiB;KAChC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getAlternateLanguageLinks, getNewsroomLogoUrl, getUsedLanguages, } from '@prezly/theme-kit-core';
|
|
3
|
+
import { useRouter } from 'next/router';
|
|
4
|
+
import { NextSeo } from 'next-seo';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { useCompanyInformation, useCurrentLocale, useCurrentStory, useGetLinkLocaleSlug, useGetTranslationUrl, useLanguages, useNewsroom, } from '../../newsroom-context';
|
|
7
|
+
import { getAbsoluteUrl } from './lib';
|
|
8
|
+
/**
|
|
9
|
+
* This component provides base page attributes for every Newsroom page.
|
|
10
|
+
* It depends on information from NewsroomContext, so the component should be placed inside the `NewsroomContextProvider`.
|
|
11
|
+
* You can pass additional props expected by NextSeo component to override any info that is provided by the NewsroomContext.
|
|
12
|
+
*/
|
|
13
|
+
export function PageSeo({ title, description, imageUrl, canonical, openGraph, twitter, ...nextSeoProps }) {
|
|
14
|
+
const companyInformation = useCompanyInformation();
|
|
15
|
+
const site = useNewsroom();
|
|
16
|
+
const currentLocale = useCurrentLocale();
|
|
17
|
+
const languages = useLanguages();
|
|
18
|
+
const getTranslationUrl = useGetTranslationUrl();
|
|
19
|
+
const getLinkLocaleSlug = useGetLinkLocaleSlug();
|
|
20
|
+
const currentStory = useCurrentStory();
|
|
21
|
+
const { asPath } = useRouter();
|
|
22
|
+
const pageTitle = companyInformation.seo_settings.meta_title ||
|
|
23
|
+
companyInformation.seo_settings.default_meta_title ||
|
|
24
|
+
title ||
|
|
25
|
+
companyInformation.name;
|
|
26
|
+
const pageDescription = companyInformation.seo_settings.meta_description ||
|
|
27
|
+
companyInformation.seo_settings.default_meta_description ||
|
|
28
|
+
description ||
|
|
29
|
+
companyInformation.about_plaintext;
|
|
30
|
+
const canonicalUrl = canonical || getAbsoluteUrl(asPath, site.url, getLinkLocaleSlug(currentLocale));
|
|
31
|
+
const siteName = companyInformation.name;
|
|
32
|
+
const logoUrl = imageUrl || getNewsroomLogoUrl(site);
|
|
33
|
+
const alternateLanguageLinks = useMemo(() => {
|
|
34
|
+
if (!languages.length) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const usedLanguages = getUsedLanguages(languages);
|
|
38
|
+
return getAlternateLanguageLinks(usedLanguages, (locale) => {
|
|
39
|
+
const translationUrl = getTranslationUrl(locale);
|
|
40
|
+
if (!translationUrl) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return getAbsoluteUrl(translationUrl, site.url, currentStory && translationUrl !== '/' ? false : getLinkLocaleSlug(locale));
|
|
44
|
+
});
|
|
45
|
+
}, [currentStory, getLinkLocaleSlug, getTranslationUrl, languages, site.url]);
|
|
46
|
+
return (_jsx(NextSeo, { title: pageTitle, description: pageDescription, canonical: canonicalUrl, noindex: nextSeoProps.noindex ?? !site.is_indexable, nofollow: nextSeoProps.nofollow ?? !site.is_indexable, openGraph: {
|
|
47
|
+
url: canonicalUrl,
|
|
48
|
+
title: pageTitle,
|
|
49
|
+
description: pageDescription,
|
|
50
|
+
locale: currentLocale.toUnderscoreCode(),
|
|
51
|
+
images: [
|
|
52
|
+
{
|
|
53
|
+
url: logoUrl,
|
|
54
|
+
alt: pageTitle,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
site_name: siteName,
|
|
58
|
+
...openGraph,
|
|
59
|
+
}, twitter: {
|
|
60
|
+
site: siteName,
|
|
61
|
+
cardType: 'summary',
|
|
62
|
+
...twitter,
|
|
63
|
+
}, additionalMetaTags: [
|
|
64
|
+
{ name: 'twitter:image', content: logoUrl },
|
|
65
|
+
site.google_search_console_key && {
|
|
66
|
+
name: 'google-site-verification',
|
|
67
|
+
content: site.google_search_console_key,
|
|
68
|
+
},
|
|
69
|
+
].filter((tag) => Boolean(tag)), additionalLinkTags: [
|
|
70
|
+
{
|
|
71
|
+
rel: 'alternate',
|
|
72
|
+
type: 'application/rss+xml',
|
|
73
|
+
href: getAbsoluteUrl('/feed', site.url),
|
|
74
|
+
},
|
|
75
|
+
], languageAlternates: alternateLanguageLinks, ...nextSeoProps }));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=PageSeo.js.map
|