@prezly/theme-kit-nextjs 2.0.0-0 → 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.
Files changed (86) hide show
  1. package/build/@types/global.d.js +1 -0
  2. package/build/adapter-nextjs/api-handlers/fetchGalleries.js +26 -18
  3. package/build/adapter-nextjs/api-handlers/fetchStories.js +36 -20
  4. package/build/adapter-nextjs/api-handlers/index.js +2 -3
  5. package/build/adapter-nextjs/getNewsroomServerSideProps.js +15 -10
  6. package/build/adapter-nextjs/getNewsroomStaticProps.js +14 -10
  7. package/build/adapter-nextjs/index.js +6 -7
  8. package/build/adapter-nextjs/page-props/category.js +115 -91
  9. package/build/adapter-nextjs/page-props/gallery.js +85 -61
  10. package/build/adapter-nextjs/page-props/galleryAlbum.js +61 -44
  11. package/build/adapter-nextjs/page-props/home.js +81 -62
  12. package/build/adapter-nextjs/page-props/index.js +8 -9
  13. package/build/adapter-nextjs/page-props/lib/types.js +1 -2
  14. package/build/adapter-nextjs/page-props/search.js +23 -24
  15. package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +28 -45
  16. package/build/adapter-nextjs/page-props/sitemap/createPaths.js +12 -14
  17. package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +32 -30
  18. package/build/adapter-nextjs/page-props/sitemap/index.js +4 -5
  19. package/build/adapter-nextjs/page-props/sitemap/types.js +1 -2
  20. package/build/adapter-nextjs/page-props/story.js +74 -55
  21. package/build/adapter-nextjs/page-props/storyPreview.js +26 -21
  22. package/build/adapter-nextjs/processRequest.js +33 -20
  23. package/build/adapter-nextjs/processStaticRequest.js +18 -11
  24. package/build/components-nextjs/PageSeo/PageSeo.js +81 -71
  25. package/build/components-nextjs/PageSeo/index.js +2 -3
  26. package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +4 -5
  27. package/build/components-nextjs/PageSeo/lib/types.js +1 -2
  28. package/build/components-nextjs/StorySeo/StorySeo.js +67 -41
  29. package/build/components-nextjs/StorySeo/index.js +1 -2
  30. package/build/components-nextjs/document.js +29 -19
  31. package/build/components-nextjs/index.js +3 -4
  32. package/build/data-fetching/api/PrezlyApi.js +205 -185
  33. package/build/data-fetching/api/getPrezlyApi.js +20 -16
  34. package/build/data-fetching/api/index.js +1 -2
  35. package/build/data-fetching/api/queries.js +71 -34
  36. package/build/data-fetching/index.js +3 -4
  37. package/build/data-fetching/lib/getAlgoliaSettings.js +21 -17
  38. package/build/data-fetching/lib/getEnvVariables.js +33 -29
  39. package/build/data-fetching/lib/index.js +4 -5
  40. package/build/data-fetching/lib/isSdkError.js +2 -3
  41. package/build/data-fetching/lib/isUuid.js +2 -3
  42. package/build/data-fetching/types.js +1 -2
  43. package/build/index.js +9 -10
  44. package/build/infinite-loading/index.js +4 -5
  45. package/build/infinite-loading/types.js +1 -2
  46. package/build/infinite-loading/useInfiniteGalleriesLoading.js +41 -32
  47. package/build/infinite-loading/useInfiniteLoading.js +48 -37
  48. package/build/infinite-loading/useInfiniteStoriesLoading.js +54 -44
  49. package/build/intl/index.js +4 -5
  50. package/build/intl/languages.js +135 -97
  51. package/build/intl/locale.js +46 -95
  52. package/build/intl/localeConfig.js +7 -13
  53. package/build/intl/localeList.js +1 -108
  54. package/build/intl/localeObject.js +79 -74
  55. package/build/newsroom-context/context.js +34 -20
  56. package/build/newsroom-context/hooks/index.js +11 -12
  57. package/build/newsroom-context/hooks/useAlgoliaSettings.js +4 -5
  58. package/build/newsroom-context/hooks/useCategories.js +4 -5
  59. package/build/newsroom-context/hooks/useCompanyInformation.js +4 -5
  60. package/build/newsroom-context/hooks/useCurrentCategory.js +4 -5
  61. package/build/newsroom-context/hooks/useCurrentLocale.js +4 -5
  62. package/build/newsroom-context/hooks/useCurrentStory.js +4 -5
  63. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +15 -15
  64. package/build/newsroom-context/hooks/useGetTranslationUrl.js +48 -44
  65. package/build/newsroom-context/hooks/useLanguages.js +4 -5
  66. package/build/newsroom-context/hooks/useNewsroom.js +4 -5
  67. package/build/newsroom-context/hooks/useNewsroomContext.js +9 -10
  68. package/build/newsroom-context/index.js +2 -3
  69. package/build/sentry/client.js +3 -4
  70. package/build/sentry/common.js +25 -24
  71. package/build/sentry/index.js +2 -3
  72. package/build/sentry/server.js +3 -4
  73. package/build/types.js +1 -2
  74. package/build/utils/boilerplate.js +4 -13
  75. package/build/utils/constants.js +1 -2
  76. package/build/utils/getAssetsUrl.js +3 -4
  77. package/build/utils/getDataRequestLink.js +5 -7
  78. package/build/utils/getLocalizedCategoryData.js +30 -24
  79. package/build/utils/getNewsroomLogoUrl.js +12 -13
  80. package/build/utils/getPrivacyPortalUrl.js +10 -8
  81. package/build/utils/getStoryPublicationDate.js +8 -9
  82. package/build/utils/getUploadcareGroupUrl.js +4 -5
  83. package/build/utils/index.js +10 -11
  84. package/build/utils/isEmbargoStory.js +2 -3
  85. package/package.json +10 -2
  86. package/build/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1 @@
