@prezly/theme-kit-nextjs 1.18.2 → 2.0.0-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/@types/global.d.js +1 -0
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js +27 -23
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
- package/build/adapter-nextjs/api-handlers/fetchStories.js +37 -25
- package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
- package/build/adapter-nextjs/api-handlers/index.js +2 -8
- package/build/adapter-nextjs/api-handlers/index.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomServerSideProps.js +16 -15
- package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomStaticProps.js +15 -15
- package/build/adapter-nextjs/getNewsroomStaticProps.js.map +1 -1
- package/build/adapter-nextjs/index.js +6 -23
- package/build/adapter-nextjs/index.js.map +1 -1
- package/build/adapter-nextjs/page-props/category.d.ts +2 -2
- package/build/adapter-nextjs/page-props/category.js +118 -100
- package/build/adapter-nextjs/page-props/category.js.map +1 -1
- package/build/adapter-nextjs/page-props/gallery.js +87 -68
- package/build/adapter-nextjs/page-props/gallery.js.map +1 -1
- package/build/adapter-nextjs/page-props/galleryAlbum.js +64 -53
- package/build/adapter-nextjs/page-props/galleryAlbum.js.map +1 -1
- package/build/adapter-nextjs/page-props/home.d.ts +2 -2
- package/build/adapter-nextjs/page-props/home.js +83 -69
- package/build/adapter-nextjs/page-props/home.js.map +1 -1
- package/build/adapter-nextjs/page-props/index.js +8 -42
- package/build/adapter-nextjs/page-props/index.js.map +1 -1
- package/build/adapter-nextjs/page-props/lib/types.js +1 -3
- package/build/adapter-nextjs/page-props/search.js +25 -31
- package/build/adapter-nextjs/page-props/search.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +29 -50
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js +13 -19
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +33 -35
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/index.js +4 -25
- package/build/adapter-nextjs/page-props/sitemap/index.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/types.js +1 -3
- package/build/adapter-nextjs/page-props/story.js +77 -64
- package/build/adapter-nextjs/page-props/story.js.map +1 -1
- package/build/adapter-nextjs/page-props/storyPreview.js +27 -26
- package/build/adapter-nextjs/page-props/storyPreview.js.map +1 -1
- package/build/adapter-nextjs/processRequest.js +34 -25
- package/build/adapter-nextjs/processRequest.js.map +1 -1
- package/build/adapter-nextjs/processStaticRequest.js +19 -16
- package/build/adapter-nextjs/processStaticRequest.js.map +1 -1
- package/build/components-nextjs/PageSeo/PageSeo.js +84 -78
- package/build/components-nextjs/PageSeo/PageSeo.js.map +1 -1
- package/build/components-nextjs/PageSeo/index.js +2 -21
- package/build/components-nextjs/PageSeo/index.js.map +1 -1
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +5 -10
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +1 -1
- package/build/components-nextjs/PageSeo/lib/types.js +1 -3
- package/build/components-nextjs/StorySeo/StorySeo.js +69 -47
- package/build/components-nextjs/StorySeo/StorySeo.js.map +1 -1
- package/build/components-nextjs/StorySeo/index.js +1 -6
- package/build/components-nextjs/StorySeo/index.js.map +1 -1
- package/build/components-nextjs/document.js +31 -48
- package/build/components-nextjs/document.js.map +1 -1
- package/build/components-nextjs/index.js +3 -10
- package/build/components-nextjs/index.js.map +1 -1
- package/build/data-fetching/api/PrezlyApi.d.ts +4 -5
- package/build/data-fetching/api/PrezlyApi.js +207 -192
- package/build/data-fetching/api/PrezlyApi.js.map +1 -1
- package/build/data-fetching/api/getPrezlyApi.js +21 -21
- package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
- package/build/data-fetching/api/index.js +1 -18
- package/build/data-fetching/api/index.js.map +1 -1
- package/build/data-fetching/api/queries.js +76 -47
- package/build/data-fetching/api/queries.js.map +1 -1
- package/build/data-fetching/index.js +3 -20
- package/build/data-fetching/index.js.map +1 -1
- package/build/data-fetching/lib/getAlgoliaSettings.js +22 -22
- package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
- package/build/data-fetching/lib/getEnvVariables.js +35 -38
- package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
- package/build/data-fetching/lib/index.js +4 -12
- package/build/data-fetching/lib/index.js.map +1 -1
- package/build/data-fetching/lib/isSdkError.js +3 -8
- package/build/data-fetching/lib/isSdkError.js.map +1 -1
- package/build/data-fetching/lib/isUuid.js +3 -8
- package/build/data-fetching/lib/isUuid.js.map +1 -1
- package/build/data-fetching/types.js +1 -3
- package/build/index.js +9 -26
- package/build/index.js.map +1 -1
- package/build/infinite-loading/index.js +4 -25
- package/build/infinite-loading/index.js.map +1 -1
- package/build/infinite-loading/types.js +1 -3
- package/build/infinite-loading/useInfiniteGalleriesLoading.js +42 -37
- package/build/infinite-loading/useInfiniteGalleriesLoading.js.map +1 -1
- package/build/infinite-loading/useInfiniteLoading.js +50 -43
- package/build/infinite-loading/useInfiniteLoading.js.map +1 -1
- package/build/infinite-loading/useInfiniteStoriesLoading.d.ts +2 -2
- package/build/infinite-loading/useInfiniteStoriesLoading.js +56 -50
- package/build/infinite-loading/useInfiniteStoriesLoading.js.map +1 -1
- package/build/intl/index.d.ts +1 -1
- package/build/intl/index.js +4 -26
- package/build/intl/index.js.map +1 -1
- package/build/intl/languages.d.ts +1 -1
- package/build/intl/languages.js +146 -122
- package/build/intl/languages.js.map +1 -1
- package/build/intl/locale.js +52 -107
- package/build/intl/locale.js.map +1 -1
- package/build/intl/localeConfig.d.ts +1 -2
- package/build/intl/localeConfig.js +7 -14
- package/build/intl/localeConfig.js.map +1 -1
- package/build/intl/localeList.d.ts +4 -2
- package/build/intl/localeList.js +1 -109
- package/build/intl/localeList.js.map +1 -1
- package/build/intl/localeObject.js +80 -82
- package/build/intl/localeObject.js.map +1 -1
- package/build/newsroom-context/context.js +35 -25
- package/build/newsroom-context/context.js.map +1 -1
- package/build/newsroom-context/hooks/index.js +11 -28
- package/build/newsroom-context/hooks/index.js.map +1 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +5 -10
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
- package/build/newsroom-context/hooks/useCategories.js +5 -10
- package/build/newsroom-context/hooks/useCategories.js.map +1 -1
- package/build/newsroom-context/hooks/useCompanyInformation.js +5 -10
- package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentCategory.js +5 -10
- package/build/newsroom-context/hooks/useCurrentCategory.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentLocale.js +5 -10
- package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentStory.js +5 -10
- package/build/newsroom-context/hooks/useCurrentStory.js.map +1 -1
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +17 -21
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +52 -55
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
- package/build/newsroom-context/hooks/useLanguages.js +5 -10
- package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroom.js +5 -10
- package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroomContext.js +11 -16
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
- package/build/newsroom-context/index.js +2 -22
- package/build/newsroom-context/index.js.map +1 -1
- package/build/sentry/client.js +4 -9
- package/build/sentry/client.js.map +1 -1
- package/build/sentry/common.js +26 -29
- package/build/sentry/common.js.map +1 -1
- package/build/sentry/index.js +2 -8
- package/build/sentry/index.js.map +1 -1
- package/build/sentry/server.js +4 -9
- package/build/sentry/server.js.map +1 -1
- package/build/types.d.ts +2 -2
- package/build/types.js +1 -3
- package/build/utils/boilerplate.js +7 -22
- package/build/utils/boilerplate.js.map +1 -1
- package/build/utils/constants.js +3 -7
- package/build/utils/constants.js.map +1 -1
- package/build/utils/getAssetsUrl.js +4 -9
- package/build/utils/getAssetsUrl.js.map +1 -1
- package/build/utils/getDataRequestLink.js +6 -12
- package/build/utils/getDataRequestLink.js.map +1 -1
- package/build/utils/getLocalizedCategoryData.js +33 -33
- package/build/utils/getLocalizedCategoryData.js.map +1 -1
- package/build/utils/getNewsroomLogoUrl.js +15 -21
- package/build/utils/getNewsroomLogoUrl.js.map +1 -1
- package/build/utils/getPrivacyPortalUrl.js +11 -13
- package/build/utils/getPrivacyPortalUrl.js.map +1 -1
- package/build/utils/getStoryPublicationDate.js +9 -14
- package/build/utils/getStoryPublicationDate.js.map +1 -1
- package/build/utils/getUploadcareGroupUrl.js +5 -10
- package/build/utils/getUploadcareGroupUrl.js.map +1 -1
- package/build/utils/index.js +10 -27
- package/build/utils/index.js.map +1 -1
- package/build/utils/isEmbargoStory.js +3 -8
- package/build/utils/isEmbargoStory.js.map +1 -1
- package/package.json +26 -18
- package/build/tsconfig.tsbuildinfo +0 -1
- package/src/@types/global.d.ts +0 -7
- package/src/__mocks__/languages.ts +0 -417
- package/src/__mocks__/story.ts +0 -351
- package/src/adapter-nextjs/api-handlers/fetchGalleries.ts +0 -24
- package/src/adapter-nextjs/api-handlers/fetchStories.ts +0 -26
- package/src/adapter-nextjs/api-handlers/index.ts +0 -2
- package/src/adapter-nextjs/getNewsroomServerSideProps.ts +0 -29
- package/src/adapter-nextjs/getNewsroomStaticProps.ts +0 -29
- package/src/adapter-nextjs/index.ts +0 -6
- package/src/adapter-nextjs/page-props/category.ts +0 -157
- package/src/adapter-nextjs/page-props/gallery.ts +0 -114
- package/src/adapter-nextjs/page-props/galleryAlbum.ts +0 -89
- package/src/adapter-nextjs/page-props/home.ts +0 -113
- package/src/adapter-nextjs/page-props/index.ts +0 -26
- package/src/adapter-nextjs/page-props/lib/types.ts +0 -8
- package/src/adapter-nextjs/page-props/search.ts +0 -53
- package/src/adapter-nextjs/page-props/sitemap/SitemapBuilder.ts +0 -56
- package/src/adapter-nextjs/page-props/sitemap/createPaths.ts +0 -21
- package/src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts +0 -43
- package/src/adapter-nextjs/page-props/sitemap/index.ts +0 -5
- package/src/adapter-nextjs/page-props/sitemap/types.ts +0 -5
- package/src/adapter-nextjs/page-props/story.ts +0 -94
- package/src/adapter-nextjs/page-props/storyPreview.ts +0 -33
- package/src/adapter-nextjs/processRequest.ts +0 -49
- package/src/adapter-nextjs/processStaticRequest.ts +0 -32
- package/src/components-nextjs/PageSeo/PageSeo.tsx +0 -131
- package/src/components-nextjs/PageSeo/index.ts +0 -2
- package/src/components-nextjs/PageSeo/lib/getAbsoluteUrl.ts +0 -7
- package/src/components-nextjs/PageSeo/lib/types.ts +0 -4
- package/src/components-nextjs/StorySeo/StorySeo.tsx +0 -80
- package/src/components-nextjs/StorySeo/index.ts +0 -1
- package/src/components-nextjs/document.tsx +0 -38
- package/src/components-nextjs/index.ts +0 -3
- package/src/data-fetching/api/PrezlyApi.ts +0 -302
- package/src/data-fetching/api/getPrezlyApi.ts +0 -24
- package/src/data-fetching/api/index.ts +0 -1
- package/src/data-fetching/api/queries.ts +0 -51
- package/src/data-fetching/index.ts +0 -3
- package/src/data-fetching/lib/getAlgoliaSettings.ts +0 -29
- package/src/data-fetching/lib/getEnvVariables.ts +0 -46
- package/src/data-fetching/lib/index.ts +0 -4
- package/src/data-fetching/lib/isSdkError.ts +0 -5
- package/src/data-fetching/lib/isUuid.ts +0 -5
- package/src/data-fetching/types.ts +0 -14
- package/src/index.ts +0 -9
- package/src/infinite-loading/index.ts +0 -4
- package/src/infinite-loading/types.ts +0 -5
- package/src/infinite-loading/useInfiniteGalleriesLoading.ts +0 -53
- package/src/infinite-loading/useInfiniteLoading.ts +0 -66
- package/src/infinite-loading/useInfiniteStoriesLoading.ts +0 -81
- package/src/intl/index.ts +0 -4
- package/src/intl/languages.test.ts +0 -232
- package/src/intl/languages.ts +0 -233
- package/src/intl/locale.test.ts +0 -94
- package/src/intl/locale.ts +0 -140
- package/src/intl/localeConfig.js +0 -23
- package/src/intl/localeList.js +0 -110
- package/src/intl/localeObject.test.ts +0 -81
- package/src/intl/localeObject.ts +0 -99
- package/src/newsroom-context/context.tsx +0 -115
- package/src/newsroom-context/hooks/index.ts +0 -11
- package/src/newsroom-context/hooks/useAlgoliaSettings.ts +0 -7
- package/src/newsroom-context/hooks/useCategories.ts +0 -7
- package/src/newsroom-context/hooks/useCompanyInformation.ts +0 -7
- package/src/newsroom-context/hooks/useCurrentCategory.ts +0 -7
- package/src/newsroom-context/hooks/useCurrentLocale.ts +0 -7
- package/src/newsroom-context/hooks/useCurrentStory.ts +0 -7
- package/src/newsroom-context/hooks/useGetLinkLocaleSlug.ts +0 -37
- package/src/newsroom-context/hooks/useGetTranslationUrl.ts +0 -96
- package/src/newsroom-context/hooks/useLanguages.ts +0 -7
- package/src/newsroom-context/hooks/useNewsroom.ts +0 -7
- package/src/newsroom-context/hooks/useNewsroomContext.ts +0 -15
- package/src/newsroom-context/index.ts +0 -2
- package/src/sentry/client.ts +0 -7
- package/src/sentry/common.ts +0 -27
- package/src/sentry/index.ts +0 -2
- package/src/sentry/server.ts +0 -7
- package/src/types.ts +0 -51
- package/src/utils/boilerplate.ts +0 -27
- package/src/utils/constants.ts +0 -3
- package/src/utils/getAssetsUrl.test.ts +0 -9
- package/src/utils/getAssetsUrl.ts +0 -9
- package/src/utils/getDataRequestLink.ts +0 -14
- package/src/utils/getLocalizedCategoryData.ts +0 -47
- package/src/utils/getNewsroomLogoUrl.ts +0 -22
- package/src/utils/getPrivacyPortalUrl.ts +0 -25
- package/src/utils/getStoryPublicationDate.tsx +0 -15
- package/src/utils/getUploadcareGroupUrl.ts +0 -13
- package/src/utils/index.ts +0 -10
- package/src/utils/isEmbargoStory.ts +0 -10
|
@@ -1,83 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const newsroom_context_1 = require("../../newsroom-context");
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
11
|
-
const getAbsoluteUrl_1 = require("./lib/getAbsoluteUrl");
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { NextSeo } from 'next-seo';
|
|
3
|
+
import { useRouter } from 'next/router';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { getUsedLanguages, LocaleObject } from "../../intl/index.js";
|
|
6
|
+
import { useCompanyInformation, useCurrentLocale, useCurrentStory, useGetLinkLocaleSlug, useGetTranslationUrl, useLanguages, useNewsroom } from "../../newsroom-context/index.js";
|
|
7
|
+
import { getNewsroomLogoUrl } from "../../utils/index.js";
|
|
8
|
+
import { getAbsoluteUrl } from "./lib/getAbsoluteUrl.js";
|
|
12
9
|
/**
|
|
13
10
|
* This component provides base page attributes for every Newsroom page.
|
|
14
11
|
* It depends on information from NewsroomContext, so the component should be placed inside the `NewsroomContextProvider`.
|
|
15
12
|
* You can pass additional props expected by NextSeo component to override any info that is provided by the NewsroomContext.
|
|
16
13
|
*/
|
|
17
|
-
function PageSeo({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
newsroom.url,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
14
|
+
export function PageSeo({
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
imageUrl,
|
|
18
|
+
canonical,
|
|
19
|
+
openGraph,
|
|
20
|
+
twitter,
|
|
21
|
+
...nextSeoProps
|
|
22
|
+
}) {
|
|
23
|
+
const companyInformation = useCompanyInformation();
|
|
24
|
+
const newsroom = useNewsroom();
|
|
25
|
+
const currentLocale = useCurrentLocale();
|
|
26
|
+
const languages = useLanguages();
|
|
27
|
+
const getTranslationUrl = useGetTranslationUrl();
|
|
28
|
+
const getLinkLocaleSlug = useGetLinkLocaleSlug();
|
|
29
|
+
const currentStory = useCurrentStory();
|
|
30
|
+
const {
|
|
31
|
+
asPath
|
|
32
|
+
} = useRouter();
|
|
33
|
+
const pageTitle = title || companyInformation.name;
|
|
34
|
+
const pageDescription = description || companyInformation.about_plaintext;
|
|
35
|
+
const canonicalUrl = canonical || getAbsoluteUrl(asPath, newsroom.url, getLinkLocaleSlug(currentLocale));
|
|
36
|
+
const siteName = companyInformation.name;
|
|
37
|
+
const logoUrl = imageUrl || getNewsroomLogoUrl(newsroom);
|
|
38
|
+
const alternateLanguageLinks = useMemo(() => {
|
|
39
|
+
if (!languages.length) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
const alternateLanguages = getUsedLanguages(languages).filter(language => language.code !== currentLocale.toUnderscoreCode());
|
|
43
|
+
return alternateLanguages.map(language => {
|
|
44
|
+
const locale = LocaleObject.fromAnyCode(language.code);
|
|
45
|
+
const translationLink = getTranslationUrl(locale, true);
|
|
46
|
+
if (!translationLink) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
hrefLang: locale.toHyphenCode(),
|
|
51
|
+
href: getAbsoluteUrl(translationLink, newsroom.url, currentStory && translationLink !== '/' ? false : getLinkLocaleSlug(locale))
|
|
52
|
+
};
|
|
53
|
+
}).filter(Boolean);
|
|
54
|
+
}, [currentLocale, getLinkLocaleSlug, getTranslationUrl, languages, newsroom.url, currentStory]);
|
|
55
|
+
return /*#__PURE__*/React.createElement(NextSeo, _extends({
|
|
56
|
+
title: pageTitle,
|
|
57
|
+
description: pageDescription,
|
|
58
|
+
canonical: canonicalUrl,
|
|
59
|
+
noindex: nextSeoProps.noindex ?? !newsroom.is_indexable,
|
|
60
|
+
nofollow: nextSeoProps.nofollow ?? !newsroom.is_indexable,
|
|
61
|
+
openGraph: {
|
|
62
|
+
url: canonicalUrl,
|
|
63
|
+
title: pageTitle,
|
|
64
|
+
description: pageDescription,
|
|
65
|
+
locale: currentLocale.toUnderscoreCode(),
|
|
66
|
+
images: [{
|
|
67
|
+
url: logoUrl,
|
|
68
|
+
alt: pageTitle
|
|
69
|
+
}],
|
|
70
|
+
site_name: siteName,
|
|
71
|
+
...openGraph
|
|
72
|
+
},
|
|
73
|
+
twitter: {
|
|
74
|
+
site: siteName,
|
|
75
|
+
cardType: 'summary',
|
|
76
|
+
...twitter
|
|
77
|
+
},
|
|
78
|
+
additionalMetaTags: [{
|
|
79
|
+
name: 'twitter:image',
|
|
80
|
+
content: logoUrl
|
|
81
|
+
}],
|
|
82
|
+
additionalLinkTags: [{
|
|
83
|
+
rel: 'alternate',
|
|
84
|
+
type: 'application/rss+xml',
|
|
85
|
+
href: getAbsoluteUrl('/feed', newsroom.url)
|
|
86
|
+
}],
|
|
87
|
+
languageAlternates: alternateLanguageLinks
|
|
88
|
+
}, nextSeoProps));
|
|
89
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageSeo.js","sourceRoot":"","sources":["../../../src/components-nextjs/PageSeo/PageSeo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageSeo.js","sourceRoot":"","sources":["../../../src/components-nextjs/PageSeo/PageSeo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,WAAW,GACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAOtD;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,EACpB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,GAAG,YAAY,EACX;IACJ,MAAM,kBAAkB,GAAG,qBAAqB,EAAE,CAAC;IACnD,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/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,EACD,kBAAkB,EAAE,sBAAsB,KACtC,YAAY,GAClB,CACL,CAAC;AACN,CAAC"}
|
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PageSeo = void 0;
|
|
18
|
-
var PageSeo_1 = require("./PageSeo");
|
|
19
|
-
Object.defineProperty(exports, "PageSeo", { enumerable: true, get: function () { return PageSeo_1.PageSeo; } });
|
|
20
|
-
__exportStar(require("./lib/types"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { PageSeo } from "./PageSeo.js";
|
|
2
|
+
export * from "./lib/types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components-nextjs/PageSeo/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components-nextjs/PageSeo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAbsoluteUrl = void 0;
|
|
4
1
|
// Returns absolute URL based on the path and without any query parameters
|
|
5
|
-
function getAbsoluteUrl(path, origin, localeCode) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
exports.getAbsoluteUrl = getAbsoluteUrl;
|
|
11
|
-
//# sourceMappingURL=getAbsoluteUrl.js.map
|
|
2
|
+
export function getAbsoluteUrl(path, origin, localeCode) {
|
|
3
|
+
const url = new URL(`${localeCode ? `/${localeCode}` : ''}${path || '/'}`, origin);
|
|
4
|
+
url.search = '';
|
|
5
|
+
return url.toString();
|
|
6
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAbsoluteUrl.js","sourceRoot":"","sources":["../../../../src/components-nextjs/PageSeo/lib/getAbsoluteUrl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getAbsoluteUrl.js","sourceRoot":"","sources":["../../../../src/components-nextjs/PageSeo/lib/getAbsoluteUrl.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,MAAc,EAAE,UAA2B;IACpF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;IACnF,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;IAEhB,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -1,51 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.StorySeo = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const sdk_1 = require("@prezly/sdk");
|
|
6
|
-
const next_seo_1 = require("next-seo");
|
|
1
|
+
import { Story } from '@prezly/sdk';
|
|
2
|
+
import { ArticleJsonLd, NextSeo } from 'next-seo';
|
|
7
3
|
/**
|
|
8
4
|
* This components provides additional page attributes for the Story page.
|
|
9
5
|
* It works in conjunction with `PageSeo` component, overidding some of its attributes.
|
|
10
6
|
*/
|
|
11
|
-
function StorySeo({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
7
|
+
export function StorySeo({
|
|
8
|
+
story,
|
|
9
|
+
noindex
|
|
10
|
+
}) {
|
|
11
|
+
const {
|
|
12
|
+
title,
|
|
13
|
+
subtitle,
|
|
14
|
+
published_at,
|
|
15
|
+
updated_at,
|
|
16
|
+
author,
|
|
17
|
+
oembed,
|
|
18
|
+
newsroom,
|
|
19
|
+
summary
|
|
20
|
+
} = story;
|
|
21
|
+
const authorName = author?.display_name || author?.email || 'Unknown';
|
|
22
|
+
const description = subtitle || summary;
|
|
23
|
+
const indexable = newsroom.is_indexable && story.visibility === Story.Visibility.PUBLIC;
|
|
24
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NextSeo, {
|
|
25
|
+
title: title,
|
|
26
|
+
description: description,
|
|
27
|
+
canonical: oembed.url,
|
|
28
|
+
noindex: noindex ?? !indexable,
|
|
29
|
+
nofollow: noindex ?? !indexable,
|
|
30
|
+
openGraph: {
|
|
31
|
+
title,
|
|
32
|
+
description,
|
|
33
|
+
url: oembed.url,
|
|
34
|
+
site_name: newsroom.display_name,
|
|
35
|
+
type: 'article',
|
|
36
|
+
article: {
|
|
37
|
+
publishedTime: published_at || undefined,
|
|
38
|
+
modifiedTime: updated_at,
|
|
39
|
+
authors: [authorName]
|
|
40
|
+
},
|
|
41
|
+
...(oembed.thumbnail_url && {
|
|
42
|
+
images: [{
|
|
43
|
+
url: oembed.thumbnail_url,
|
|
44
|
+
alt: oembed.title,
|
|
45
|
+
width: oembed.thumbnail_width,
|
|
46
|
+
height: oembed.thumbnail_height
|
|
47
|
+
}]
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
additionalMetaTags: oembed.thumbnail_url ? [{
|
|
51
|
+
name: 'twitter:card',
|
|
52
|
+
content: 'summary_large_image'
|
|
53
|
+
}, {
|
|
54
|
+
name: 'twitter:image',
|
|
55
|
+
content: oembed.thumbnail_url
|
|
56
|
+
}] : undefined,
|
|
57
|
+
additionalLinkTags: [{
|
|
58
|
+
rel: 'alternate',
|
|
59
|
+
type: 'application/json',
|
|
60
|
+
href: `${oembed.url}.json`
|
|
61
|
+
}]
|
|
62
|
+
}), /*#__PURE__*/React.createElement(ArticleJsonLd, {
|
|
63
|
+
url: oembed.url,
|
|
64
|
+
title: title,
|
|
65
|
+
images: oembed.thumbnail_url ? [oembed.thumbnail_url] : [],
|
|
66
|
+
datePublished: published_at || '',
|
|
67
|
+
dateModified: updated_at,
|
|
68
|
+
authorName: [authorName],
|
|
69
|
+
publisherName: newsroom.display_name,
|
|
70
|
+
publisherLogo: newsroom.thumbnail_url,
|
|
71
|
+
description: description
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorySeo.js","sourceRoot":"","sources":["../../../src/components-nextjs/StorySeo/StorySeo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"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AG,EAAE,MAAM,CAAC,KAAK;gCACjB,KAAK,EAAE,MAAM,CAAC,eAAe;gCAC7B,MAAM,EAAE,MAAM,CAAC,gBAAgB;6BAClC;yBACJ;qBACJ,CAAC;iBACL,EACD,kBAAkB,EACd,MAAM,CAAC,aAAa;oBAChB,CAAC,CAAC;wBACI,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE;wBACxD,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE;qBAC3D;oBACH,CAAC,CAAC,SAAS,EAEnB,kBAAkB,EAAE;oBAChB;wBACI,GAAG,EAAE,WAAW;wBAChB,IAAI,EAAE,kBAAkB;wBACxB,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,OAAO;qBAC7B;iBACJ,GACH,EACF,KAAC,aAAa,IACV,GAAG,EAAE,MAAM,CAAC,GAAG,EACf,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,EAC1D,aAAa,EAAE,YAAY,IAAI,EAAE,EACjC,YAAY,EAAE,UAAU,EACxB,UAAU,EAAE,CAAC,UAAU,CAAC,EACxB,aAAa,EAAE,QAAQ,CAAC,YAAY,EACpC,aAAa,EAAE,QAAQ,CAAC,aAAa,EACrC,WAAW,EAAE,WAAW,GAC1B,IACH,CACN,CAAC;AACN,CAAC"}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StorySeo = void 0;
|
|
4
|
-
var StorySeo_1 = require("./StorySeo");
|
|
5
|
-
Object.defineProperty(exports, "StorySeo", { enumerable: true, get: function () { return StorySeo_1.StorySeo; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { StorySeo } from "./StorySeo.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components-nextjs/StorySeo/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components-nextjs/StorySeo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,48 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const { newsroomContextProps,
|
|
33
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
34
|
-
} = this.props.__NEXT_DATA__.props.pageProps;
|
|
35
|
-
// In some cases (like server errors) the newsroom context props will not be loaded.
|
|
36
|
-
// We need to fall back to default locale to keep the app working.
|
|
37
|
-
const { localeCode } = newsroomContextProps ?? { localeCode: intl_1.DEFAULT_LOCALE };
|
|
38
|
-
return localeCode;
|
|
39
|
-
}
|
|
40
|
-
render() {
|
|
41
|
-
const locale = intl_1.LocaleObject.fromAnyCode(this.getLocaleCode());
|
|
42
|
-
// TODO: The direction can be pulled from the Language object
|
|
43
|
-
const direction = (0, intl_1.getLocaleDirection)(locale);
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)(document_1.Html, { lang: locale.toHyphenCode(), dir: direction, children: [(0, jsx_runtime_1.jsx)(document_1.Head, { children: (0, jsx_runtime_1.jsx)("meta", { name: "og:locale", content: locale.toHyphenCode() }) }), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] }));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.PrezlyThemeDocument = PrezlyThemeDocument;
|
|
48
|
-
//# sourceMappingURL=document.js.map
|
|
1
|
+
import Document, { Head, Html, Main, NextScript } from 'next/document';
|
|
2
|
+
import { DEFAULT_LOCALE, getLocaleDirection, LocaleObject } from "../intl/index.js";
|
|
3
|
+
export class PrezlyThemeDocument extends Document {
|
|
4
|
+
getLocaleCode() {
|
|
5
|
+
const {
|
|
6
|
+
newsroomContextProps
|
|
7
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8
|
+
} = this.props.__NEXT_DATA__.props.pageProps;
|
|
9
|
+
|
|
10
|
+
// In some cases (like server errors) the newsroom context props will not be loaded.
|
|
11
|
+
// We need to fall back to default locale to keep the app working.
|
|
12
|
+
const {
|
|
13
|
+
localeCode
|
|
14
|
+
} = newsroomContextProps ?? {
|
|
15
|
+
localeCode: DEFAULT_LOCALE
|
|
16
|
+
};
|
|
17
|
+
return localeCode;
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
const locale = LocaleObject.fromAnyCode(this.getLocaleCode());
|
|
21
|
+
// TODO: The direction can be pulled from the Language object
|
|
22
|
+
const direction = getLocaleDirection(locale);
|
|
23
|
+
return /*#__PURE__*/React.createElement(Html, {
|
|
24
|
+
lang: locale.toHyphenCode(),
|
|
25
|
+
dir: direction
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("meta", {
|
|
27
|
+
name: "og:locale",
|
|
28
|
+
content: locale.toHyphenCode()
|
|
29
|
+
})), /*#__PURE__*/React.createElement("body", null, /*#__PURE__*/React.createElement(Main, null), /*#__PURE__*/React.createElement(NextScript, null)));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/components-nextjs/document.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/components-nextjs/document.tsx"],"names":[],"mappings":";AAAA,OAAO,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG3E,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;IAC7C,aAAa;QACT,MAAM,EACF,oBAAoB;QACpB,gDAAgD;UACnD,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,SAAsB,CAAC;QAE1D,oFAAoF;QACpF,kEAAkE;QAClE,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;QAE9E,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,MAAM;QACF,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9D,6DAA6D;QAC7D,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAE7C,OAAO,CACH,MAAC,IAAI,IAAC,IAAI,EAAE,MAAM,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,SAAS,aAC7C,KAAC,IAAI,cACD,eAAM,IAAI,EAAC,WAAW,EAAC,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,GAAI,GAEtD,EACP,2BACI,KAAC,IAAI,KAAG,EACR,KAAC,UAAU,KAAG,IACX,IACJ,CACV,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var PageSeo_1 = require("./PageSeo");
|
|
5
|
-
Object.defineProperty(exports, "PageSeo", { enumerable: true, get: function () { return PageSeo_1.PageSeo; } });
|
|
6
|
-
var StorySeo_1 = require("./StorySeo");
|
|
7
|
-
Object.defineProperty(exports, "StorySeo", { enumerable: true, get: function () { return StorySeo_1.StorySeo; } });
|
|
8
|
-
var document_1 = require("./document");
|
|
9
|
-
Object.defineProperty(exports, "PrezlyThemeDocument", { enumerable: true, get: function () { return document_1.PrezlyThemeDocument; } });
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { PageSeo } from "./PageSeo/index.js";
|
|
2
|
+
export { StorySeo } from "./StorySeo/index.js";
|
|
3
|
+
export { PrezlyThemeDocument } from "./document.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components-nextjs/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components-nextjs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { Category,
|
|
3
|
-
import PrezlySDK from '@prezly/sdk';
|
|
2
|
+
import type { Category, Newsroom, NewsroomLanguageSettings, Stories, Story } from '@prezly/sdk';
|
|
4
3
|
import type { IncomingMessage } from 'http';
|
|
5
4
|
import type { PageProps, ServerSidePageProps } from '../../types';
|
|
6
5
|
declare type SortOrder = 'desc' | 'asc';
|
|
@@ -8,7 +7,7 @@ interface GetStoriesOptions {
|
|
|
8
7
|
page?: number;
|
|
9
8
|
pageSize?: number;
|
|
10
9
|
order?: SortOrder;
|
|
11
|
-
include?: (keyof
|
|
10
|
+
include?: (keyof Story.ExtraFields)[];
|
|
12
11
|
localeCode?: string;
|
|
13
12
|
}
|
|
14
13
|
interface GetGalleriesOptions {
|
|
@@ -39,8 +38,8 @@ export declare class PrezlyApi {
|
|
|
39
38
|
getStoryBySlug(slug: string): Promise<import("@prezly/sdk").ExtendedStory | null | undefined>;
|
|
40
39
|
getCategories(): Promise<Category[]>;
|
|
41
40
|
getCategoryBySlug(slug: string): Promise<Category | undefined>;
|
|
42
|
-
searchStories:
|
|
43
|
-
getGalleries({ page, pageSize }: GetGalleriesOptions): Promise<import("@prezly/sdk/dist/
|
|
41
|
+
searchStories: Stories.Client['search'];
|
|
42
|
+
getGalleries({ page, pageSize }: GetGalleriesOptions): Promise<import("@prezly/sdk/dist/endpoints/NewsroomGalleries").ListResponse>;
|
|
44
43
|
getGallery(uuid: string): Promise<import("@prezly/sdk").NewsroomGallery | null | undefined>;
|
|
45
44
|
/**
|
|
46
45
|
* In order to prevent issues with theme preview, we only load the theme preset for a specified theme, and not the currently active one.
|