@prezly/theme-kit-nextjs 5.0.0-alpha.3 → 5.0.0-alpha.5
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 +2 -0
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
- package/build/adapter-nextjs/api-handlers/fetchStories.js +2 -0
- package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomServerSideProps.js +2 -0
- package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -1
- package/build/adapter-nextjs/getNewsroomStaticProps.js +2 -0
- package/build/adapter-nextjs/getNewsroomStaticProps.js.map +1 -1
- package/build/adapter-nextjs/processRequest.js +1 -0
- package/build/adapter-nextjs/processRequest.js.map +1 -1
- package/build/adapter-nextjs/processStaticRequest.js +2 -0
- package/build/adapter-nextjs/processStaticRequest.js.map +1 -1
- package/build/components-nextjs/StorySeo/StorySeo.js +2 -3
- package/build/components-nextjs/StorySeo/StorySeo.js.map +1 -1
- package/build/data-fetching/NextPrezlyApi.js +0 -1
- package/build/data-fetching/NextPrezlyApi.js.map +1 -1
- package/build/data-fetching/getNextPrezlyApi.js +1 -3
- package/build/data-fetching/getNextPrezlyApi.js.map +1 -1
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +8 -19
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchGalleries = void 0;
|
|
4
|
+
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
4
5
|
const data_fetching_1 = require("../../data-fetching");
|
|
5
6
|
async function fetchGalleries(req, res) {
|
|
7
|
+
(0, theme_kit_core_1.assertServerEnv)('fetchGalleries');
|
|
6
8
|
if (req.method !== 'POST') {
|
|
7
9
|
res.status(405);
|
|
8
10
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchGalleries.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/api-handlers/fetchGalleries.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"fetchGalleries.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/api-handlers/fetchGalleries.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAGzD,uDAAuD;AAEhD,KAAK,UAAU,cAAc,CAAC,GAAmB,EAAE,GAAoB;IAC1E,IAAA,gCAAe,EAAC,gBAAgB,CAAC,CAAC;IAElC,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;QACvB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO;KACV;IAED,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;IAEpC,IAAI;QACA,MAAM,GAAG,GAAG,IAAA,gCAAgB,EAAC,GAAG,CAAC,CAAC;QAElC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEjE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;KACvC;IAAC,OAAO,KAAK,EAAE;QACZ,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACjB,OAAO,EAAG,KAAe,CAAC,OAAO;SACpC,CAAC,CAAC;KACN;AACL,CAAC;AArBD,wCAqBC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchStories = void 0;
|
|
4
|
+
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
4
5
|
const data_fetching_1 = require("../../data-fetching");
|
|
5
6
|
async function fetchStories(req, res) {
|
|
7
|
+
(0, theme_kit_core_1.assertServerEnv)('fetchStories');
|
|
6
8
|
if (req.method !== 'POST') {
|
|
7
9
|
res.status(405);
|
|
8
10
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchStories.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/api-handlers/fetchStories.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"fetchStories.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/api-handlers/fetchStories.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAGzD,uDAAuD;AAEhD,KAAK,UAAU,YAAY,CAAC,GAAmB,EAAE,GAAoB;IACxE,IAAA,gCAAe,EAAC,cAAc,CAAC,CAAC;IAEhC,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;QACvB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO;KACV;IAED,MAAM,EACF,IAAI,EACJ,QAAQ,EACR,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,UAAU,EACV,OAAO,EACP,WAAW,GACd,GAAG,GAAG,CAAC,IAAI,CAAC;IAEb,IAAI;QACA,MAAM,GAAG,GAAG,IAAA,gCAAgB,EAAC,GAAG,CAAC,CAAC;QAElC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,QAAQ;YAC/B,CAAC,CAAC,GAAG,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;YAC/E,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;gBACX,IAAI;gBACJ,QAAQ;gBACR,OAAO;gBACP,UAAU;gBACV,oBAAoB;gBACpB,OAAO;gBACP,WAAW;aACd,CAAC,CAAC,CAAC;QAEV,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;KACrC;IAAC,OAAO,KAAK,EAAE;QACZ,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACjB,OAAO,EAAG,KAAe,CAAC,OAAO;SACpC,CAAC,CAAC;KACN;AACL,CAAC;AAxCD,oCAwCC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNewsroomServerSideProps = void 0;
|
|
4
|
+
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
4
5
|
const data_fetching_1 = require("../data-fetching");
|
|
5
6
|
/**
|
|
6
7
|
* Use this function in your `getServerSideProps` page methods to retrieve the data necessary for the NewsroomContextProvider and `processRequest` function.
|
|
7
8
|
* See README for usage examples.
|
|
8
9
|
*/
|
|
9
10
|
async function getNewsroomServerSideProps(context, options = {}) {
|
|
11
|
+
(0, theme_kit_core_1.assertServerEnv)('getNewsroomServerSideProps');
|
|
10
12
|
const { req: request, locale } = context;
|
|
11
13
|
const api = (0, data_fetching_1.getNextPrezlyApi)(request);
|
|
12
14
|
const serverSideProps = await api.getNewsroomServerSideProps(request, locale, options.story);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNewsroomServerSideProps.js","sourceRoot":"","sources":["../../src/adapter-nextjs/getNewsroomServerSideProps.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getNewsroomServerSideProps.js","sourceRoot":"","sources":["../../src/adapter-nextjs/getNewsroomServerSideProps.ts"],"names":[],"mappings":";;;AACA,2DAAyD;AAGzD,oDAAoD;AAOpD;;;GAGG;AACI,KAAK,UAAU,0BAA0B,CAC5C,OAAkC,EAClC,UAAmB,EAAE;IAErB,IAAA,gCAAe,EAAC,4BAA4B,CAAC,CAAC;IAC9C,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEzC,MAAM,GAAG,GAAG,IAAA,gCAAgB,EAAC,OAAO,CAAC,CAAC;IACtC,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAE7F,IAAI,OAAO,CAAC,oBAAoB,EAAE;QAC9B,eAAe,CAAC,oBAAoB,CAAC,QAAQ,GAAG,MAAM,GAAG,CAAC,mBAAmB,EAAE,CAAC;KACnF;IAED,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC;AACpC,CAAC;AAfD,gEAeC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNewsroomStaticProps = void 0;
|
|
4
|
+
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
4
5
|
const data_fetching_1 = require("../data-fetching");
|
|
5
6
|
/**
|
|
6
7
|
* Use this function in your `getNewsroomStaticProps` page methods to retrieve the data necessary for the NewsroomContextProvider and `processRequest` function.
|
|
7
8
|
* See README for usage examples.
|
|
8
9
|
*/
|
|
9
10
|
async function getNewsroomStaticProps(context, options = {}) {
|
|
11
|
+
(0, theme_kit_core_1.assertServerEnv)('getNewsroomStaticProps');
|
|
10
12
|
const { locale } = context;
|
|
11
13
|
const api = (0, data_fetching_1.getNextPrezlyApi)();
|
|
12
14
|
const staticProps = await api.getNewsroomServerSideProps(undefined, locale, options.story);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNewsroomStaticProps.js","sourceRoot":"","sources":["../../src/adapter-nextjs/getNewsroomStaticProps.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getNewsroomStaticProps.js","sourceRoot":"","sources":["../../src/adapter-nextjs/getNewsroomStaticProps.ts"],"names":[],"mappings":";;;AACA,2DAAyD;AAGzD,oDAAoD;AAOpD;;;GAGG;AACI,KAAK,UAAU,sBAAsB,CACxC,OAA8B,EAC9B,UAAmB,EAAE;IAErB,IAAA,gCAAe,EAAC,wBAAwB,CAAC,CAAC;IAC1C,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE3B,MAAM,GAAG,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAE3F,IAAI,OAAO,CAAC,oBAAoB,EAAE;QAC9B,WAAW,CAAC,oBAAoB,CAAC,QAAQ,GAAG,MAAM,GAAG,CAAC,mBAAmB,EAAE,CAAC;KAC/E;IAED,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;AAChC,CAAC;AAfD,wDAeC"}
|
|
@@ -13,6 +13,7 @@ const intl_1 = require("../intl");
|
|
|
13
13
|
* @param canonicalUrl Optional: a canonical URL for the current page without locale part. If provided, locale redirects will be handled by the function.
|
|
14
14
|
*/
|
|
15
15
|
function processRequest(context, props, canonicalUrl) {
|
|
16
|
+
(0, theme_kit_core_1.assertServerEnv)('processRequest');
|
|
16
17
|
const { locale: nextLocale, query } = context;
|
|
17
18
|
const { localeResolved, ...pageProps } = props;
|
|
18
19
|
// If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processRequest.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processRequest.ts"],"names":[],"mappings":";;;AAAA,2DAA8F;AAG9F,kCAAuD;AAGvD;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC1B,OAAkC,EAClC,KAA8C,EAC9C,YAAqB;IAErB,IAAA,gCAAe,EAAC,gBAAgB,CAAC,CAAC;IAClC,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,6BAAY,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3D,MAAM,kBAAkB,GAAG,IAAA,sCAAqB,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;AAnCD,wCAmCC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processStaticRequest = void 0;
|
|
4
|
+
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
4
5
|
/**
|
|
5
6
|
* This function combines the props returned from `getNewsroomStaticProps` and your optional custom props for the page.
|
|
6
7
|
* See README for usage examples.
|
|
@@ -10,6 +11,7 @@ exports.processStaticRequest = void 0;
|
|
|
10
11
|
* @param revalidateTimeout Optional: timeout in seconds to use with Next ISR.
|
|
11
12
|
*/
|
|
12
13
|
function processStaticRequest(context, props, revalidateTimeout) {
|
|
14
|
+
(0, theme_kit_core_1.assertServerEnv)('processStaticRequest');
|
|
13
15
|
const { locale: nextLocale } = context;
|
|
14
16
|
const { localeResolved, ...pageProps } = props;
|
|
15
17
|
// If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
|
|
@@ -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":";;;AAAA,2DAAyD;AAKzD;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAChC,OAA8B,EAC9B,KAA8C,EAC9C,iBAA0B;IAE1B,IAAA,gCAAe,EAAC,sBAAsB,CAAC,CAAC;IACxC,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;AApBD,oDAoBC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StorySeo = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
6
6
|
const next_seo_1 = require("next-seo");
|
|
7
7
|
/**
|
|
8
8
|
* This components provides additional page attributes for the Story page.
|
|
@@ -17,8 +17,7 @@ function StorySeo({ story, noindex }) {
|
|
|
17
17
|
subtitle ||
|
|
18
18
|
summary;
|
|
19
19
|
const canonical = story.seo_settings.canonical_url || oembed.url;
|
|
20
|
-
|
|
21
|
-
const indexable = newsroom.is_indexable && story.visibility === sdk_1.Story.Visibility.PUBLIC;
|
|
20
|
+
const indexable = newsroom.is_indexable && story.visibility === theme_kit_core_1.Visibility.PUBLIC;
|
|
22
21
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(next_seo_1.NextSeo, { title: seoTitle, description: seoDescription, canonical: canonical, noindex: noindex ?? !indexable, nofollow: noindex ?? !indexable, openGraph: {
|
|
23
22
|
title,
|
|
24
23
|
description: seoDescription,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorySeo.js","sourceRoot":"","sources":["../../../src/components-nextjs/StorySeo/StorySeo.tsx"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"StorySeo.js","sourceRoot":"","sources":["../../../src/components-nextjs/StorySeo/StorySeo.tsx"],"names":[],"mappings":";;;;AACA,2DAAoD;AACpD,uCAAkD;AAmBlD;;;GAGG;AACH,SAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,EAAS;IAC9C,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,QAAQ,GACV,KAAK,CAAC,YAAY,CAAC,UAAU,IAAI,KAAK,CAAC,YAAY,CAAC,kBAAkB,IAAI,KAAK,CAAC;IACpF,MAAM,cAAc,GAChB,KAAK,CAAC,YAAY,CAAC,gBAAgB;QACnC,KAAK,CAAC,YAAY,CAAC,wBAAwB;QAC3C,QAAQ;QACR,OAAO,CAAC;IACZ,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,aAAa,IAAI,MAAM,CAAC,GAAG,CAAC;IACjE,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,IAAI,KAA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,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,cAAc,GAC7B,IACH,CACN,CAAC;AACN,CAAC;AAzED,4BAyEC"}
|
|
@@ -17,7 +17,6 @@ class NextPrezlyApi extends theme_kit_core_1.PrezlyApi {
|
|
|
17
17
|
const defaultLanguage = (0, theme_kit_core_1.getDefaultLanguage)(languages);
|
|
18
18
|
const { code: localeCode } = currentLanguage || defaultLanguage;
|
|
19
19
|
const locale = theme_kit_core_1.LocaleObject.fromAnyCode(localeCode);
|
|
20
|
-
// TODO: if no information given for current language, show boilerplate from default language
|
|
21
20
|
const companyInformation = (0, theme_kit_core_1.getCompanyInformation)(languages, locale);
|
|
22
21
|
const notifications = (0, theme_kit_core_1.getNotifications)(languages, locale);
|
|
23
22
|
const algoliaSettings = (0, theme_kit_core_1.getAlgoliaSettings)(request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextPrezlyApi.js","sourceRoot":"","sources":["../../src/data-fetching/NextPrezlyApi.ts"],"names":[],"mappings":";;;AACA,2DAQgC;AAGhC,kCAA2D;AAG3D,MAAa,aAAc,SAAQ,0BAAS;IACxC,KAAK,CAAC,0BAA0B,CAC5B,OAAyB,EACzB,iBAA0B,EAC1B,KAA8B;QAE9B,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACrE,IAAI,CAAC,WAAW,EAAE;YAClB,IAAI,CAAC,oBAAoB,EAAE;YAC3B,IAAI,CAAC,aAAa,EAAE;YACpB,IA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AW,CAAC,UAAU,CAAC,CAAC;QAEpD,MAAM,kBAAkB,GAAG,IAAA,sCAAqB,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAEpE,MAAM,aAAa,GAAG,IAAA,iCAAgB,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC1D,MAAM,eAAe,GAAG,IAAA,mCAAkB,EAAC,OAAO,CAAC,CAAC;QAEpD,OAAO;YACH,oBAAoB,EAAE;gBAClB,QAAQ;gBACR,kBAAkB;gBAClB,UAAU;gBACV,SAAS;gBACT,UAAU;gBACV,aAAa;gBACb,WAAW;gBACX,eAAe;aAClB;YACD,cAAc,EAAE,OAAO,CAAC,eAAe,CAAC;SAC3C,CAAC;IACN,CAAC;CACJ;AAxCD,sCAwCC"}
|
|
@@ -4,9 +4,7 @@ exports.getNextPrezlyApi = void 0;
|
|
|
4
4
|
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
5
5
|
const NextPrezlyApi_1 = require("./NextPrezlyApi");
|
|
6
6
|
function getNextPrezlyApi(req) {
|
|
7
|
-
|
|
8
|
-
throw new Error('"getNextPrezlyApi" should only be used on back-end side.');
|
|
9
|
-
}
|
|
7
|
+
(0, theme_kit_core_1.assertServerEnv)('getNextPrezlyApi');
|
|
10
8
|
// `getEnvVariables` handles both cases for envs parsing - .env and request headers
|
|
11
9
|
const { PREZLY_ACCESS_TOKEN, PREZLY_NEWSROOM_UUID, PREZLY_THEME_UUID } = (0, theme_kit_core_1.getEnvVariables)(req);
|
|
12
10
|
if (!PREZLY_ACCESS_TOKEN) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNextPrezlyApi.js","sourceRoot":"","sources":["../../src/data-fetching/getNextPrezlyApi.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"getNextPrezlyApi.js","sourceRoot":"","sources":["../../src/data-fetching/getNextPrezlyApi.ts"],"names":[],"mappings":";;;AAAA,2DAA0E;AAG1E,mDAAgD;AAEhD,SAAgB,gBAAgB,CAAC,GAAqB;IAClD,IAAA,gCAAe,EAAC,kBAAkB,CAAC,CAAC;IAEpC,mFAAmF;IACnF,MAAM,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,GAAG,IAAA,gCAAe,EAAC,GAAG,CAAC,CAAC;IAE9F,IAAI,CAAC,mBAAmB,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KACzE;IAED,IAAI,CAAC,oBAAoB,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;KAC1E;IAED,OAAO,IAAI,6BAAa,CAAC,mBAAmB,EAAE,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;AAC3F,CAAC;AAfD,4CAeC"}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useGetTranslationUrl = void 0;
|
|
4
|
-
const sdk_1 = require("@prezly/sdk");
|
|
5
4
|
const theme_kit_core_1 = require("@prezly/theme-kit-core");
|
|
6
5
|
const router_1 = require("next/router");
|
|
7
6
|
const react_1 = require("react");
|
|
8
7
|
const useCurrentCategory_1 = require("./useCurrentCategory");
|
|
9
8
|
const useCurrentStory_1 = require("./useCurrentStory");
|
|
10
|
-
// Pulled from SDK types to not leak the `@prezly/sdk` dependency into the client bundle
|
|
11
|
-
// It looks like a hack, but the name of enum must be the same as in SDK
|
|
12
|
-
var Visibility;
|
|
13
|
-
(function (Visibility) {
|
|
14
|
-
Visibility["PUBLIC"] = "public";
|
|
15
|
-
Visibility["EMBARGO"] = "embargo";
|
|
16
|
-
Visibility["PRIVATE"] = "private";
|
|
17
|
-
Visibility["CONFIDENTIAL"] = "confidential";
|
|
18
|
-
})(Visibility || (Visibility = {}));
|
|
19
9
|
function getAllowedTranslationVisibilityValues(story) {
|
|
20
10
|
const { visibility } = story;
|
|
21
11
|
switch (visibility) {
|
|
22
|
-
case Visibility.EMBARGO:
|
|
23
|
-
return [Visibility.EMBARGO, Visibility.PUBLIC];
|
|
24
|
-
case Visibility.PRIVATE:
|
|
25
|
-
return [Visibility.PRIVATE, Visibility.PUBLIC];
|
|
26
|
-
case Visibility.CONFIDENTIAL:
|
|
27
|
-
return [Visibility.CONFIDENTIAL, Visibility.PRIVATE, Visibility.PUBLIC];
|
|
12
|
+
case theme_kit_core_1.Visibility.EMBARGO:
|
|
13
|
+
return [theme_kit_core_1.Visibility.EMBARGO, theme_kit_core_1.Visibility.PUBLIC];
|
|
14
|
+
case theme_kit_core_1.Visibility.PRIVATE:
|
|
15
|
+
return [theme_kit_core_1.Visibility.PRIVATE, theme_kit_core_1.Visibility.PUBLIC];
|
|
16
|
+
case theme_kit_core_1.Visibility.CONFIDENTIAL:
|
|
17
|
+
return [theme_kit_core_1.Visibility.CONFIDENTIAL, theme_kit_core_1.Visibility.PRIVATE, theme_kit_core_1.Visibility.PUBLIC];
|
|
28
18
|
default:
|
|
29
|
-
return [Visibility.PUBLIC];
|
|
19
|
+
return [theme_kit_core_1.Visibility.PUBLIC];
|
|
30
20
|
}
|
|
31
21
|
}
|
|
32
22
|
/**
|
|
@@ -49,8 +39,7 @@ function getTranslationUrl(locale, path, currentCategory, currentStory, noFallba
|
|
|
49
39
|
if (currentStory && currentStory.culture.locale !== localeCode) {
|
|
50
40
|
const allowedVisibilityValues = getAllowedTranslationVisibilityValues(currentStory);
|
|
51
41
|
const translatedStory = currentStory.translations.find(({ culture, status, visibility }) => culture.locale === localeCode &&
|
|
52
|
-
|
|
53
|
-
sdk_1.Story.isPublished(status) &&
|
|
42
|
+
(0, theme_kit_core_1.isStoryPublished)(status) &&
|
|
54
43
|
allowedVisibilityValues.includes(visibility));
|
|
55
44
|
if (translatedStory) {
|
|
56
45
|
return `/${translatedStory.slug}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTranslationUrl.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetTranslationUrl.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"useGetTranslationUrl.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetTranslationUrl.ts"],"names":[],"mappings":";;;AAEA,2DAKgC;AAChC,wCAAwC;AACxC,iCAAoC;AAEpC,6DAA0D;AAC1D,uDAAoD;AAEpD,SAAS,qCAAqC,CAC1C,KAAwC;IAExC,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAE7B,QAAQ,UAAU,EAAE;QAChB,KAAK,2BAAU,CAAC,OAAO;YACnB,OAAO,CAAC,2BAAU,CAAC,OAAO,EAAE,2BAAU,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,2BAAU,CAAC,OAAO;YACnB,OAAO,CAAC,2BAAU,CAAC,OAAO,EAAE,2BAAU,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,2BAAU,CAAC,YAAY;YACxB,OAAO,CAAC,2BAAU,CAAC,YAAY,EAAE,2BAAU,CAAC,OAAO,EAAE,2BAAU,CAAC,MAAM,CAAC,CAAC;QAC5E;YACI,OAAO,CAAC,2BAAU,CAAC,MAAM,CAAC,CAAC;KAClC;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CACtB,MAAoB,EACpB,IAAY,EACZ,eAAyD,EACzD,YAA4B,EAC5B,UAAoB;IAEpB,IAAI,eAAe,EAAE;QACjB,IAAI,IAAA,0CAAyB,EAAC,eAAe,EAAE,MAAM,CAAC,EAAE;YACpD,OAAO,IAAA,+BAAc,EAAC,eAAe,EAAE,MAAM,CAAC,CAAC;SAClD;QAED,IAAI,UAAU,EAAE;YACZ,OAAO,EAAE,CAAC;SACb;QAED,OAAO,GAAG,CAAC;KACd;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAE7C,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC5D,MAAM,uBAAuB,GAAG,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAEpF,MAAM,eAAe,GAAG,YAAY,CAAC,YAAY,CAAC,IAAI,CAClD,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAChC,OAAO,CAAC,MAAM,KAAK,UAAU;YAC7B,IAAA,iCAAgB,EAAC,MAAM,CAAC;YACxB,uBAAuB,CAAC,QAAQ,CAAC,UAAU,CAAC,CACnD,CAAC;QACF,IAAI,eAAe,EAAE;YACjB,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC;SACrC;QAED,IAAI,UAAU,EAAE;YACZ,OAAO,EAAE,CAAC;SACb;QAED,OAAO,GAAG,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB;IAChC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;IAC/B,MAAM,eAAe,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAC7C,MAAM,YAAY,GAAG,IAAA,iCAAe,GAAE,CAAC;IAEvC,OAAO,IAAA,mBAAW,EACd,CAAC,MAAoB,EAAE,UAAoB,EAAE,EAAE,CAC3C,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,CAAC,EAChF,CAAC,MAAM,EAAE,eAAe,EAAE,YAAY,CAAC,CAC1C,CAAC;AACN,CAAC;AAVD,oDAUC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prezly/theme-kit-nextjs",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.5",
|
|
4
4
|
"description": "Data layer and utility library for developing Prezly themes with NextJS",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"next-seo": "^5.4.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@prezly/theme-kit-core": "^5.0.0-alpha.
|
|
54
|
+
"@prezly/theme-kit-core": "^5.0.0-alpha.5",
|
|
55
55
|
"@sentry/nextjs": "7.49.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"sideEffects": false,
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "d8da29d9d5b0e66dbd98953a5d92e663722b1aae"
|
|
62
62
|
}
|