@prezly/theme-kit-nextjs 1.16.0-0 → 1.16.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/build/adapter-nextjs/api-handlers/fetchGalleries.js +16 -66
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
- package/build/adapter-nextjs/api-handlers/fetchStories.js +18 -68
- package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomServerSideProps.js +9 -59
- package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomStaticProps.js +9 -59
- package/build/adapter-nextjs/getNewsroomStaticProps.js.map +1 -1
- package/build/adapter-nextjs/page-props/category.js +94 -195
- package/build/adapter-nextjs/page-props/category.js.map +1 -1
- package/build/adapter-nextjs/page-props/gallery.js +58 -135
- package/build/adapter-nextjs/page-props/gallery.js.map +1 -1
- package/build/adapter-nextjs/page-props/galleryAlbum.js +40 -132
- package/build/adapter-nextjs/page-props/galleryAlbum.js.map +1 -1
- package/build/adapter-nextjs/page-props/home.js +56 -135
- package/build/adapter-nextjs/page-props/home.js.map +1 -1
- package/build/adapter-nextjs/page-props/search.js +19 -96
- package/build/adapter-nextjs/page-props/search.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +18 -18
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js +9 -40
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +28 -76
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -1
- package/build/adapter-nextjs/page-props/story.js +57 -159
- package/build/adapter-nextjs/page-props/story.js.map +1 -1
- package/build/adapter-nextjs/page-props/storyPreview.js +20 -81
- package/build/adapter-nextjs/page-props/storyPreview.js.map +1 -1
- package/build/adapter-nextjs/processRequest.js +8 -19
- package/build/adapter-nextjs/processRequest.js.map +1 -1
- package/build/adapter-nextjs/processStaticRequest.js +2 -13
- package/build/adapter-nextjs/processStaticRequest.js.map +1 -1
- package/build/components-nextjs/PageSeo/PageSeo.js +41 -52
- package/build/components-nextjs/PageSeo/PageSeo.js.map +1 -1
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +1 -1
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +1 -1
- package/build/components-nextjs/StorySeo/StorySeo.js +27 -31
- package/build/components-nextjs/StorySeo/StorySeo.js.map +1 -1
- package/build/components-nextjs/document.js +16 -45
- package/build/components-nextjs/document.js.map +1 -1
- package/build/data-fetching/api/PrezlyApi.js +170 -355
- package/build/data-fetching/api/PrezlyApi.js.map +1 -1
- package/build/data-fetching/api/getPrezlyApi.js +3 -3
- package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
- package/build/data-fetching/api/queries.js +8 -32
- package/build/data-fetching/api/queries.js.map +1 -1
- package/build/data-fetching/lib/getAlgoliaSettings.js +5 -5
- package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
- package/build/data-fetching/lib/getEnvVariables.js +10 -21
- package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
- package/build/data-fetching/lib/isUuid.js +1 -1
- package/build/data-fetching/lib/isUuid.js.map +1 -1
- package/build/infinite-loading/useInfiniteGalleriesLoading.js +25 -79
- package/build/infinite-loading/useInfiniteGalleriesLoading.js.map +1 -1
- package/build/infinite-loading/useInfiniteLoading.js +22 -94
- package/build/infinite-loading/useInfiniteLoading.js.map +1 -1
- package/build/infinite-loading/useInfiniteStoriesLoading.js +36 -95
- package/build/infinite-loading/useInfiniteStoriesLoading.js.map +1 -1
- package/build/intl/languages.js +35 -68
- package/build/intl/languages.js.map +1 -1
- package/build/intl/locale.js +13 -13
- package/build/intl/locale.js.map +1 -1
- package/build/intl/localeConfig.js +11 -32
- package/build/intl/localeConfig.js.map +1 -1
- package/build/intl/localeObject.js +30 -42
- package/build/intl/localeObject.js.map +1 -1
- package/build/newsroom-context/context.js +17 -29
- package/build/newsroom-context/context.js.map +1 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +2 -2
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
- package/build/newsroom-context/hooks/useCategories.js +2 -2
- package/build/newsroom-context/hooks/useCategories.js.map +1 -1
- package/build/newsroom-context/hooks/useCompanyInformation.js +2 -2
- package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentCategory.js +2 -2
- package/build/newsroom-context/hooks/useCurrentCategory.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentLocale.js +2 -2
- package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentStory.js +2 -2
- package/build/newsroom-context/hooks/useCurrentStory.js.map +1 -1
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +8 -8
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +14 -19
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
- package/build/newsroom-context/hooks/useLanguages.js +2 -2
- package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroom.js +2 -2
- package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroomContext.js +3 -3
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
- package/build/sentry/client.js +1 -1
- package/build/sentry/client.js.map +1 -1
- package/build/sentry/common.js +2 -2
- package/build/sentry/common.js.map +1 -1
- package/build/sentry/server.js +1 -1
- package/build/sentry/server.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/utils/getAssetsUrl.js +2 -2
- package/build/utils/getAssetsUrl.js.map +1 -1
- package/build/utils/getDataRequestLink.js +1 -1
- package/build/utils/getDataRequestLink.js.map +1 -1
- package/build/utils/getLocalizedCategoryData.js +12 -23
- package/build/utils/getLocalizedCategoryData.js.map +1 -1
- package/build/utils/getNewsroomLogoUrl.js +4 -5
- package/build/utils/getNewsroomLogoUrl.js.map +1 -1
- package/build/utils/getPrivacyPortalUrl.js +2 -2
- package/build/utils/getPrivacyPortalUrl.js.map +1 -1
- package/build/utils/getStoryPublicationDate.js +1 -1
- package/build/utils/getStoryPublicationDate.js.map +1 -1
- package/build/utils/getUploadcareGroupUrl.js +2 -2
- package/build/utils/getUploadcareGroupUrl.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,211 +1,110 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
-
if (!m) return o;
|
|
52
|
-
var i = m.call(o), r, ar = [], e;
|
|
53
|
-
try {
|
|
54
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
-
}
|
|
56
|
-
catch (error) { e = { error: error }; }
|
|
57
|
-
finally {
|
|
58
|
-
try {
|
|
59
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
-
}
|
|
61
|
-
finally { if (e) throw e.error; }
|
|
62
|
-
}
|
|
63
|
-
return ar;
|
|
64
|
-
};
|
|
65
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
3
|
exports.getCategoryPageStaticPaths = exports.getCategoryPageStaticProps = exports.getCategoryPageServerSideProps = void 0;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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");
|
|
74
11
|
function getCategoryPageServerSideProps(customProps, options) {
|
|
75
|
-
|
|
76
|
-
return function getServerSideProps(context) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
query = context.query;
|
|
94
|
-
page = query.page && typeof query.page === 'string' ? Number(query.page) : undefined;
|
|
95
|
-
localeCode = serverSideProps.newsroomContextProps.localeCode;
|
|
96
|
-
return [4 /*yield*/, api.getStoriesFromCategory(category, {
|
|
97
|
-
page: page,
|
|
98
|
-
pageSize: pageSize,
|
|
99
|
-
include: extraStoryFields,
|
|
100
|
-
localeCode: localeCode,
|
|
101
|
-
})];
|
|
102
|
-
case 3:
|
|
103
|
-
_b = _g.sent(), stories = _b.stories, storiesTotal = _b.storiesTotal;
|
|
104
|
-
_c = processRequest_1.processRequest;
|
|
105
|
-
_d = [context];
|
|
106
|
-
_e = [__assign(__assign({}, serverSideProps), { newsroomContextProps: __assign(__assign({}, serverSideProps.newsroomContextProps), { currentCategory: category }),
|
|
107
|
-
// TODO: This is temporary until return types from API are figured out
|
|
108
|
-
stories: stories, pagination: {
|
|
109
|
-
itemsTotal: storiesTotal,
|
|
110
|
-
currentPage: page !== null && page !== void 0 ? page : 1,
|
|
111
|
-
pageSize: pageSize,
|
|
112
|
-
} })];
|
|
113
|
-
if (!(typeof customProps === 'function')) return [3 /*break*/, 5];
|
|
114
|
-
return [4 /*yield*/, customProps(context, serverSideProps)];
|
|
115
|
-
case 4:
|
|
116
|
-
_f = _g.sent();
|
|
117
|
-
return [3 /*break*/, 6];
|
|
118
|
-
case 5:
|
|
119
|
-
_f = customProps;
|
|
120
|
-
_g.label = 6;
|
|
121
|
-
case 6: return [2 /*return*/, _c.apply(void 0, _d.concat([__assign.apply(void 0, _e.concat([(_f)])), "/category/".concat(slug)]))];
|
|
122
|
-
}
|
|
123
|
-
});
|
|
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,
|
|
124
30
|
});
|
|
31
|
+
return (0, processRequest_1.processRequest)(context, {
|
|
32
|
+
...serverSideProps,
|
|
33
|
+
newsroomContextProps: {
|
|
34
|
+
...serverSideProps.newsroomContextProps,
|
|
35
|
+
currentCategory: category,
|
|
36
|
+
},
|
|
37
|
+
// TODO: This is temporary until return types from API are figured out
|
|
38
|
+
stories: stories,
|
|
39
|
+
pagination: {
|
|
40
|
+
itemsTotal: storiesTotal,
|
|
41
|
+
currentPage: page ?? 1,
|
|
42
|
+
pageSize,
|
|
43
|
+
},
|
|
44
|
+
...(typeof customProps === 'function'
|
|
45
|
+
? await customProps(context, serverSideProps)
|
|
46
|
+
: customProps),
|
|
47
|
+
}, `/category/${slug}`);
|
|
125
48
|
};
|
|
126
49
|
}
|
|
127
50
|
exports.getCategoryPageServerSideProps = getCategoryPageServerSideProps;
|
|
128
51
|
function getCategoryPageStaticProps(customProps, options) {
|
|
129
|
-
|
|
130
|
-
return function getStaticProps(context) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
currentPage: 1,
|
|
162
|
-
pageSize: pageSize,
|
|
163
|
-
} })];
|
|
164
|
-
if (!(typeof customProps === 'function')) return [3 /*break*/, 5];
|
|
165
|
-
return [4 /*yield*/, customProps(context, staticProps)];
|
|
166
|
-
case 4:
|
|
167
|
-
_f = _g.sent();
|
|
168
|
-
return [3 /*break*/, 6];
|
|
169
|
-
case 5:
|
|
170
|
-
_f = customProps;
|
|
171
|
-
_g.label = 6;
|
|
172
|
-
case 6: return [2 /*return*/, _c.apply(void 0, _d.concat([__assign.apply(void 0, _e.concat([(_f)]))]))];
|
|
173
|
-
}
|
|
174
|
-
});
|
|
52
|
+
const { pageSize = utils_1.DEFAULT_PAGE_SIZE, extraStoryFields } = options || {};
|
|
53
|
+
return async function getStaticProps(context) {
|
|
54
|
+
const { api, staticProps } = await (0, getNewsroomStaticProps_1.getNewsroomStaticProps)(context);
|
|
55
|
+
const { slug } = context.params;
|
|
56
|
+
const category = await api.getCategoryBySlug(slug);
|
|
57
|
+
if (!category) {
|
|
58
|
+
return {
|
|
59
|
+
notFound: true,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const { localeCode } = staticProps.newsroomContextProps;
|
|
63
|
+
const { stories, storiesTotal } = await api.getStoriesFromCategory(category, {
|
|
64
|
+
pageSize,
|
|
65
|
+
include: extraStoryFields,
|
|
66
|
+
localeCode,
|
|
67
|
+
});
|
|
68
|
+
return (0, processStaticRequest_1.processStaticRequest)(context, {
|
|
69
|
+
...staticProps,
|
|
70
|
+
newsroomContextProps: {
|
|
71
|
+
...staticProps.newsroomContextProps,
|
|
72
|
+
currentCategory: category,
|
|
73
|
+
},
|
|
74
|
+
// TODO: This is temporary until return types from API are figured out
|
|
75
|
+
stories: stories,
|
|
76
|
+
pagination: {
|
|
77
|
+
itemsTotal: storiesTotal,
|
|
78
|
+
currentPage: 1,
|
|
79
|
+
pageSize,
|
|
80
|
+
},
|
|
81
|
+
...(typeof customProps === 'function'
|
|
82
|
+
? await customProps(context, staticProps)
|
|
83
|
+
: customProps),
|
|
175
84
|
});
|
|
176
85
|
};
|
|
177
86
|
}
|
|
178
87
|
exports.getCategoryPageStaticProps = getCategoryPageStaticProps;
|
|
179
|
-
function getCategoryPageStaticPaths() {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return { params: { slug: slug } };
|
|
200
|
-
})
|
|
201
|
-
.filter(Boolean);
|
|
202
|
-
return [2 /*return*/, {
|
|
203
|
-
paths: paths,
|
|
204
|
-
fallback: 'blocking',
|
|
205
|
-
}];
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
});
|
|
88
|
+
async function getCategoryPageStaticPaths() {
|
|
89
|
+
const api = (0, data_fetching_1.getPrezlyApi)();
|
|
90
|
+
const [categories, defaultLanguage] = await Promise.all([
|
|
91
|
+
api.getCategories(),
|
|
92
|
+
api.getNewsroomDefaultLanguage(),
|
|
93
|
+
]);
|
|
94
|
+
const locale = intl_1.LocaleObject.fromAnyCode(defaultLanguage.code);
|
|
95
|
+
const paths = categories
|
|
96
|
+
.map((category) => {
|
|
97
|
+
const { slug } = (0, utils_1.getLocalizedCategoryData)(category, locale);
|
|
98
|
+
if (!slug) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
return { params: { slug } };
|
|
102
|
+
})
|
|
103
|
+
.filter(Boolean);
|
|
104
|
+
return {
|
|
105
|
+
paths,
|
|
106
|
+
fallback: 'blocking',
|
|
107
|
+
};
|
|
209
108
|
}
|
|
210
109
|
exports.getCategoryPageStaticPaths = getCategoryPageStaticPaths;
|
|
211
110
|
//# sourceMappingURL=category.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/category.ts"],"names":[],"mappings":"
|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) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.getGalleryPageStaticProps = exports.getGalleryPageServerSideProps = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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");
|
|
56
9
|
function getGalleryPageServerSideProps(customProps, options) {
|
|
57
|
-
|
|
58
|
-
return function getServerSideProps(context) {
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
currentPage: page !== null && page !== void 0 ? page : 1,
|
|
86
|
-
pageSize: pageSize,
|
|
87
|
-
} })];
|
|
88
|
-
if (!(typeof customProps === 'function')) return [3 /*break*/, 4];
|
|
89
|
-
return [4 /*yield*/, customProps(context, serverSideProps)];
|
|
90
|
-
case 3:
|
|
91
|
-
_f = _g.sent();
|
|
92
|
-
return [3 /*break*/, 5];
|
|
93
|
-
case 4:
|
|
94
|
-
_f = customProps;
|
|
95
|
-
_g.label = 5;
|
|
96
|
-
case 5: return [2 /*return*/, _c.apply(void 0, _d.concat([__assign.apply(void 0, _e.concat([(_f)])), '/media']))];
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
});
|
|
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
|
+
};
|
|
25
|
+
}
|
|
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');
|
|
100
38
|
};
|
|
101
39
|
}
|
|
102
40
|
exports.getGalleryPageServerSideProps = getGalleryPageServerSideProps;
|
|
103
41
|
function getGalleryPageStaticProps(customProps, options) {
|
|
104
|
-
|
|
105
|
-
return function getStaticProps(context) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
itemsTotal: pagination.matched_records_number,
|
|
130
|
-
currentPage: 1,
|
|
131
|
-
pageSize: pageSize,
|
|
132
|
-
} })];
|
|
133
|
-
if (!(typeof customProps === 'function')) return [3 /*break*/, 4];
|
|
134
|
-
return [4 /*yield*/, customProps(context, staticProps)];
|
|
135
|
-
case 3:
|
|
136
|
-
_f = _g.sent();
|
|
137
|
-
return [3 /*break*/, 5];
|
|
138
|
-
case 4:
|
|
139
|
-
_f = customProps;
|
|
140
|
-
_g.label = 5;
|
|
141
|
-
case 5: return [2 /*return*/, _c.apply(void 0, _d.concat([__assign.apply(void 0, _e.concat([(_f)]))]))];
|
|
142
|
-
}
|
|
143
|
-
});
|
|
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
|
+
};
|
|
55
|
+
}
|
|
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),
|
|
144
67
|
});
|
|
145
68
|
};
|
|
146
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gallery.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/gallery.ts"],"names":[],"mappings":"
|
|
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,M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