@prezly/theme-kit-nextjs 2.0.1-1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js +21 -31
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
- package/build/adapter-nextjs/api-handlers/fetchStories.js +23 -41
- package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
- package/build/adapter-nextjs/api-handlers/index.js +7 -18
- package/build/adapter-nextjs/api-handlers/index.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomServerSideProps.js +13 -20
- package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomStaticProps.js +13 -19
- package/build/adapter-nextjs/getNewsroomStaticProps.js.map +1 -1
- package/build/adapter-nextjs/index.js +21 -69
- package/build/adapter-nextjs/index.js.map +1 -1
- package/build/adapter-nextjs/page-props/category.js +96 -122
- package/build/adapter-nextjs/page-props/category.js.map +1 -1
- package/build/adapter-nextjs/page-props/gallery.js +65 -91
- package/build/adapter-nextjs/page-props/gallery.js.map +1 -1
- package/build/adapter-nextjs/page-props/galleryAlbum.js +49 -68
- package/build/adapter-nextjs/page-props/galleryAlbum.js.map +1 -1
- package/build/adapter-nextjs/page-props/home.js +66 -87
- package/build/adapter-nextjs/page-props/home.js.map +1 -1
- package/build/adapter-nextjs/page-props/index.js +40 -136
- package/build/adapter-nextjs/page-props/index.js.map +1 -1
- package/build/adapter-nextjs/page-props/lib/types.js +3 -1
- package/build/adapter-nextjs/page-props/search.js +28 -29
- package/build/adapter-nextjs/page-props/search.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +46 -32
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js +17 -17
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +33 -37
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/index.js +23 -41
- package/build/adapter-nextjs/page-props/sitemap/index.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/types.js +3 -1
- package/build/adapter-nextjs/page-props/story.js +60 -81
- package/build/adapter-nextjs/page-props/story.js.map +1 -1
- package/build/adapter-nextjs/page-props/storyPreview.js +24 -31
- package/build/adapter-nextjs/page-props/storyPreview.js.map +1 -1
- package/build/adapter-nextjs/processRequest.js +23 -38
- package/build/adapter-nextjs/processRequest.js.map +1 -1
- package/build/adapter-nextjs/processStaticRequest.js +14 -23
- package/build/adapter-nextjs/processStaticRequest.js.map +1 -1
- package/build/components-nextjs/PageSeo/PageSeo.js +77 -89
- package/build/components-nextjs/PageSeo/PageSeo.js.map +1 -1
- package/build/components-nextjs/PageSeo/index.js +19 -25
- package/build/components-nextjs/PageSeo/index.js.map +1 -1
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +8 -9
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +1 -1
- package/build/components-nextjs/PageSeo/lib/types.js +3 -1
- package/build/components-nextjs/StorySeo/StorySeo.js +46 -74
- package/build/components-nextjs/StorySeo/StorySeo.js.map +1 -1
- package/build/components-nextjs/StorySeo/index.js +5 -11
- package/build/components-nextjs/StorySeo/index.js.map +1 -1
- package/build/components-nextjs/document.js +44 -36
- package/build/components-nextjs/document.js.map +1 -1
- package/build/components-nextjs/index.js +9 -25
- package/build/components-nextjs/index.js.map +1 -1
- package/build/data-fetching/api/PrezlyApi.js +187 -210
- package/build/data-fetching/api/PrezlyApi.js.map +1 -1
- package/build/data-fetching/api/getPrezlyApi.js +19 -25
- package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
- package/build/data-fetching/api/index.js +16 -14
- package/build/data-fetching/api/index.js.map +1 -1
- package/build/data-fetching/api/queries.js +41 -80
- package/build/data-fetching/api/queries.js.map +1 -1
- package/build/data-fetching/index.js +18 -36
- package/build/data-fetching/index.js.map +1 -1
- package/build/data-fetching/lib/getAlgoliaSettings.js +20 -26
- package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
- package/build/data-fetching/lib/getEnvVariables.js +36 -40
- package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
- package/build/data-fetching/lib/index.js +11 -32
- package/build/data-fetching/lib/index.js.map +1 -1
- package/build/data-fetching/lib/isSdkError.js +6 -7
- package/build/data-fetching/lib/isSdkError.js.map +1 -1
- package/build/data-fetching/lib/isUuid.js +6 -7
- package/build/data-fetching/lib/isUuid.js.map +1 -1
- package/build/data-fetching/types.js +3 -1
- package/build/index.js +25 -103
- package/build/index.js.map +1 -1
- package/build/infinite-loading/index.js +23 -41
- package/build/infinite-loading/index.js.map +1 -1
- package/build/infinite-loading/types.js +3 -1
- package/build/infinite-loading/useInfiniteGalleriesLoading.js +35 -46
- package/build/infinite-loading/useInfiniteGalleriesLoading.js.map +1 -1
- package/build/infinite-loading/useInfiniteLoading.js +41 -54
- package/build/infinite-loading/useInfiniteLoading.js.map +1 -1
- package/build/infinite-loading/useInfiniteStoriesLoading.js +48 -60
- package/build/infinite-loading/useInfiniteStoriesLoading.js.map +1 -1
- package/build/intl/index.d.ts +1 -1
- package/build/intl/index.js +24 -47
- package/build/intl/index.js.map +1 -1
- package/build/intl/languages.js +110 -150
- package/build/intl/languages.js.map +1 -1
- package/build/intl/locale.d.ts +1 -0
- package/build/intl/locale.js +104 -58
- package/build/intl/locale.js.map +1 -1
- package/build/intl/localeConfig.d.ts +2 -3
- package/build/intl/localeConfig.js +13 -28
- package/build/intl/localeConfig.js.map +1 -1
- package/build/intl/localeList.d.ts +2 -4
- package/build/intl/localeList.js +108 -7
- package/build/intl/localeList.js.map +1 -1
- package/build/intl/localeObject.js +78 -83
- package/build/intl/localeObject.js.map +1 -1
- package/build/newsroom-context/context.js +24 -42
- package/build/newsroom-context/context.js.map +1 -1
- package/build/newsroom-context/hooks/index.js +27 -125
- package/build/newsroom-context/hooks/index.js.map +1 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +8 -9
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
- package/build/newsroom-context/hooks/useCategories.js +8 -9
- package/build/newsroom-context/hooks/useCategories.js.map +1 -1
- package/build/newsroom-context/hooks/useCompanyInformation.js +8 -9
- package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentCategory.js +8 -9
- package/build/newsroom-context/hooks/useCurrentCategory.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentLocale.js +8 -9
- package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentStory.js +8 -9
- package/build/newsroom-context/hooks/useCurrentStory.js.map +1 -1
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +19 -21
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +54 -56
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
- package/build/newsroom-context/hooks/useLanguages.js +8 -9
- package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroom.js +8 -9
- package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroomContext.js +14 -15
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
- package/build/newsroom-context/index.d.ts +1 -2
- package/build/newsroom-context/index.js +20 -32
- package/build/newsroom-context/index.js.map +1 -1
- package/build/sentry/client.js +7 -8
- package/build/sentry/client.js.map +1 -1
- package/build/sentry/common.js +27 -30
- package/build/sentry/common.js.map +1 -1
- package/build/sentry/index.js +7 -18
- package/build/sentry/index.js.map +1 -1
- package/build/sentry/server.js +7 -8
- package/build/sentry/server.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/build/types.js +3 -1
- package/build/utils/boilerplate.js +18 -11
- package/build/utils/boilerplate.js.map +1 -1
- package/build/utils/constants.js +6 -11
- package/build/utils/constants.js.map +1 -1
- package/build/utils/getAssetsUrl.js +7 -8
- package/build/utils/getAssetsUrl.js.map +1 -1
- package/build/utils/getDataRequestLink.js +10 -10
- package/build/utils/getDataRequestLink.js.map +1 -1
- package/build/utils/getLocalizedCategoryData.js +29 -37
- package/build/utils/getLocalizedCategoryData.js.map +1 -1
- package/build/utils/getNewsroomLogoUrl.js +18 -19
- package/build/utils/getNewsroomLogoUrl.js.map +1 -1
- package/build/utils/getPrivacyPortalUrl.js +11 -15
- package/build/utils/getPrivacyPortalUrl.js.map +1 -1
- package/build/utils/getStoryPublicationDate.js +12 -13
- package/build/utils/getStoryPublicationDate.js.map +1 -1
- package/build/utils/getUploadcareGroupUrl.js +8 -9
- package/build/utils/getUploadcareGroupUrl.js.map +1 -1
- package/build/utils/index.js +26 -114
- package/build/utils/index.js.map +1 -1
- package/build/utils/isEmbargoStory.js +6 -7
- package/build/utils/isEmbargoStory.js.map +1 -1
- package/package.json +12 -26
- package/src/@types/global.d.ts +7 -0
- package/src/__mocks__/languages.ts +416 -0
- package/src/__mocks__/story.ts +359 -0
- package/src/adapter-nextjs/api-handlers/fetchGalleries.ts +24 -0
- package/src/adapter-nextjs/api-handlers/fetchStories.ts +26 -0
- package/src/adapter-nextjs/api-handlers/index.ts +2 -0
- package/src/adapter-nextjs/getNewsroomServerSideProps.ts +29 -0
- package/src/adapter-nextjs/getNewsroomStaticProps.ts +29 -0
- package/src/adapter-nextjs/index.ts +6 -0
- package/src/adapter-nextjs/page-props/category.ts +157 -0
- package/src/adapter-nextjs/page-props/gallery.ts +114 -0
- package/src/adapter-nextjs/page-props/galleryAlbum.ts +89 -0
- package/src/adapter-nextjs/page-props/home.ts +113 -0
- package/src/adapter-nextjs/page-props/index.ts +26 -0
- package/src/adapter-nextjs/page-props/lib/types.ts +8 -0
- package/src/adapter-nextjs/page-props/search.ts +53 -0
- package/src/adapter-nextjs/page-props/sitemap/SitemapBuilder.ts +56 -0
- package/src/adapter-nextjs/page-props/sitemap/createPaths.ts +21 -0
- package/src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts +43 -0
- package/src/adapter-nextjs/page-props/sitemap/index.ts +5 -0
- package/src/adapter-nextjs/page-props/sitemap/types.ts +5 -0
- package/src/adapter-nextjs/page-props/story.ts +94 -0
- package/src/adapter-nextjs/page-props/storyPreview.ts +33 -0
- package/src/adapter-nextjs/processRequest.ts +49 -0
- package/src/adapter-nextjs/processStaticRequest.ts +32 -0
- package/src/components-nextjs/PageSeo/PageSeo.tsx +131 -0
- package/src/components-nextjs/PageSeo/index.ts +2 -0
- package/src/components-nextjs/PageSeo/lib/getAbsoluteUrl.ts +7 -0
- package/src/components-nextjs/PageSeo/lib/types.ts +4 -0
- package/src/components-nextjs/StorySeo/StorySeo.tsx +80 -0
- package/src/components-nextjs/StorySeo/index.ts +1 -0
- package/src/components-nextjs/document.tsx +38 -0
- package/src/components-nextjs/index.ts +3 -0
- package/src/data-fetching/api/PrezlyApi.ts +304 -0
- package/src/data-fetching/api/getPrezlyApi.ts +24 -0
- package/src/data-fetching/api/index.ts +1 -0
- package/src/data-fetching/api/queries.ts +51 -0
- package/src/data-fetching/index.ts +3 -0
- package/src/data-fetching/lib/getAlgoliaSettings.ts +29 -0
- package/src/data-fetching/lib/getEnvVariables.ts +46 -0
- package/src/data-fetching/lib/index.ts +4 -0
- package/src/data-fetching/lib/isSdkError.ts +5 -0
- package/src/data-fetching/lib/isUuid.ts +5 -0
- package/src/data-fetching/types.ts +14 -0
- package/src/index.ts +9 -0
- package/src/infinite-loading/index.ts +4 -0
- package/src/infinite-loading/types.ts +5 -0
- package/src/infinite-loading/useInfiniteGalleriesLoading.ts +53 -0
- package/src/infinite-loading/useInfiniteLoading.ts +66 -0
- package/src/infinite-loading/useInfiniteStoriesLoading.ts +81 -0
- package/src/intl/index.ts +4 -0
- package/src/intl/languages.test.ts +232 -0
- package/src/intl/languages.ts +233 -0
- package/src/intl/locale.test.ts +95 -0
- package/src/intl/locale.ts +140 -0
- package/src/intl/localeConfig.js +23 -0
- package/src/intl/localeList.js +110 -0
- package/src/intl/localeObject.test.ts +81 -0
- package/src/intl/localeObject.ts +99 -0
- package/src/newsroom-context/context.tsx +115 -0
- package/src/newsroom-context/hooks/index.ts +11 -0
- package/src/newsroom-context/hooks/useAlgoliaSettings.ts +7 -0
- package/src/newsroom-context/hooks/useCategories.ts +7 -0
- package/src/newsroom-context/hooks/useCompanyInformation.ts +7 -0
- package/src/newsroom-context/hooks/useCurrentCategory.ts +7 -0
- package/src/newsroom-context/hooks/useCurrentLocale.ts +7 -0
- package/src/newsroom-context/hooks/useCurrentStory.ts +7 -0
- package/src/newsroom-context/hooks/useGetLinkLocaleSlug.ts +37 -0
- package/src/newsroom-context/hooks/useGetTranslationUrl.ts +97 -0
- package/src/newsroom-context/hooks/useLanguages.ts +7 -0
- package/src/newsroom-context/hooks/useNewsroom.ts +7 -0
- package/src/newsroom-context/hooks/useNewsroomContext.ts +15 -0
- package/src/newsroom-context/index.ts +2 -0
- package/src/sentry/client.ts +7 -0
- package/src/sentry/common.ts +27 -0
- package/src/sentry/index.ts +2 -0
- package/src/sentry/server.ts +7 -0
- package/src/types.ts +51 -0
- package/src/utils/boilerplate.ts +27 -0
- package/src/utils/constants.ts +3 -0
- package/src/utils/getAssetsUrl.test.ts +9 -0
- package/src/utils/getAssetsUrl.ts +9 -0
- package/src/utils/getDataRequestLink.ts +14 -0
- package/src/utils/getLocalizedCategoryData.ts +47 -0
- package/src/utils/getNewsroomLogoUrl.ts +22 -0
- package/src/utils/getPrivacyPortalUrl.ts +25 -0
- package/src/utils/getStoryPublicationDate.tsx +15 -0
- package/src/utils/getUploadcareGroupUrl.ts +13 -0
- package/src/utils/index.ts +10 -0
- package/src/utils/isEmbargoStory.ts +10 -0
- package/build/@types/global.d.js +0 -1
|
@@ -1,130 +1,104 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _index3 = require("../../utils/index.js");
|
|
12
|
-
var _getNewsroomServerSideProps = require("../getNewsroomServerSideProps.js");
|
|
13
|
-
var _getNewsroomStaticProps = require("../getNewsroomStaticProps.js");
|
|
14
|
-
var _processRequest = require("../processRequest.js");
|
|
15
|
-
var _processStaticRequest = require("../processStaticRequest.js");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCategoryPageStaticPaths = exports.getCategoryPageStaticProps = exports.getCategoryPageServerSideProps = void 0;
|
|
4
|
+
const data_fetching_1 = require("../../data-fetching");
|
|
5
|
+
const intl_1 = require("../../intl");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const getNewsroomServerSideProps_1 = require("../getNewsroomServerSideProps");
|
|
8
|
+
const getNewsroomStaticProps_1 = require("../getNewsroomStaticProps");
|
|
9
|
+
const processRequest_1 = require("../processRequest");
|
|
10
|
+
const processStaticRequest_1 = require("../processStaticRequest");
|
|
16
11
|
function getCategoryPageServerSideProps(customProps, options) {
|
|
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
|
-
serverSideProps.newsroomContextProps.currentCategory = category;
|
|
52
|
-
return (0, _processRequest.processRequest)(context, {
|
|
53
|
-
...serverSideProps,
|
|
54
|
-
// TODO: This is temporary until return types from API are figured out
|
|
55
|
-
stories: stories,
|
|
56
|
-
pagination: {
|
|
57
|
-
itemsTotal: storiesTotal,
|
|
58
|
-
currentPage: page ?? 1,
|
|
59
|
-
pageSize
|
|
60
|
-
},
|
|
61
|
-
...(typeof customProps === 'function' ? await customProps(context, serverSideProps) : customProps)
|
|
62
|
-
}, `/category/${slug}`);
|
|
63
|
-
};
|
|
12
|
+
const { pageSize = utils_1.DEFAULT_PAGE_SIZE, extraStoryFields } = options || {};
|
|
13
|
+
return async function getServerSideProps(context) {
|
|
14
|
+
const { api, serverSideProps } = await (0, getNewsroomServerSideProps_1.getNewsroomServerSideProps)(context);
|
|
15
|
+
const { slug } = context.params;
|
|
16
|
+
const category = await api.getCategoryBySlug(slug);
|
|
17
|
+
if (!category) {
|
|
18
|
+
return {
|
|
19
|
+
notFound: true,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const { query } = context;
|
|
23
|
+
const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
|
|
24
|
+
const { localeCode } = serverSideProps.newsroomContextProps;
|
|
25
|
+
const { stories, storiesTotal } = await api.getStoriesFromCategory(category, {
|
|
26
|
+
page,
|
|
27
|
+
pageSize,
|
|
28
|
+
include: extraStoryFields,
|
|
29
|
+
localeCode,
|
|
30
|
+
});
|
|
31
|
+
serverSideProps.newsroomContextProps.currentCategory = category;
|
|
32
|
+
return (0, processRequest_1.processRequest)(context, {
|
|
33
|
+
...serverSideProps,
|
|
34
|
+
// TODO: This is temporary until return types from API are figured out
|
|
35
|
+
stories: stories,
|
|
36
|
+
pagination: {
|
|
37
|
+
itemsTotal: storiesTotal,
|
|
38
|
+
currentPage: page ?? 1,
|
|
39
|
+
pageSize,
|
|
40
|
+
},
|
|
41
|
+
...(typeof customProps === 'function'
|
|
42
|
+
? await customProps(context, serverSideProps)
|
|
43
|
+
: customProps),
|
|
44
|
+
}, `/category/${slug}`);
|
|
45
|
+
};
|
|
64
46
|
}
|
|
47
|
+
exports.getCategoryPageServerSideProps = getCategoryPageServerSideProps;
|
|
65
48
|
function getCategoryPageStaticProps(customProps, options) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
...staticProps,
|
|
98
|
-
// TODO: This is temporary until return types from API are figured out
|
|
99
|
-
stories: stories,
|
|
100
|
-
pagination: {
|
|
101
|
-
itemsTotal: storiesTotal,
|
|
102
|
-
currentPage: 1,
|
|
103
|
-
pageSize
|
|
104
|
-
},
|
|
105
|
-
...(typeof customProps === 'function' ? await customProps(context, staticProps) : customProps)
|
|
106
|
-
});
|
|
107
|
-
};
|
|
49
|
+
const { pageSize = utils_1.DEFAULT_PAGE_SIZE, extraStoryFields } = options || {};
|
|
50
|
+
return async function getStaticProps(context) {
|
|
51
|
+
const { api, staticProps } = await (0, getNewsroomStaticProps_1.getNewsroomStaticProps)(context);
|
|
52
|
+
const { slug } = context.params;
|
|
53
|
+
const category = await api.getCategoryBySlug(slug);
|
|
54
|
+
if (!category) {
|
|
55
|
+
return {
|
|
56
|
+
notFound: true,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const { localeCode } = staticProps.newsroomContextProps;
|
|
60
|
+
const { stories, storiesTotal } = await api.getStoriesFromCategory(category, {
|
|
61
|
+
pageSize,
|
|
62
|
+
include: extraStoryFields,
|
|
63
|
+
localeCode,
|
|
64
|
+
});
|
|
65
|
+
staticProps.newsroomContextProps.currentCategory = category;
|
|
66
|
+
return (0, processStaticRequest_1.processStaticRequest)(context, {
|
|
67
|
+
...staticProps,
|
|
68
|
+
// TODO: This is temporary until return types from API are figured out
|
|
69
|
+
stories: stories,
|
|
70
|
+
pagination: {
|
|
71
|
+
itemsTotal: storiesTotal,
|
|
72
|
+
currentPage: 1,
|
|
73
|
+
pageSize,
|
|
74
|
+
},
|
|
75
|
+
...(typeof customProps === 'function'
|
|
76
|
+
? await customProps(context, staticProps)
|
|
77
|
+
: customProps),
|
|
78
|
+
});
|
|
79
|
+
};
|
|
108
80
|
}
|
|
81
|
+
exports.getCategoryPageStaticProps = getCategoryPageStaticProps;
|
|
109
82
|
async function getCategoryPageStaticPaths() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
83
|
+
const api = (0, data_fetching_1.getPrezlyApi)();
|
|
84
|
+
const [categories, defaultLanguage] = await Promise.all([
|
|
85
|
+
api.getCategories(),
|
|
86
|
+
api.getNewsroomDefaultLanguage(),
|
|
87
|
+
]);
|
|
88
|
+
const locale = intl_1.LocaleObject.fromAnyCode(defaultLanguage.code);
|
|
89
|
+
const paths = categories
|
|
90
|
+
.map((category) => {
|
|
91
|
+
const { slug } = (0, utils_1.getLocalizedCategoryData)(category, locale);
|
|
92
|
+
if (!slug) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
return { params: { slug } };
|
|
96
|
+
})
|
|
97
|
+
.filter(Boolean);
|
|
120
98
|
return {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
99
|
+
paths,
|
|
100
|
+
fallback: 'blocking',
|
|
124
101
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
fallback: 'blocking'
|
|
129
|
-
};
|
|
130
|
-
}
|
|
102
|
+
}
|
|
103
|
+
exports.getCategoryPageStaticPaths = getCategoryPageStaticPaths;
|
|
104
|
+
//# sourceMappingURL=category.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/category.ts"],"names":[],"mappings":"AASA,
|
|
1
|
+
{"version":3,"file":"category.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/category.ts"],"names":[],"mappings":";;;AASA,uDAAmD;AAEnD,qCAA0C;AAC1C,uCAA0E;AAC1E,8EAA2E;AAC3E,sEAAmE;AACnE,sDAAmD;AACnD,kEAA+D;AAc/D,SAAgB,8BAA8B,CAG5C,WAAqD,EAAE,OAAiB;IACtE,MAAM,EAAE,QAAQ,GAAG,yBAAiB,EAAE,gBAAgB,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAEzE,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,MAAM,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;QAE3E,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAA0B,CAAC;QACpD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAEnD,IAAI,CAAC,QAAQ,EAAE;YACX,OAAO;gBACH,QAAQ,EAAE,IAAI;aACjB,CAAC;SACL;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE3F,MAAM,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,oBAAoB,CAAC;QAE5D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,OAAO;QACH,KAAK;QACL,QAAQ,EAAE,UAAU;KACvB,CAAC;AACN,CAAC;AAvBD,gEAuBC"}
|
|
@@ -1,97 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _getNewsroomServerSideProps = require("../getNewsroomServerSideProps.js");
|
|
10
|
-
var _getNewsroomStaticProps = require("../getNewsroomStaticProps.js");
|
|
11
|
-
var _processRequest = require("../processRequest.js");
|
|
12
|
-
var _processStaticRequest = require("../processStaticRequest.js");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGalleryPageStaticProps = exports.getGalleryPageServerSideProps = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const getNewsroomServerSideProps_1 = require("../getNewsroomServerSideProps");
|
|
6
|
+
const getNewsroomStaticProps_1 = require("../getNewsroomStaticProps");
|
|
7
|
+
const processRequest_1 = require("../processRequest");
|
|
8
|
+
const processStaticRequest_1 = require("../processStaticRequest");
|
|
13
9
|
function getGalleryPageServerSideProps(customProps, options) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = await api.getGalleries({
|
|
30
|
-
page,
|
|
31
|
-
pageSize
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// If there's only one gallery, redirect to it immediately
|
|
35
|
-
if (galleries.length === 1) {
|
|
36
|
-
const {
|
|
37
|
-
uuid
|
|
38
|
-
} = galleries[0];
|
|
39
|
-
return {
|
|
40
|
-
redirect: {
|
|
41
|
-
destination: `/media/album/${uuid}`,
|
|
42
|
-
permanent: false
|
|
10
|
+
const { pageSize = utils_1.DEFAULT_GALLERY_PAGE_SIZE } = options || {};
|
|
11
|
+
return async function getServerSideProps(context) {
|
|
12
|
+
const { api, serverSideProps } = await (0, getNewsroomServerSideProps_1.getNewsroomServerSideProps)(context);
|
|
13
|
+
const { query } = context;
|
|
14
|
+
const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
|
|
15
|
+
const { galleries, pagination } = await api.getGalleries({ page, pageSize });
|
|
16
|
+
// If there's only one gallery, redirect to it immediately
|
|
17
|
+
if (galleries.length === 1) {
|
|
18
|
+
const { uuid } = galleries[0];
|
|
19
|
+
return {
|
|
20
|
+
redirect: {
|
|
21
|
+
destination: `/media/album/${uuid}`,
|
|
22
|
+
permanent: false,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
43
25
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
26
|
+
return (0, processRequest_1.processRequest)(context, {
|
|
27
|
+
...serverSideProps,
|
|
28
|
+
galleries,
|
|
29
|
+
pagination: {
|
|
30
|
+
itemsTotal: pagination.matched_records_number,
|
|
31
|
+
currentPage: page ?? 1,
|
|
32
|
+
pageSize,
|
|
33
|
+
},
|
|
34
|
+
...(typeof customProps === 'function'
|
|
35
|
+
? await customProps(context, serverSideProps)
|
|
36
|
+
: customProps),
|
|
37
|
+
}, '/media');
|
|
38
|
+
};
|
|
57
39
|
}
|
|
40
|
+
exports.getGalleryPageServerSideProps = getGalleryPageServerSideProps;
|
|
58
41
|
function getGalleryPageStaticProps(customProps, options) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// If there's only one gallery, redirect to it immediately
|
|
75
|
-
if (galleries.length === 1) {
|
|
76
|
-
const {
|
|
77
|
-
uuid
|
|
78
|
-
} = galleries[0];
|
|
79
|
-
return {
|
|
80
|
-
redirect: {
|
|
81
|
-
destination: `/media/album/${uuid}`,
|
|
82
|
-
permanent: false
|
|
42
|
+
const { pageSize = utils_1.DEFAULT_GALLERY_PAGE_SIZE } = options || {};
|
|
43
|
+
return async function getStaticProps(context) {
|
|
44
|
+
const { api, staticProps } = await (0, getNewsroomStaticProps_1.getNewsroomStaticProps)(context);
|
|
45
|
+
const { galleries, pagination } = await api.getGalleries({ pageSize });
|
|
46
|
+
// If there's only one gallery, redirect to it immediately
|
|
47
|
+
if (galleries.length === 1) {
|
|
48
|
+
const { uuid } = galleries[0];
|
|
49
|
+
return {
|
|
50
|
+
redirect: {
|
|
51
|
+
destination: `/media/album/${uuid}`,
|
|
52
|
+
permanent: false,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
83
55
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
56
|
+
return (0, processStaticRequest_1.processStaticRequest)(context, {
|
|
57
|
+
...staticProps,
|
|
58
|
+
galleries,
|
|
59
|
+
pagination: {
|
|
60
|
+
itemsTotal: pagination.matched_records_number,
|
|
61
|
+
currentPage: 1,
|
|
62
|
+
pageSize,
|
|
63
|
+
},
|
|
64
|
+
...(typeof customProps === 'function'
|
|
65
|
+
? await customProps(context, staticProps)
|
|
66
|
+
: customProps),
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
exports.getGalleryPageStaticProps = getGalleryPageStaticProps;
|
|
71
|
+
//# sourceMappingURL=gallery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gallery.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/gallery.ts"],"names":[],"mappings":"AASA,
|
|
1
|
+
{"version":3,"file":"gallery.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/gallery.ts"],"names":[],"mappings":";;;AASA,uCAAwD;AACxD,8EAA2E;AAC3E,sEAAmE;AACnE,sDAAmD;AACnD,kEAA+D;AAa/D,SAAgB,6BAA6B,CACzC,WAAqD,EACrD,OAAiB;IAEjB,MAAM,EAAE,QAAQ,GAAG,iCAAyB,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE/D,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,MAAM,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;QAC3E,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAE1B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3F,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE7E,0DAA0D;QAC1D,IAAI,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,IAAA,+BAAc,EACjB,OAAO,EACP;YACI,GAAG,eAAe;YAClB,SAAS;YACT,UAAU,EAAE;gBACR,UAAU,EAAE,UAAU,CAAC,sBAAsB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ACN,CAAC;AAzCD,8DAyCC"}
|
|
@@ -1,74 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _index = require("../../data-fetching/index.js");
|
|
10
|
-
var _getNewsroomServerSideProps = require("../getNewsroomServerSideProps.js");
|
|
11
|
-
var _getNewsroomStaticProps = require("../getNewsroomStaticProps.js");
|
|
12
|
-
var _processRequest = require("../processRequest.js");
|
|
13
|
-
var _processStaticRequest = require("../processStaticRequest.js");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGalleryAlbumPageStaticPaths = exports.getGalleryAlbumPageStaticProps = exports.getGalleryAlbumPageServerSideProps = void 0;
|
|
4
|
+
const data_fetching_1 = require("../../data-fetching");
|
|
5
|
+
const getNewsroomServerSideProps_1 = require("../getNewsroomServerSideProps");
|
|
6
|
+
const getNewsroomStaticProps_1 = require("../getNewsroomStaticProps");
|
|
7
|
+
const processRequest_1 = require("../processRequest");
|
|
8
|
+
const processStaticRequest_1 = require("../processStaticRequest");
|
|
14
9
|
function getGalleryAlbumPageServerSideProps(customProps) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
...serverSideProps,
|
|
31
|
-
gallery,
|
|
32
|
-
...(typeof customProps === 'function' ? await customProps(context, serverSideProps) : customProps)
|
|
33
|
-
}, `/media/album/${uuid}`);
|
|
34
|
-
};
|
|
10
|
+
return async function getServerSideProps(context) {
|
|
11
|
+
const { api, serverSideProps } = await (0, getNewsroomServerSideProps_1.getNewsroomServerSideProps)(context);
|
|
12
|
+
const { uuid } = context.params;
|
|
13
|
+
const gallery = await api.getGallery(uuid);
|
|
14
|
+
if (!gallery || !gallery.images_number) {
|
|
15
|
+
return { notFound: true };
|
|
16
|
+
}
|
|
17
|
+
return (0, processRequest_1.processRequest)(context, {
|
|
18
|
+
...serverSideProps,
|
|
19
|
+
gallery,
|
|
20
|
+
...(typeof customProps === 'function'
|
|
21
|
+
? await customProps(context, serverSideProps)
|
|
22
|
+
: customProps),
|
|
23
|
+
}, `/media/album/${uuid}`);
|
|
24
|
+
};
|
|
35
25
|
}
|
|
26
|
+
exports.getGalleryAlbumPageServerSideProps = getGalleryAlbumPageServerSideProps;
|
|
36
27
|
function getGalleryAlbumPageStaticProps(customProps) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
...staticProps,
|
|
53
|
-
gallery,
|
|
54
|
-
...(typeof customProps === 'function' ? await customProps(context, staticProps) : customProps)
|
|
55
|
-
});
|
|
56
|
-
};
|
|
28
|
+
return async function getStaticProps(context) {
|
|
29
|
+
const { api, staticProps } = await (0, getNewsroomStaticProps_1.getNewsroomStaticProps)(context);
|
|
30
|
+
const { uuid } = context.params;
|
|
31
|
+
const gallery = await api.getGallery(uuid);
|
|
32
|
+
if (!gallery || !gallery.images_number) {
|
|
33
|
+
return { notFound: true };
|
|
34
|
+
}
|
|
35
|
+
return (0, processStaticRequest_1.processStaticRequest)(context, {
|
|
36
|
+
...staticProps,
|
|
37
|
+
gallery,
|
|
38
|
+
...(typeof customProps === 'function'
|
|
39
|
+
? await customProps(context, staticProps)
|
|
40
|
+
: customProps),
|
|
41
|
+
});
|
|
42
|
+
};
|
|
57
43
|
}
|
|
44
|
+
exports.getGalleryAlbumPageStaticProps = getGalleryAlbumPageStaticProps;
|
|
58
45
|
async function getGalleryAlbumPageStaticPaths() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
galleries
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}));
|
|
70
|
-
return {
|
|
71
|
-
paths,
|
|
72
|
-
fallback: 'blocking'
|
|
73
|
-
};
|
|
74
|
-
}
|
|
46
|
+
const api = (0, data_fetching_1.getPrezlyApi)();
|
|
47
|
+
const { galleries } = await api.getGalleries({});
|
|
48
|
+
const paths = galleries.map(({ uuid }) => ({ params: { uuid } }));
|
|
49
|
+
return {
|
|
50
|
+
paths,
|
|
51
|
+
fallback: 'blocking',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.getGalleryAlbumPageStaticPaths = getGalleryAlbumPageStaticPaths;
|
|
55
|
+
//# sourceMappingURL=galleryAlbum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"galleryAlbum.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/galleryAlbum.ts"],"names":[],"mappings":"AASA,
|
|
1
|
+
{"version":3,"file":"galleryAlbum.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/galleryAlbum.ts"],"names":[],"mappings":";;;AASA,uDAAmD;AACnD,8EAA2E;AAC3E,sEAAmE;AACnE,sDAAmD;AACnD,kEAA+D;AAQ/D,SAAgB,kCAAkC,CAC9C,WAAqD;IAErD,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,MAAM,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC;QAE3E,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAA0B,CAAC;QACpD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;YACpC,OAAO,EAAE,QAAQ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