@prezly/theme-kit-nextjs 1.16.0-0 → 1.16.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/adapter-nextjs/api-handlers/fetchGalleries.js +15 -69
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
- package/build/adapter-nextjs/api-handlers/fetchStories.js +17 -71
- package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
- package/build/adapter-nextjs/api-handlers/index.js +2 -7
- package/build/adapter-nextjs/api-handlers/index.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomServerSideProps.js +9 -63
- package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomStaticProps.js +9 -63
- package/build/adapter-nextjs/getNewsroomStaticProps.js.map +1 -1
- package/build/adapter-nextjs/index.js +6 -22
- package/build/adapter-nextjs/index.js.map +1 -1
- package/build/adapter-nextjs/page-props/category.js +95 -202
- package/build/adapter-nextjs/page-props/category.js.map +1 -1
- package/build/adapter-nextjs/page-props/gallery.js +59 -141
- package/build/adapter-nextjs/page-props/gallery.js.map +1 -1
- package/build/adapter-nextjs/page-props/galleryAlbum.js +41 -139
- package/build/adapter-nextjs/page-props/galleryAlbum.js.map +1 -1
- package/build/adapter-nextjs/page-props/home.js +58 -142
- package/build/adapter-nextjs/page-props/home.js.map +1 -1
- package/build/adapter-nextjs/page-props/index.js +8 -41
- package/build/adapter-nextjs/page-props/index.js.map +1 -1
- package/build/adapter-nextjs/page-props/lib/types.js +1 -2
- package/build/adapter-nextjs/page-props/search.js +21 -103
- package/build/adapter-nextjs/page-props/search.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +18 -22
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js +10 -45
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +29 -81
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/index.js +4 -24
- package/build/adapter-nextjs/page-props/sitemap/index.js.map +1 -1
- package/build/adapter-nextjs/page-props/sitemap/types.js +1 -2
- package/build/adapter-nextjs/page-props/story.js +58 -166
- package/build/adapter-nextjs/page-props/story.js.map +1 -1
- package/build/adapter-nextjs/page-props/storyPreview.js +20 -85
- package/build/adapter-nextjs/page-props/storyPreview.js.map +1 -1
- package/build/adapter-nextjs/processRequest.js +9 -24
- package/build/adapter-nextjs/processRequest.js.map +1 -1
- package/build/adapter-nextjs/processStaticRequest.js +3 -18
- package/build/adapter-nextjs/processStaticRequest.js.map +1 -1
- package/build/components-nextjs/PageSeo/PageSeo.js +42 -57
- package/build/components-nextjs/PageSeo/PageSeo.js.map +1 -1
- package/build/components-nextjs/PageSeo/index.js +2 -20
- package/build/components-nextjs/PageSeo/index.js.map +1 -1
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +2 -6
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +1 -1
- package/build/components-nextjs/PageSeo/lib/types.js +1 -2
- package/build/components-nextjs/StorySeo/StorySeo.js +28 -36
- package/build/components-nextjs/StorySeo/StorySeo.js.map +1 -1
- package/build/components-nextjs/StorySeo/index.js +1 -5
- package/build/components-nextjs/StorySeo/index.js.map +1 -1
- package/build/components-nextjs/document.js +16 -72
- package/build/components-nextjs/document.js.map +1 -1
- package/build/components-nextjs/index.js +3 -9
- package/build/components-nextjs/index.js.map +1 -1
- package/build/data-fetching/api/PrezlyApi.js +171 -363
- package/build/data-fetching/api/PrezlyApi.js.map +1 -1
- package/build/data-fetching/api/getPrezlyApi.js +5 -9
- package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
- package/build/data-fetching/api/index.js +1 -17
- package/build/data-fetching/api/index.js.map +1 -1
- package/build/data-fetching/api/queries.js +13 -45
- package/build/data-fetching/api/queries.js.map +1 -1
- package/build/data-fetching/index.js +3 -19
- package/build/data-fetching/index.js.map +1 -1
- package/build/data-fetching/lib/getAlgoliaSettings.js +6 -10
- package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
- package/build/data-fetching/lib/getEnvVariables.js +11 -29
- package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
- package/build/data-fetching/lib/index.js +4 -11
- package/build/data-fetching/lib/index.js.map +1 -1
- package/build/data-fetching/lib/isSdkError.js +1 -5
- package/build/data-fetching/lib/isSdkError.js.map +1 -1
- package/build/data-fetching/lib/isUuid.js +2 -6
- package/build/data-fetching/lib/isUuid.js.map +1 -1
- package/build/data-fetching/types.js +1 -2
- package/build/index.js +9 -25
- package/build/index.js.map +1 -1
- package/build/infinite-loading/index.js +4 -24
- package/build/infinite-loading/index.js.map +1 -1
- package/build/infinite-loading/types.js +1 -2
- package/build/infinite-loading/useInfiniteGalleriesLoading.js +25 -83
- package/build/infinite-loading/useInfiniteGalleriesLoading.js.map +1 -1
- package/build/infinite-loading/useInfiniteLoading.js +21 -97
- package/build/infinite-loading/useInfiniteLoading.js.map +1 -1
- package/build/infinite-loading/useInfiniteStoriesLoading.js +36 -99
- package/build/infinite-loading/useInfiniteStoriesLoading.js.map +1 -1
- package/build/intl/index.js +4 -25
- package/build/intl/index.js.map +1 -1
- package/build/intl/languages.js +47 -93
- package/build/intl/languages.js.map +1 -1
- package/build/intl/locale.js +21 -27
- 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 -49
- package/build/intl/localeObject.js.map +1 -1
- package/build/newsroom-context/context.js +18 -34
- package/build/newsroom-context/context.js.map +1 -1
- package/build/newsroom-context/hooks/index.js +11 -27
- package/build/newsroom-context/hooks/index.js.map +1 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +3 -7
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
- package/build/newsroom-context/hooks/useCategories.js +3 -7
- package/build/newsroom-context/hooks/useCategories.js.map +1 -1
- package/build/newsroom-context/hooks/useCompanyInformation.js +3 -7
- package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentCategory.js +3 -7
- package/build/newsroom-context/hooks/useCurrentCategory.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentLocale.js +3 -7
- package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentStory.js +3 -7
- package/build/newsroom-context/hooks/useCurrentStory.js.map +1 -1
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +10 -14
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +17 -26
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
- package/build/newsroom-context/hooks/useLanguages.js +3 -7
- package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroom.js +3 -7
- package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroomContext.js +4 -8
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
- package/build/newsroom-context/index.js +2 -21
- package/build/newsroom-context/index.js.map +1 -1
- package/build/sentry/client.js +3 -7
- package/build/sentry/client.js.map +1 -1
- package/build/sentry/common.js +3 -7
- package/build/sentry/common.js.map +1 -1
- package/build/sentry/index.js +2 -7
- package/build/sentry/index.js.map +1 -1
- package/build/sentry/server.js +3 -7
- package/build/sentry/server.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types.js +1 -2
- package/build/utils/boilerplate.js +3 -9
- package/build/utils/boilerplate.js.map +1 -1
- package/build/utils/constants.js +3 -6
- package/build/utils/constants.js.map +1 -1
- package/build/utils/getAssetsUrl.js +3 -7
- package/build/utils/getAssetsUrl.js.map +1 -1
- package/build/utils/getDataRequestLink.js +3 -7
- package/build/utils/getDataRequestLink.js.map +1 -1
- package/build/utils/getLocalizedCategoryData.js +15 -32
- package/build/utils/getLocalizedCategoryData.js.map +1 -1
- package/build/utils/getNewsroomLogoUrl.js +6 -12
- package/build/utils/getNewsroomLogoUrl.js.map +1 -1
- package/build/utils/getPrivacyPortalUrl.js +3 -7
- package/build/utils/getPrivacyPortalUrl.js.map +1 -1
- package/build/utils/getStoryPublicationDate.js +2 -6
- package/build/utils/getStoryPublicationDate.js.map +1 -1
- package/build/utils/getUploadcareGroupUrl.js +3 -7
- package/build/utils/getUploadcareGroupUrl.js.map +1 -1
- package/build/utils/index.js +10 -26
- package/build/utils/index.js.map +1 -1
- package/build/utils/isEmbargoStory.js +1 -5
- package/build/utils/isEmbargoStory.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,109 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.getSearchPageStaticProps = exports.getSearchPageServerSideProps = void 0;
|
|
51
|
-
var getNewsroomServerSideProps_1 = require("../getNewsroomServerSideProps");
|
|
52
|
-
var getNewsroomStaticProps_1 = require("../getNewsroomStaticProps");
|
|
53
|
-
var processRequest_1 = require("../processRequest");
|
|
54
|
-
var processStaticRequest_1 = require("../processStaticRequest");
|
|
55
|
-
function getSearchPageServerSideProps(customProps) {
|
|
56
|
-
return function getServerSideProps(context) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
-
var serverSideProps, _a, _b, _c, _d;
|
|
59
|
-
return __generator(this, function (_e) {
|
|
60
|
-
switch (_e.label) {
|
|
61
|
-
case 0: return [4 /*yield*/, (0, getNewsroomServerSideProps_1.getNewsroomServerSideProps)(context)];
|
|
62
|
-
case 1:
|
|
63
|
-
serverSideProps = (_e.sent()).serverSideProps;
|
|
64
|
-
_a = processRequest_1.processRequest;
|
|
65
|
-
_b = [context];
|
|
66
|
-
_c = [__assign({}, serverSideProps)];
|
|
67
|
-
if (!(typeof customProps === 'function')) return [3 /*break*/, 3];
|
|
68
|
-
return [4 /*yield*/, customProps(context, serverSideProps)];
|
|
69
|
-
case 2:
|
|
70
|
-
_d = _e.sent();
|
|
71
|
-
return [3 /*break*/, 4];
|
|
72
|
-
case 3:
|
|
73
|
-
_d = customProps;
|
|
74
|
-
_e.label = 4;
|
|
75
|
-
case 4: return [2 /*return*/, _a.apply(void 0, _b.concat([__assign.apply(void 0, _c.concat([(_d)])), '/search']))];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
});
|
|
1
|
+
import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
|
|
2
|
+
import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
|
|
3
|
+
import { processRequest } from '../processRequest';
|
|
4
|
+
import { processStaticRequest } from '../processStaticRequest';
|
|
5
|
+
export function getSearchPageServerSideProps(customProps) {
|
|
6
|
+
return async function getServerSideProps(context) {
|
|
7
|
+
const { serverSideProps } = await getNewsroomServerSideProps(context);
|
|
8
|
+
return processRequest(context, {
|
|
9
|
+
...serverSideProps,
|
|
10
|
+
...(typeof customProps === 'function'
|
|
11
|
+
? await customProps(context, serverSideProps)
|
|
12
|
+
: customProps),
|
|
13
|
+
}, '/search');
|
|
79
14
|
};
|
|
80
15
|
}
|
|
81
|
-
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
case 1:
|
|
90
|
-
staticProps = (_e.sent()).staticProps;
|
|
91
|
-
_a = processStaticRequest_1.processStaticRequest;
|
|
92
|
-
_b = [context];
|
|
93
|
-
_c = [__assign({}, staticProps)];
|
|
94
|
-
if (!(typeof customProps === 'function')) return [3 /*break*/, 3];
|
|
95
|
-
return [4 /*yield*/, customProps(context, staticProps)];
|
|
96
|
-
case 2:
|
|
97
|
-
_d = _e.sent();
|
|
98
|
-
return [3 /*break*/, 4];
|
|
99
|
-
case 3:
|
|
100
|
-
_d = customProps;
|
|
101
|
-
_e.label = 4;
|
|
102
|
-
case 4: return [2 /*return*/, _a.apply(void 0, _b.concat([__assign.apply(void 0, _c.concat([(_d)]))]))];
|
|
103
|
-
}
|
|
104
|
-
});
|
|
16
|
+
export function getSearchPageStaticProps(customProps) {
|
|
17
|
+
return async function getStaticProps(context) {
|
|
18
|
+
const { staticProps } = await getNewsroomStaticProps(context);
|
|
19
|
+
return processStaticRequest(context, {
|
|
20
|
+
...staticProps,
|
|
21
|
+
...(typeof customProps === 'function'
|
|
22
|
+
? await customProps(context, staticProps)
|
|
23
|
+
: customProps),
|
|
105
24
|
});
|
|
106
25
|
};
|
|
107
26
|
}
|
|
108
|
-
exports.getSearchPageStaticProps = getSearchPageStaticProps;
|
|
109
27
|
//# sourceMappingURL=search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/search.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,E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Url;
|
|
8
6
|
}
|
|
9
|
-
|
|
7
|
+
addUrl(location) {
|
|
10
8
|
this.urls.push({
|
|
11
9
|
location: this.baseUrl + location,
|
|
12
10
|
changeFrequency: SitemapBuilder.guessFrequency(location),
|
|
13
11
|
priority: SitemapBuilder.guessPriority(location),
|
|
14
12
|
});
|
|
15
|
-
}
|
|
16
|
-
|
|
13
|
+
}
|
|
14
|
+
static guessFrequency(location) {
|
|
17
15
|
if (location === '/')
|
|
18
16
|
return 'daily';
|
|
19
17
|
return 'weekly';
|
|
20
|
-
}
|
|
21
|
-
|
|
18
|
+
}
|
|
19
|
+
static guessPriority(location) {
|
|
22
20
|
if (location === '/')
|
|
23
21
|
return '0.9';
|
|
24
22
|
if (location.startsWith('/category/')) {
|
|
25
23
|
return '0.8';
|
|
26
24
|
}
|
|
27
25
|
return '0.7';
|
|
28
|
-
}
|
|
29
|
-
|
|
26
|
+
}
|
|
27
|
+
static serializeLocation(url) {
|
|
30
28
|
return [
|
|
31
29
|
'<url>',
|
|
32
|
-
url.location &&
|
|
33
|
-
url.changeFrequency &&
|
|
34
|
-
url.priority &&
|
|
30
|
+
url.location && `\t<loc>${url.location}</loc>`,
|
|
31
|
+
url.changeFrequency && `\t<changefreq>${url.changeFrequency}</changefreq>`,
|
|
32
|
+
url.priority && `\t<priority>${url.priority}</priority>`,
|
|
35
33
|
'</url>',
|
|
36
34
|
]
|
|
37
35
|
.filter(Boolean)
|
|
38
36
|
.join('\n');
|
|
39
|
-
}
|
|
40
|
-
|
|
37
|
+
}
|
|
38
|
+
serialize() {
|
|
41
39
|
return [
|
|
42
40
|
'<?xml version="1.0" encoding="UTF-8" ?>',
|
|
43
41
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">',
|
|
44
42
|
this.urls.map(SitemapBuilder.serializeLocation).join('\n'),
|
|
45
43
|
'</urlset>',
|
|
46
44
|
].join('\n');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
}());
|
|
50
|
-
exports.SitemapBuilder = SitemapBuilder;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
51
47
|
//# sourceMappingURL=SitemapBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SitemapBuilder.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/SitemapBuilder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SitemapBuilder.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/SitemapBuilder.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IACf,OAAO,CAAS;IAEhB,IAAI,GAAiB,EAAE,CAAC;IAEhC,YAAY,OAAe;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,QAAgB;QAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YACX,QAAQ,EAAE,IAAI,CAAC,OAAO,GAAG,QAAQ;YACjC,eAAe,EAAE,cAAc,CAAC,cAAc,CAAC,QAAQ,CAAC;YACxD,QAAQ,EAAE,cAAc,CAAC,aAAa,CAAC,QAAQ,CAAC;SACnD,CAAC,CAAC;IACP,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,QAAgB;QAC1C,IAAI,QAAQ,KAAK,GAAG;YAAE,OAAO,OAAO,CAAC;QAErC,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,QAAgB;QACzC,IAAI,QAAQ,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QAEnC,IAAI,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;YACnC,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,GAAe;QACpC,OAAO;YACH,OAAO;YACP,GAAG,CAAC,QAAQ,IAAI,UAAU,GAAG,CAAC,QAAQ,QAAQ;YAC9C,GAAG,CAAC,eAAe,IAAI,iBAAiB,GAAG,CAAC,eAAe,eAAe;YAC1E,GAAG,CAAC,QAAQ,IAAI,eAAe,GAAG,CAAC,QAAQ,aAAa;YACxD,QAAQ;SACX;aACI,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,SAAS;QACL,OAAO;YACH,yCAAyC;YACzC,wLAAwL;YACxL,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1D,WAAW;SACd,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;CACJ"}
|
|
@@ -1,50 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
-
if (ar || !(i in from)) {
|
|
21
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
-
ar[i] = from[i];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.createPaths = void 0;
|
|
29
|
-
function createPaths(stories, categories) {
|
|
30
|
-
var storiesUrls = stories.map(function (_a) {
|
|
31
|
-
var slug = _a.slug;
|
|
32
|
-
return "/".concat(slug);
|
|
33
|
-
});
|
|
34
|
-
var categoriesUrls = categories
|
|
35
|
-
.map(function (category) {
|
|
36
|
-
var translations = Object.values(category.i18n);
|
|
37
|
-
var allSlugs = translations
|
|
38
|
-
.map(function (_a) {
|
|
39
|
-
var slug = _a.slug;
|
|
40
|
-
return slug || '';
|
|
41
|
-
})
|
|
1
|
+
export function createPaths(stories, categories) {
|
|
2
|
+
const storiesUrls = stories.map(({ slug }) => `/${slug}`);
|
|
3
|
+
const categoriesUrls = categories
|
|
4
|
+
.map((category) => {
|
|
5
|
+
const translations = Object.values(category.i18n);
|
|
6
|
+
const allSlugs = translations
|
|
7
|
+
.map(({ slug }) => slug || '')
|
|
42
8
|
.filter(Boolean)
|
|
43
|
-
.reduce(
|
|
44
|
-
return allSlugs.map(
|
|
9
|
+
.reduce((slugs, slug) => (slugs.includes(slug) ? [...slugs] : [...slugs, slug]), []);
|
|
10
|
+
return allSlugs.map((slug) => `/category/${slug}`);
|
|
45
11
|
})
|
|
46
12
|
.flat();
|
|
47
|
-
return
|
|
13
|
+
return [...storiesUrls, ...categoriesUrls];
|
|
48
14
|
}
|
|
49
|
-
exports.createPaths = createPaths;
|
|
50
15
|
//# sourceMappingURL=createPaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPaths.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/createPaths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createPaths.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/createPaths.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,UAAsB;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAC1D,MAAM,c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6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getSitemapServerSideProps = void 0;
|
|
40
|
-
var data_fetching_1 = require("../../../data-fetching");
|
|
41
|
-
var createPaths_1 = require("./createPaths");
|
|
42
|
-
var SitemapBuilder_1 = require("./SitemapBuilder");
|
|
43
|
-
function getSitemapServerSideProps(additionalPaths) {
|
|
44
|
-
return function getServerSideProps(ctx) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
-
var res, req, baseUrl, api, stories, categories, paths, sitemapBuilder;
|
|
47
|
-
return __generator(this, function (_a) {
|
|
48
|
-
switch (_a.label) {
|
|
49
|
-
case 0:
|
|
50
|
-
res = ctx.res, req = ctx.req;
|
|
51
|
-
if (!req || !res) {
|
|
52
|
-
// client side
|
|
53
|
-
return [2 /*return*/, {
|
|
54
|
-
props: {},
|
|
55
|
-
}];
|
|
56
|
-
}
|
|
57
|
-
baseUrl = req.headers.host || '/';
|
|
58
|
-
api = (0, data_fetching_1.getPrezlyApi)(req);
|
|
59
|
-
return [4 /*yield*/, api.getAllStories()];
|
|
60
|
-
case 1:
|
|
61
|
-
stories = _a.sent();
|
|
62
|
-
return [4 /*yield*/, api.getCategories()];
|
|
63
|
-
case 2:
|
|
64
|
-
categories = _a.sent();
|
|
65
|
-
paths = (0, createPaths_1.createPaths)(stories, categories);
|
|
66
|
-
sitemapBuilder = new SitemapBuilder_1.SitemapBuilder(baseUrl);
|
|
67
|
-
sitemapBuilder.addUrl('/');
|
|
68
|
-
paths.forEach(function (path) { return sitemapBuilder.addUrl(path); });
|
|
69
|
-
if (additionalPaths) {
|
|
70
|
-
additionalPaths.forEach(function (path) { return sitemapBuilder.addUrl(path); });
|
|
71
|
-
}
|
|
72
|
-
res.setHeader('Content-Type', 'text/xml');
|
|
73
|
-
res.write(sitemapBuilder.serialize());
|
|
74
|
-
res.end();
|
|
75
|
-
return [2 /*return*/, {
|
|
76
|
-
props: {},
|
|
77
|
-
}];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
1
|
+
import { getPrezlyApi } from '../../../data-fetching';
|
|
2
|
+
import { createPaths } from './createPaths';
|
|
3
|
+
import { SitemapBuilder } from './SitemapBuilder';
|
|
4
|
+
export function getSitemapServerSideProps(additionalPaths) {
|
|
5
|
+
return async function getServerSideProps(ctx) {
|
|
6
|
+
const { res, req } = ctx;
|
|
7
|
+
if (!req || !res) {
|
|
8
|
+
// client side
|
|
9
|
+
return {
|
|
10
|
+
props: {},
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const baseUrl = req.headers.host || '/';
|
|
14
|
+
const api = getPrezlyApi(req);
|
|
15
|
+
const stories = await api.getAllStories();
|
|
16
|
+
const categories = await api.getCategories();
|
|
17
|
+
const paths = createPaths(stories, categories);
|
|
18
|
+
const sitemapBuilder = new SitemapBuilder(baseUrl);
|
|
19
|
+
sitemapBuilder.addUrl('/');
|
|
20
|
+
paths.forEach((path) => sitemapBuilder.addUrl(path));
|
|
21
|
+
if (additionalPaths) {
|
|
22
|
+
additionalPaths.forEach((path) => sitemapBuilder.addUrl(path));
|
|
23
|
+
}
|
|
24
|
+
res.setHeader('Content-Type', 'text/xml');
|
|
25
|
+
res.write(sitemapBuilder.serialize());
|
|
26
|
+
res.end();
|
|
27
|
+
return {
|
|
28
|
+
props: {},
|
|
29
|
+
};
|
|
81
30
|
};
|
|
82
31
|
}
|
|
83
|
-
exports.getSitemapServerSideProps = getSitemapServerSideProps;
|
|
84
32
|
//# sourceMappingURL=getServerSideProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getServerSideProps.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,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AC1C,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;QACtC,GAAG,CAAC,GAAG,EAAE,CAAC;QAEV,OAAO;YACH,KAAK,EAAE,EAAE;SACZ,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.createPaths = exports.SitemapBuilder = exports.getSitemapServerSideProps = void 0;
|
|
18
|
-
var getServerSideProps_1 = require("./getServerSideProps");
|
|
19
|
-
Object.defineProperty(exports, "getSitemapServerSideProps", { enumerable: true, get: function () { return getServerSideProps_1.getSitemapServerSideProps; } });
|
|
20
|
-
var SitemapBuilder_1 = require("./SitemapBuilder");
|
|
21
|
-
Object.defineProperty(exports, "SitemapBuilder", { enumerable: true, get: function () { return SitemapBuilder_1.SitemapBuilder; } });
|
|
22
|
-
var createPaths_1 = require("./createPaths");
|
|
23
|
-
Object.defineProperty(exports, "createPaths", { enumerable: true, get: function () { return createPaths_1.createPaths; } });
|
|
24
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export { getSitemapServerSideProps } from './getServerSideProps';
|
|
2
|
+
export { SitemapBuilder } from './SitemapBuilder';
|
|
3
|
+
export { createPaths } from './createPaths';
|
|
4
|
+
export * from './types';
|
|
25
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,SAAS,CAAC"}
|