1
+ export {};
@@ -1,19 +1,27 @@
1
- import { getPrezlyApi } from '../../data-fetching';
1
+ import { getPrezlyApi } from "../../data-fetching/index.js";
2
2
  export async function fetchGalleries(req, res) {
3
- if (req.method !== 'POST') {
4
- res.status(405);
5
- return;
6
- }
7
- const { page, pageSize } = req.body;
8
- try {
9
- const api = getPrezlyApi(req);
10
- const { galleries } = await api.getGalleries({ page, pageSize });
11
- res.status(200).json({ galleries });
12
- }
13
- catch (error) {
14
- res.status(500).send({
15
- message: error.message,
16
- });
17
- }
18
- }
19
- //# sourceMappingURL=fetchGalleries.js.map
3
+ if (req.method !== 'POST') {
4
+ res.status(405);
5
+ return;
6
+ }
7
+ const {
8
+ page,
9
+ pageSize
10
+ } = req.body;
11
+ try {
12
+ const api = getPrezlyApi(req);
13
+ const {
14
+ galleries
15
+ } = await api.getGalleries({
16
+ page,
17
+ pageSize
18
+ });
19
+ res.status(200).json({
20
+ galleries
21
+ });
22
+ } catch (error) {
23
+ res.status(500).send({
24
+ message: error.message
25
+ });
26
+ }
27
+ }
@@ -1,21 +1,37 @@
1
- import { getPrezlyApi } from '../../data-fetching';
1
+ import { getPrezlyApi } from "../../data-fetching/index.js";
2
2
  export async function fetchStories(req, res) {
3
- if (req.method !== 'POST') {
4
- res.status(405);
5
- return;
6
- }
7
- const { page, pageSize, category, include, localeCode } = req.body;
8
- try {
9
- const api = getPrezlyApi(req);
10
- const { stories } = await (category
11
- ? api.getStoriesFromCategory(category, { page, pageSize, include, localeCode })
12
- : api.getStories({ page, pageSize, include, localeCode }));
13
- res.status(200).json({ stories });
14
- }
15
- catch (error) {
16
- res.status(500).send({
17
- message: error.message,
18
- });
19
- }
20
- }
21
- //# sourceMappingURL=fetchStories.js.map
3
+ if (req.method !== 'POST') {
4
+ res.status(405);
5
+ return;
6
+ }
7
+ const {
8
+ page,
9
+ pageSize,
10
+ category,
11
+ include,
12
+ localeCode
13
+ } = req.body;
14
+ try {
15
+ const api = getPrezlyApi(req);
16
+ const {
17
+ stories
18
+ } = await (category ? api.getStoriesFromCategory(category, {
19
+ page,
20
+ pageSize,
21
+ include,
22
+ localeCode
23
+ }) : api.getStories({
24
+ page,
25
+ pageSize,
26
+ include,
27
+ localeCode
28
+ }));
29
+ res.status(200).json({
30
+ stories
31
+ });
32
+ } catch (error) {
33
+ res.status(500).send({
34
+ message: error.message
35
+ });
36
+ }
37
+ }
@@ -1,3 +1,2 @@
1
- export { fetchGalleries } from './fetchGalleries';
2
- export { fetchStories } from './fetchStories';
3
- //# sourceMappingURL=index.js.map
1
+ export { fetchGalleries } from "./fetchGalleries.js";
2
+ export { fetchStories } from "./fetchStories.js";
@@ -1,15 +1,20 @@
1
- import { getPrezlyApi } from '../data-fetching';
1
+ import { getPrezlyApi } from "../data-fetching/index.js";
2
2
  /**
3
3
  * Use this function in your `getServerSideProps` page methods to retrieve the data necessary for the NewsroomContextProvider and `processRequest` function.
4
4
  * See README for usage examples.
5
5
  */
