@prezly/theme-kit-nextjs 1.15.1 → 1.16.0-2
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.d.ts +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.d.ts +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.d.ts +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.d.ts +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.d.ts +2 -2
- 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.d.ts +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.d.ts +6 -0
- package/build/components-nextjs/document.js +48 -0
- package/build/components-nextjs/document.js.map +1 -0
- package/build/components-nextjs/index.d.ts +1 -0
- package/build/components-nextjs/index.js +3 -1
- package/build/components-nextjs/index.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/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/index.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.d.ts +2 -0
- package/build/sentry/client.js +9 -0
- package/build/sentry/client.js.map +1 -0
- package/build/sentry/common.d.ts +2 -0
- package/build/sentry/common.js +29 -0
- package/build/sentry/common.js.map +1 -0
- package/build/sentry/index.d.ts +2 -0
- package/build/sentry/index.js +8 -0
- package/build/sentry/index.js.map +1 -0
- package/build/sentry/server.d.ts +2 -0
- package/build/sentry/server.js +9 -0
- package/build/sentry/server.js.map +1 -0
- 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 -1
- package/src/adapter-nextjs/page-props/category.ts +1 -1
- package/src/adapter-nextjs/page-props/gallery.ts +1 -1
- package/src/adapter-nextjs/page-props/galleryAlbum.ts +1 -1
- package/src/adapter-nextjs/page-props/home.ts +1 -1
- package/src/adapter-nextjs/page-props/search.ts +1 -1
- package/src/adapter-nextjs/page-props/story.ts +1 -1
- package/src/components-nextjs/document.tsx +38 -0
- package/src/components-nextjs/index.ts +1 -0
- package/src/index.ts +1 -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
|
@@ -1,88 +1,27 @@
|
|
|
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.getStoryPreviewPageServerSideProps = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
4
|
+
const data_fetching_1 = require("../../data-fetching");
|
|
5
|
+
const getNewsroomServerSideProps_1 = require("../getNewsroomServerSideProps");
|
|
6
|
+
const processRequest_1 = require("../processRequest");
|
|
54
7
|
function getStoryPreviewPageServerSideProps(customProps) {
|
|
55
|
-
return function getServerSideProps(context) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_a = processRequest_1.processRequest;
|
|
73
|
-
_b = [context];
|
|
74
|
-
_c = [__assign(__assign({}, serverSideProps), { newsroomContextProps: __assign(__assign({}, serverSideProps.newsroomContextProps), { currentStory: story }) })];
|
|
75
|
-
if (!(typeof customProps === 'function')) return [3 /*break*/, 4];
|
|
76
|
-
return [4 /*yield*/, customProps(context, serverSideProps)];
|
|
77
|
-
case 3:
|
|
78
|
-
_d = _e.sent();
|
|
79
|
-
return [3 /*break*/, 5];
|
|
80
|
-
case 4:
|
|
81
|
-
_d = customProps;
|
|
82
|
-
_e.label = 5;
|
|
83
|
-
case 5: return [2 /*return*/, _a.apply(void 0, _b.concat([__assign.apply(void 0, _c.concat([(_d)]))]))];
|
|
84
|
-
}
|
|
85
|
-
});
|
|
8
|
+
return async function getServerSideProps(context) {
|
|
9
|
+
const api = (0, data_fetching_1.getPrezlyApi)(context.req);
|
|
10
|
+
const { uuid } = context.params;
|
|
11
|
+
const story = await api.getStory(uuid);
|
|
12
|
+
if (!story) {
|
|
13
|
+
return { notFound: true };
|
|
14
|
+
}
|
|
15
|
+
const { serverSideProps } = await (0, getNewsroomServerSideProps_1.getNewsroomServerSideProps)(context, { story });
|
|
16
|
+
return (0, processRequest_1.processRequest)(context, {
|
|
17
|
+
...serverSideProps,
|
|
18
|
+
newsroomContextProps: {
|
|
19
|
+
...serverSideProps.newsroomContextProps,
|
|
20
|
+
currentStory: story,
|
|
21
|
+
},
|
|
22
|
+
...(typeof customProps === 'function'
|
|
23
|
+
? await customProps(context, serverSideProps)
|
|
24
|
+
: customProps),
|
|
86
25
|
});
|
|
87
26
|
};
|
|
88
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storyPreview.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/storyPreview.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storyPreview.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/storyPreview.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AACnD,8EAA2E;AAC3E,sDAAmD;AAInD,SAAgB,kCAAkC,CAC9C,WAAqD;IAErD,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,GAAG,GAAG,IAAA,4BAAY,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAA0B,CAAC;QACpD,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7B;QAED,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,IAAA,uDAA0B,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAEjF,OAAO,IAAA,+BAAc,EAAC,OAAO,EAAE;YAC3B,GAAG,eAAe;YAClB,oBAAoB,EAAE;gBAClB,GAAG,eAAe,CAAC,oBAAoB;gBACvC,YAAY,EAAE,KAAK;aACtB;YACD,GAAG,CAAC,OAAO,WAAW,KAAK,UAAU;gBACjC,CAAC,CAAC,MAAO,WAA0C,CAAC,OAAO,EAAE,eAAe,CAAC;gBAC7E,CAAC,CAAC,WAAW,CAAC;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AA1BD,gFA0BC"}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.processRequest = void 0;
|
|
15
|
-
|
|
4
|
+
const intl_1 = require("../intl");
|
|
16
5
|
/**
|
|
17
6
|
* This function combines the props returned from `getNewsroomServerSideProps` and your optional custom props for the page.
|
|
18
7
|
* It also handles locale redirects, if `canonicalUrl` parameter is provided.
|
|
@@ -23,20 +12,20 @@ var intl_1 = require("../intl");
|
|
|
23
12
|
* @param canonicalUrl Optional: a canonical URL for the current page without locale part. If provided, locale redirects will be handled by the function.
|
|
24
13
|
*/
|
|
25
14
|
function processRequest(context, props, canonicalUrl) {
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
const { locale: nextLocale, query } = context;
|
|
16
|
+
const { localeResolved, ...pageProps } = props;
|
|
28
17
|
// If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
|
|
29
18
|
// In that case we won't show 404 page.
|
|
30
19
|
if (!localeResolved && nextLocale) {
|
|
31
20
|
return { notFound: true };
|
|
32
21
|
}
|
|
33
22
|
if (canonicalUrl) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
const { languages, localeCode } = pageProps.newsroomContextProps;
|
|
24
|
+
const currentLocale = intl_1.LocaleObject.fromAnyCode(localeCode);
|
|
25
|
+
const shortestLocaleCode = (0, intl_1.getShortestLocaleCode)(languages, currentLocale);
|
|
26
|
+
const redirect = (0, intl_1.getRedirectToCanonicalLocale)(shortestLocaleCode, nextLocale, canonicalUrl, query);
|
|
38
27
|
if (redirect) {
|
|
39
|
-
return { redirect
|
|
28
|
+
return { redirect };
|
|
40
29
|
}
|
|
41
30
|
}
|
|
42
31
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processRequest.ts"],"names":[],"mappings":";;;AAEA,kCAA4F;AAG5F;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC1B,OAAkC,EAClC,KAA8C,EAC9C,YAAqB;IAErB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE9C,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE;QAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,IAAI,YAAY,EAAE;QACd,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,oBAAoB,CAAC;QACjE,MAAM,aAAa,GAAG,mBAAY,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3D,MAAM,kBAAkB,GAAG,IAAA,4BAAqB,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,IAAA,mCAA4B,EACzC,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,KAAK,CACR,CAAC;QACF,IAAI,QAAQ,EAAE;YACV,OAAO,EAAE,QAAQ,EAAE,CAAC;SACvB;KACJ;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;KACxC,CAAC;AACN,CAAC;AAlCD,wCAkCC"}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.processStaticRequest = void 0;
|
|
15
4
|
/**
|
|
@@ -21,8 +10,8 @@ exports.processStaticRequest = void 0;
|
|
|
21
10
|
* @param revalidateTimeout Optional: timeout in seconds to use with Next ISR.
|
|
22
11
|
*/
|
|
23
12
|
function processStaticRequest(context, props, revalidateTimeout) {
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
const { locale: nextLocale } = context;
|
|
14
|
+
const { localeResolved, ...pageProps } = props;
|
|
26
15
|
// If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
|
|
27
16
|
// In that case we won't show 404 page.
|
|
28
17
|
if (!localeResolved && nextLocale) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processStaticRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processStaticRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processStaticRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processStaticRequest.ts"],"names":[],"mappings":";;;AAIA;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAChC,OAA8B,EAC9B,KAA8C,EAC9C,iBAA0B;IAE1B,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE;QAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;QACrC,UAAU,EAAE,iBAAiB;KAChC,CAAC;AACN,CAAC;AAnBD,oDAmBC"}
|
|
@@ -1,65 +1,42 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
3
|
exports.PageSeo = void 0;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const next_seo_1 = require("next-seo");
|
|
6
|
+
const router_1 = require("next/router");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const intl_1 = require("../../intl");
|
|
9
|
+
const newsroom_context_1 = require("../../newsroom-context");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const getAbsoluteUrl_1 = require("./lib/getAbsoluteUrl");
|
|
34
12
|
/**
|
|
35
13
|
* This component provides base page attributes for every Newsroom page.
|
|
36
14
|
* It depends on information from NewsroomContext, so the component should be placed inside the `NewsroomContextProvider`.
|
|
37
15
|
* You can pass additional props expected by NextSeo component to override any info that is provided by the NewsroomContext.
|
|
38
16
|
*/
|
|
39
|
-
function PageSeo(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var alternateLanguageLinks = (0, react_1.useMemo)(function () {
|
|
17
|
+
function PageSeo({ title, description, imageUrl, canonical, openGraph, twitter, ...nextSeoProps }) {
|
|
18
|
+
const companyInformation = (0, newsroom_context_1.useCompanyInformation)();
|
|
19
|
+
const newsroom = (0, newsroom_context_1.useNewsroom)();
|
|
20
|
+
const currentLocale = (0, newsroom_context_1.useCurrentLocale)();
|
|
21
|
+
const languages = (0, newsroom_context_1.useLanguages)();
|
|
22
|
+
const getTranslationUrl = (0, newsroom_context_1.useGetTranslationUrl)();
|
|
23
|
+
const getLinkLocaleSlug = (0, newsroom_context_1.useGetLinkLocaleSlug)();
|
|
24
|
+
const currentStory = (0, newsroom_context_1.useCurrentStory)();
|
|
25
|
+
const { asPath } = (0, router_1.useRouter)();
|
|
26
|
+
const pageTitle = title || companyInformation.name;
|
|
27
|
+
const pageDescription = description || companyInformation.about_plaintext;
|
|
28
|
+
const canonicalUrl = canonical || (0, getAbsoluteUrl_1.getAbsoluteUrl)(asPath, newsroom.url, getLinkLocaleSlug(currentLocale));
|
|
29
|
+
const siteName = companyInformation.name;
|
|
30
|
+
const logoUrl = imageUrl || (0, utils_1.getNewsroomLogoUrl)(newsroom);
|
|
31
|
+
const alternateLanguageLinks = (0, react_1.useMemo)(() => {
|
|
55
32
|
if (!languages.length) {
|
|
56
33
|
return [];
|
|
57
34
|
}
|
|
58
|
-
|
|
35
|
+
const alternateLanguages = (0, intl_1.getUsedLanguages)(languages).filter((language) => language.code !== currentLocale.toUnderscoreCode());
|
|
59
36
|
return alternateLanguages
|
|
60
|
-
.map(
|
|
61
|
-
|
|
62
|
-
|
|
37
|
+
.map((language) => {
|
|
38
|
+
const locale = intl_1.LocaleObject.fromAnyCode(language.code);
|
|
39
|
+
const translationLink = getTranslationUrl(locale, true);
|
|
63
40
|
if (!translationLink) {
|
|
64
41
|
return undefined;
|
|
65
42
|
}
|
|
@@ -77,12 +54,24 @@ function PageSeo(_a) {
|
|
|
77
54
|
newsroom.url,
|
|
78
55
|
currentStory,
|
|
79
56
|
]);
|
|
80
|
-
return ((0, jsx_runtime_1.jsx)(next_seo_1.NextSeo,
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(next_seo_1.NextSeo, { title: pageTitle, description: pageDescription, canonical: canonicalUrl, noindex: newsroom.is_indexable, nofollow: newsroom.is_indexable, openGraph: {
|
|
58
|
+
url: canonicalUrl,
|
|
59
|
+
title: pageTitle,
|
|
60
|
+
description: pageDescription,
|
|
61
|
+
locale: currentLocale.toUnderscoreCode(),
|
|
62
|
+
images: [
|
|
81
63
|
{
|
|
82
64
|
url: logoUrl,
|
|
83
65
|
alt: pageTitle,
|
|
84
66
|
},
|
|
85
|
-
],
|
|
67
|
+
],
|
|
68
|
+
site_name: siteName,
|
|
69
|
+
...openGraph,
|
|
70
|
+
}, twitter: {
|
|
71
|
+
site: siteName,
|
|
72
|
+
cardType: 'summary',
|
|
73
|
+
...twitter,
|
|
74
|
+
}, additionalMetaTags: [{ name: 'twitter:image', content: logoUrl }], languageAlternates: alternateLanguageLinks, ...nextSeoProps }));
|
|
86
75
|
}
|
|
87
76
|
exports.PageSeo = PageSeo;
|
|
88
77
|
//# sourceMappingURL=PageSeo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageSeo.js","sourceRoot":"","sources":["../../../src/components-nextjs/PageSeo/PageSeo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageSeo.js","sourceRoot":"","sources":["../../../src/components-nextjs/PageSeo/PageSeo.tsx"],"names":[],"mappings":"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"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getAbsoluteUrl = void 0;
|
|
4
4
|
// Returns absolute URL based on the path and without any query parameters
|
|
5
5
|
function getAbsoluteUrl(path, origin, localeCode) {
|
|
6
|
-
|
|
6
|
+
const url = new URL(`${localeCode ? `/${localeCode}` : ''}${path || '/'}`, origin);
|
|
7
7
|
url.search = '';
|
|
8
8
|
return url.toString();
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAbsoluteUrl.js","sourceRoot":"","sources":["../../../../src/components-nextjs/PageSeo/lib/getAbsoluteUrl.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,SAAgB,cAAc,CAAC,IAAY,EAAE,MAAc,EAAE,UAA2B;IACpF,
|
|
1
|
+
{"version":3,"file":"getAbsoluteUrl.js","sourceRoot":"","sources":["../../../../src/components-nextjs/PageSeo/lib/getAbsoluteUrl.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,SAAgB,cAAc,CAAC,IAAY,EAAE,MAAc,EAAE,UAA2B;IACpF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;IACnF,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;IAEhB,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC;AALD,wCAKC"}
|
|
@@ -1,44 +1,40 @@
|
|
|
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.StorySeo = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const sdk_1 = require("@prezly/sdk");
|
|
6
|
+
const next_seo_1 = require("next-seo");
|
|
18
7
|
/**
|
|
19
8
|
* This components provides additional page attributes for the Story page.
|
|
20
9
|
* It works in conjunction with `PageSeo` component, overidding some of its attributes.
|
|
21
10
|
*/
|
|
22
|
-
function StorySeo(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
function StorySeo({ story }) {
|
|
12
|
+
const { title, subtitle, published_at, updated_at, author, oembed, newsroom, summary } = story;
|
|
13
|
+
const authorName = author?.display_name || author?.email || 'Unknown';
|
|
14
|
+
const description = subtitle || summary;
|
|
15
|
+
const indexable = newsroom.is_indexable && story.visibility === sdk_1.StoryVisibility.PUBLIC;
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(next_seo_1.NextSeo, { title: title, description: description, canonical: oembed.url, noindex: !indexable, nofollow: !indexable, openGraph: {
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
url: oembed.url,
|
|
20
|
+
site_name: newsroom.display_name,
|
|
21
|
+
type: 'article',
|
|
22
|
+
article: {
|
|
29
23
|
publishedTime: published_at || undefined,
|
|
30
24
|
modifiedTime: updated_at,
|
|
31
25
|
authors: [authorName],
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
},
|
|
27
|
+
...(oembed.thumbnail_url && {
|
|
28
|
+
images: [
|
|
29
|
+
{
|
|
30
|
+
url: oembed.thumbnail_url,
|
|
31
|
+
alt: oembed.title,
|
|
32
|
+
width: oembed.thumbnail_width,
|
|
33
|
+
height: oembed.thumbnail_height,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
}, additionalMetaTags: oembed.thumbnail_url
|
|
42
38
|
? [
|
|
43
39
|
{ name: 'twitter:card', content: 'summary_large_image' },
|
|
44
40
|
{ name: 'twitter:image', content: oembed.thumbnail_url },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorySeo.js","sourceRoot":"","sources":["../../../src/components-nextjs/StorySeo/StorySeo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StorySeo.js","sourceRoot":"","sources":["../../../src/components-nextjs/StorySeo/StorySeo.tsx"],"names":[],"mappings":";;;;AACA,qCAA8C;AAC9C,uCAAkD;AAMlD;;;GAGG;AACH,SAAgB,QAAQ,CAAC,EAAE,KAAK,EAAS;IACrC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE/F,MAAM,UAAU,GAAG,MAAM,EAAE,YAAY,IAAI,MAAM,EAAE,KAAK,IAAI,SAAS,CAAC;IACtE,MAAM,WAAW,GAAG,QAAQ,IAAI,OAAO,CAAC;IACxC,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,IAAI,KAAK,CAAC,UAAU,KAAK,qBAAe,CAAC,MAAM,CAAC;IAEvF,OAAO,CACH,6DACI,uBAAC,kBAAO,IACJ,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,MAAM,CAAC,GAAG,EACrB,OAAO,EAAE,CAAC,SAAS,EACnB,QAAQ,EAAE,CAAC,SAAS,EACpB,SAAS,EAAE;oBACP,KAAK;oBACL,WAAW;oBACX,GAAG,EAAE,MAAM,CAAC,GAAG;oBACf,SAAS,EAAE,QAAQ,CAAC,YAAY;oBAChC,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACL,aAAa,EAAE,YAAY,IAAI,SAAS;wBACxC,YAAY,EAAE,UAAU;wBACxB,OAAO,EAAE,CAAC,UAAU,CAAC;qBACxB;oBACD,GAAG,CAAC,MAAM,CAAC,aAAa,IAAI;wBACxB,MAAM,EAAE;4BACJ;gCACI,GAAG,EAAE,MAAM,CAAC,aAAa;gCACzB,GAAG,EAAE,MAAM,CAAC,KAAK;gCACjB,KAAK,EAAE,MAAM,CAAC,eAAe;gCAC7B,MAAM,EAAE,MAAM,CAAC,gBAAgB;6BAClC;yBACJ;qBACJ,CAAC;iBACL,EACD,kBAAkB,EACd,MAAM,CAAC,aAAa;oBAChB,CAAC,CAAC;wBACI,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE;wBACxD,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE;qBAC3D;oBACH,CAAC,CAAC,SAAS,GAErB,EACF,uBAAC,wBAAa,IACV,GAAG,EAAE,MAAM,CAAC,GAAG,EACf,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,EAC1D,aAAa,EAAE,YAAY,IAAI,EAAE,EACjC,YAAY,EAAE,UAAU,EACxB,UAAU,EAAE,CAAC,UAAU,CAAC,EACxB,aAAa,EAAE,QAAQ,CAAC,YAAY,EACpC,aAAa,EAAE,QAAQ,CAAC,aAAa,EACrC,WAAW,EAAE,WAAW,GAC1B,IACH,CACN,CAAC;AACN,CAAC;AA3DD,4BA2DC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.PrezlyThemeDocument = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const document_1 = __importStar(require("next/document"));
|
|
29
|
+
const intl_1 = require("../intl");
|
|
30
|
+
class PrezlyThemeDocument extends document_1.default {
|
|
31
|
+
getLocaleCode() {
|
|
32
|
+
const { newsroomContextProps,
|
|
33
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
34
|
+
} = this.props.__NEXT_DATA__.props.pageProps;
|
|
35
|
+
// In some cases (like server errors) the newsroom context props will not be loaded.
|
|
36
|
+
// We need to fall back to default locale to keep the app working.
|
|
37
|
+
const { localeCode } = newsroomContextProps ?? { localeCode: intl_1.DEFAULT_LOCALE };
|
|
38
|
+
return localeCode;
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
const locale = intl_1.LocaleObject.fromAnyCode(this.getLocaleCode());
|
|
42
|
+
// TODO: The direction can be pulled from the Language object
|
|
43
|
+
const direction = (0, intl_1.getLocaleDirection)(locale);
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)(document_1.Html, { lang: locale.toHyphenCode(), dir: direction, children: [(0, jsx_runtime_1.jsx)(document_1.Head, { children: (0, jsx_runtime_1.jsx)("meta", { name: "og:locale", content: locale.toHyphenCode() }) }), (0, jsx_runtime_1.jsxs)("body", { children: [(0, jsx_runtime_1.jsx)(document_1.Main, {}), (0, jsx_runtime_1.jsx)(document_1.NextScript, {})] })] }));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.PrezlyThemeDocument = PrezlyThemeDocument;
|
|
48
|
+
//# sourceMappingURL=document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/components-nextjs/document.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAuE;AAEvE,kCAA2E;AAG3E,MAAa,mBAAoB,SAAQ,kBAAQ;IAC7C,aAAa;QACT,MAAM,EACF,oBAAoB;QACpB,gDAAgD;UACnD,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,SAAsB,CAAC;QAE1D,oFAAoF;QACpF,kEAAkE;QAClE,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,IAAI,EAAE,UAAU,EAAE,qBAAc,EAAE,CAAC;QAE9E,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,MAAM;QACF,MAAM,MAAM,GAAG,mBAAY,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9D,6DAA6D;QAC7D,MAAM,SAAS,GAAG,IAAA,yBAAkB,EAAC,MAAM,CAAC,CAAC;QAE7C,OAAO,CACH,wBAAC,eAAI,IAAC,IAAI,EAAE,MAAM,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,SAAS,aAC7C,uBAAC,eAAI,cACD,iCAAM,IAAI,EAAC,WAAW,EAAC,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,GAAI,GAEtD,EACP,6CACI,uBAAC,eAAI,KAAG,EACR,uBAAC,qBAAU,KAAG,IACX,IACJ,CACV,CAAC;IACN,CAAC;CACJ;AAhCD,kDAgCC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StorySeo = exports.PageSeo = void 0;
|
|
3
|
+
exports.PrezlyThemeDocument = exports.StorySeo = exports.PageSeo = void 0;
|
|
4
4
|
var PageSeo_1 = require("./PageSeo");
|
|
5
5
|
Object.defineProperty(exports, "PageSeo", { enumerable: true, get: function () { return PageSeo_1.PageSeo; } });
|
|
6
6
|
var StorySeo_1 = require("./StorySeo");
|
|
7
7
|
Object.defineProperty(exports, "StorySeo", { enumerable: true, get: function () { return StorySeo_1.StorySeo; } });
|
|
8
|
+
var document_1 = require("./document");
|
|
9
|
+
Object.defineProperty(exports, "PrezlyThemeDocument", { enumerable: true, get: function () { return document_1.PrezlyThemeDocument; } });
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components-nextjs/index.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components-nextjs/index.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,uCAAiD;AAAxC,+GAAA,mBAAmB,OAAA"}
|