6
6
  export async function getNewsroomServerSideProps(context, options = {}) {
7
- const { req: request, locale } = context;
8
- const api = getPrezlyApi(request);
9
- const serverSideProps = await api.getNewsroomServerSideProps(request, locale, options.story);
10
- if (options.loadHomepageContacts) {
11
- serverSideProps.newsroomContextProps.contacts = await api.getNewsroomContacts();
12
- }
13
- return { api, serverSideProps };
14
- }
15
- //# sourceMappingURL=getNewsroomServerSideProps.js.map
7
+ const {
8
+ req: request,
9
+ locale
10
+ } = context;
11
+ const api = getPrezlyApi(request);
12
+ const serverSideProps = await api.getNewsroomServerSideProps(request, locale, options.story);
13
+ if (options.loadHomepageContacts) {
14
+ serverSideProps.newsroomContextProps.contacts = await api.getNewsroomContacts();
15
+ }
16
+ return {
17
+ api,
18
+ serverSideProps
19
+ };
20
+ }
@@ -1,15 +1,19 @@
1
- import { getPrezlyApi } from '../data-fetching';
1
+ import { getPrezlyApi } from "../data-fetching/index.js";
2
2
  /**
3
3
  * Use this function in your `getNewsroomStaticProps` page methods to retrieve the data necessary for the NewsroomContextProvider and `processRequest` function.
4
4
  * See README for usage examples.
5
5
  */
6
6
  export async function getNewsroomStaticProps(context, options = {}) {
7
- const { locale } = context;
8
- const api = getPrezlyApi();
9
- const staticProps = await api.getNewsroomServerSideProps(undefined, locale, options.story);
10
- if (options.loadHomepageContacts) {
11
- staticProps.newsroomContextProps.contacts = await api.getNewsroomContacts();
12
- }
13
- return { api, staticProps };
14
- }
15
- //# sourceMappingURL=getNewsroomStaticProps.js.map
7
+ const {
8
+ locale
9
+ } = context;
10
+ const api = getPrezlyApi();
11
+ const staticProps = await api.getNewsroomServerSideProps(undefined, locale, options.story);
12
+ if (options.loadHomepageContacts) {
13
+ staticProps.newsroomContextProps.contacts = await api.getNewsroomContacts();
14
+ }
15
+ return {
16
+ api,
17
+ staticProps
18
+ };
19
+ }
@@ -1,7 +1,6 @@
1
- export * from './api-handlers';
2
- export * from './getNewsroomServerSideProps';
3
- export * from './getNewsroomStaticProps';
4
- export * from './page-props';
5
- export * from './processRequest';
6
- export * from './processStaticRequest';
7
- //# sourceMappingURL=index.js.map
1
+ export * from "./api-handlers/index.js";
2
+ export * from "./getNewsroomServerSideProps.js";
3
+ export * from "./getNewsroomStaticProps.js";
4
+ export * from "./page-props/index.js";
5
+ export * from "./processRequest.js";
6
+ export * from "./processStaticRequest.js";
@@ -1,98 +1,122 @@
1
- import { getPrezlyApi } from '../../data-fetching';
2
- import { LocaleObject } from '../../intl';
3
- import { DEFAULT_PAGE_SIZE, getLocalizedCategoryData } from '../../utils';
4
- import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
5
- import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
6
- import { processRequest } from '../processRequest';
7
- import { processStaticRequest } from '../processStaticRequest';
1
+ import { getPrezlyApi } from "../../data-fetching/index.js";
2
+ import { LocaleObject } from "../../intl/index.js";
3
+ import { DEFAULT_PAGE_SIZE, getLocalizedCategoryData } from "../../utils/index.js";
4
+ import { getNewsroomServerSideProps } from "../getNewsroomServerSideProps.js";
5
+ import { getNewsroomStaticProps } from "../getNewsroomStaticProps.js";
6
+ import { processRequest } from "../processRequest.js";
7
+ import { processStaticRequest } from "../processStaticRequest.js";
8
8
  export function getCategoryPageServerSideProps(customProps, options) {
9
- const { pageSize = DEFAULT_PAGE_SIZE, extraStoryFields } = options || {};
10
- return async function getServerSideProps(context) {
11
- const { api, serverSideProps } = await getNewsroomServerSideProps(context);
12
- const { slug } = context.params;
13
- const category = await api.getCategoryBySlug(slug);
14
- if (!category) {
15
- return {
16
- notFound: true,
17
- };
18
- }
19
- const { query } = context;
20
- const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
21
- const { localeCode } = serverSideProps.newsroomContextProps;
22
- const { stories, storiesTotal } = await api.getStoriesFromCategory(category, {
23
- page,
24
- pageSize,
25
- include: extraStoryFields,
26
- localeCode,
27
- });
28
- serverSideProps.newsroomContextProps.currentCategory = category;
29
- return processRequest(context, {
30
- ...serverSideProps,
31
- // TODO: This is temporary until return types from API are figured out
32
- stories: stories,
33
- pagination: {
34
- itemsTotal: storiesTotal,
35
- currentPage: page ?? 1,
36
- pageSize,
37
- },
38
- ...(typeof customProps === 'function'
39
- ? await customProps(context, serverSideProps)
40
- : customProps),
41
- }, `/category/${slug}`);
42
- };
9
+ const {
10
+ pageSize = DEFAULT_PAGE_SIZE,
11
+ extraStoryFields
12
+ } = options || {};
13
+ return async function getServerSideProps(context) {
14
+ const {
15
+ api,
16
+ serverSideProps
17
+ } = await getNewsroomServerSideProps(context);
18
+ const {
19
+ slug
20
+ } = context.params;
21
+ const category = await api.getCategoryBySlug(slug);
22
+ if (!category) {
23
+ return {
24
+ notFound: true
25
+ };
26
+ }
27
+ const {
28
+ query
29
+ } = context;
30
+ const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
31
+ const {
32
+ localeCode
33
+ } = serverSideProps.newsroomContextProps;
34
+ const {
35
+ stories,
36
+ storiesTotal
37
+ } = await api.getStoriesFromCategory(category, {
38
+ page,
39
+ pageSize,
40
+ include: extraStoryFields,
41
+ localeCode
42
+ });
43
+ serverSideProps.newsroomContextProps.currentCategory = category;
44
+ return processRequest(context, {
45
+ ...serverSideProps,
46
+ // TODO: This is temporary until return types from API are figured out
47
+ stories: stories,
48
+ pagination: {
49
+ itemsTotal: storiesTotal,
50
+ currentPage: page ?? 1,
51
+ pageSize
52
+ },
53
+ ...(typeof customProps === 'function' ? await customProps(context, serverSideProps) : customProps)
54
+ }, `/category/${slug}`);
55
+ };
43
56
  }
44
57
  export function getCategoryPageStaticProps(customProps, options) {
45
- const { pageSize = DEFAULT_PAGE_SIZE, extraStoryFields } = options || {};
46
- return async function getStaticProps(context) {
47
- const { api, staticProps } = await getNewsroomStaticProps(context);
48
- const { slug } = context.params;
49
- const category = await api.getCategoryBySlug(slug);
50
- if (!category) {
51
- return {
52
- notFound: true,
53
- };
54
- }
55
- const { localeCode } = staticProps.newsroomContextProps;
56
- const { stories, storiesTotal } = await api.getStoriesFromCategory(category, {
57
- pageSize,
58
- include: extraStoryFields,
59
- localeCode,
60
- });
61
- staticProps.newsroomContextProps.currentCategory = category;
62
- return processStaticRequest(context, {
63
- ...staticProps,
64
- // TODO: This is temporary until return types from API are figured out
65
- stories: stories,
66
- pagination: {
67
- itemsTotal: storiesTotal,
68
- currentPage: 1,
69
- pageSize,
70
- },
71
- ...(typeof customProps === 'function'
72
- ? await customProps(context, staticProps)
73
- : customProps),
74
- });
75
- };
58
+ const {
59
+ pageSize = DEFAULT_PAGE_SIZE,
60
+ extraStoryFields
61
+ } = options || {};
62
+ return async function getStaticProps(context) {
63
+ const {
64
+ api,
65
+ staticProps
66
+ } = await getNewsroomStaticProps(context);
67
+ const {
68
+ slug
69
+ } = context.params;
70
+ const category = await api.getCategoryBySlug(slug);
71
+ if (!category) {
72
+ return {
73
+ notFound: true
74
+ };
75
+ }
76
+ const {
77
+ localeCode
78
+ } = staticProps.newsroomContextProps;
79
+ const {
80
+ stories,
81
+ storiesTotal
82
+ } = await api.getStoriesFromCategory(category, {
83
+ pageSize,
84
+ include: extraStoryFields,
85
+ localeCode
86
+ });
87
+ staticProps.newsroomContextProps.currentCategory = category;
88
+ return processStaticRequest(context, {
89
+ ...staticProps,
90
+ // TODO: This is temporary until return types from API are figured out
91
+ stories: stories,
92
+ pagination: {
93
+ itemsTotal: storiesTotal,
94
+ currentPage: 1,
95
+ pageSize
96
+ },
97
+ ...(typeof customProps === 'function' ? await customProps(context, staticProps) : customProps)
98
+ });
99
+ };
76
100
  }
77
101
  export async function getCategoryPageStaticPaths() {
78
- const api = getPrezlyApi();
79
- const [categories, defaultLanguage] = await Promise.all([
80
- api.getCategories(),
81
- api.getNewsroomDefaultLanguage(),
82
- ]);
83
- const locale = LocaleObject.fromAnyCode(defaultLanguage.code);
84
- const paths = categories
85
- .map((category) => {
86
- const { slug } = getLocalizedCategoryData(category, locale);
87
- if (!slug) {
88
- return undefined;
89
- }
90
- return { params: { slug } };
91
- })
92
- .filter(Boolean);
102
+ const api = getPrezlyApi();
103
+ const [categories, defaultLanguage] = await Promise.all([api.getCategories(), api.getNewsroomDefaultLanguage()]);
104
+ const locale = LocaleObject.fromAnyCode(defaultLanguage.code);
105
+ const paths = categories.map(category => {
106
+ const {
107
+ slug
108
+ } = getLocalizedCategoryData(category, locale);
109
+ if (!slug) {
110
+ return undefined;
111
+ }
93
112
  return {
94
- paths,
95
- fallback: 'blocking',
113
+ params: {
114
+ slug
115
+ }
96
116
  };
97
- }
98
- //# sourceMappingURL=category.js.map
117
+ }).filter(Boolean);
118
+ return {
119
+ paths,
120
+ fallback: 'blocking'
121
+ };
122
+ }
@@ -1,66 +1,90 @@
1
- import { DEFAULT_GALLERY_PAGE_SIZE } from '../../utils';
2
- import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
3
- import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
4
- import { processRequest } from '../processRequest';
5
- import { processStaticRequest } from '../processStaticRequest';
1
+ import { DEFAULT_GALLERY_PAGE_SIZE } from "../../utils/index.js";
2
+ import { getNewsroomServerSideProps } from "../getNewsroomServerSideProps.js";
3
+ import { getNewsroomStaticProps } from "../getNewsroomStaticProps.js";
4
+ import { processRequest } from "../processRequest.js";
5
+ import { processStaticRequest } from "../processStaticRequest.js";
6
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
- };
7
+ const {
8
+ pageSize = DEFAULT_GALLERY_PAGE_SIZE
9
+ } = options || {};
10
+ return async function getServerSideProps(context) {
11
+ const {
12
+ api,
13
+ serverSideProps
14
+ } = await getNewsroomServerSideProps(context);
15
+ const {
16
+ query
17
+ } = context;
18
+ const page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
19
+ const {
20
+ galleries,
21
+ pagination
22
+ } = await api.getGalleries({
23
+ page,
24
+ pageSize
25
+ });
26
+
27
+ // If there's only one gallery, redirect to it immediately
28
+ if (galleries.length === 1) {
29
+ const {
30
+ uuid
31
+ } = galleries[0];
32
+ return {
33
+ redirect: {
34
+ destination: `/media/album/${uuid}`,
35
+ permanent: false
22
36
  }
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
- };
37
+ };
38
+ }
39
+ return processRequest(context, {
40
+ ...serverSideProps,
41
+ galleries,
42
+ pagination: {
43
+ itemsTotal: pagination.matched_records_number,
44
+ currentPage: page ?? 1,
45
+ pageSize
46
+ },
47
+ ...(typeof customProps === 'function' ? await customProps(context, serverSideProps) : customProps)
48
+ }, '/media');
49
+ };
36
50
  }
37
51
  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
- };
52
+ const {
53
+ pageSize = DEFAULT_GALLERY_PAGE_SIZE
54
+ } = options || {};
55
+ return async function getStaticProps(context) {
56
+ const {
57
+ api,
58
+ staticProps
59
+ } = await getNewsroomStaticProps(context);
60
+ const {
61
+ galleries,
62
+ pagination
63
+ } = await api.getGalleries({
64
+ pageSize
65
+ });
66
+
67
+ // If there's only one gallery, redirect to it immediately
68
+ if (galleries.length === 1) {
69
+ const {
70
+ uuid
71
+ } = galleries[0];
72
+ return {
73
+ redirect: {
74
+ destination: `/media/album/${uuid}`,
75
+ permanent: false
51
76
  }
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
77
+ };
78
+ }
79
+ return processStaticRequest(context, {
80
+ ...staticProps,
81
+ galleries,
82
+ pagination: {
83
+ itemsTotal: pagination.matched_records_number,
84
+ currentPage: 1,
85
+ pageSize
86
+ },
87
+ ...(typeof customProps === 'function' ? await customProps(context, staticProps) : customProps)
88
+ });
89
+ };
90
+ }