@prezly/theme-kit-nextjs 1.3.2 → 1.3.3
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/getNewsroomServerSideProps.d.ts +1 -1
- package/build/adapter-nextjs/processRequest.d.ts +1 -1
- package/build/data-fetching/api/PrezlyApi.d.ts +3 -2
- package/build/data-fetching/api/PrezlyApi.js.map +1 -1
- package/build/data-fetching/api/getPrezlyApi.d.ts +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.d.ts +5 -5
- package/build/data-fetching/api/queries.js +22 -16
- package/build/data-fetching/api/queries.js.map +1 -1
- package/build/data-fetching/getLocalizedCategoryData.d.ts +2 -2
- package/build/data-fetching/getPrivacyPortalUrl.d.ts +1 -1
- package/build/data-fetching/getStoryPublicationDate.d.ts +1 -1
- package/build/data-fetching/lib/getAlgoliaSettings.d.ts +2 -2
- package/build/data-fetching/lib/getAlgoliaSettings.js +3 -3
- package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
- package/build/data-fetching/lib/getEnvVariables.d.ts +1 -1
- package/build/data-fetching/lib/getEnvVariables.js +7 -7
- package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
- package/build/intl/lang.d.ts +1 -1
- package/build/intl/locale.d.ts +1 -1
- package/build/intl/locale.js.map +1 -1
- package/build/intl/localeConfig.js +1 -0
- package/build/intl/localeConfig.js.map +1 -1
- package/build/newsroom-context/context.d.ts +2 -2
- package/build/newsroom-context/context.js +2 -2
- package/build/newsroom-context/context.js.map +1 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.d.ts +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.d.ts +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.d.ts +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.d.ts +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.d.ts +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.d.ts +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/useGetTranslationUrl.d.ts +1 -1
- package/build/newsroom-context/hooks/useLanguages.d.ts +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.d.ts +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.d.ts +2 -2
- package/build/newsroom-context/hooks/useNewsroomContext.js +2 -2
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
- package/build/types.d.ts +1 -1
- package/package.json +2 -10
- package/src/adapter-nextjs/getNewsroomServerSideProps.ts +1 -1
- package/src/adapter-nextjs/processRequest.ts +1 -1
- package/src/data-fetching/api/PrezlyApi.ts +3 -2
- package/src/data-fetching/api/getPrezlyApi.ts +3 -3
- package/src/data-fetching/api/queries.ts +25 -18
- package/src/data-fetching/getLocalizedCategoryData.ts +2 -2
- package/src/data-fetching/getPrivacyPortalUrl.ts +1 -1
- package/src/data-fetching/getStoryPublicationDate.tsx +1 -1
- package/src/data-fetching/lib/getAlgoliaSettings.ts +4 -4
- package/src/data-fetching/lib/getEnvVariables.ts +7 -7
- package/src/intl/lang.ts +1 -1
- package/src/intl/locale.ts +2 -1
- package/src/intl/localeConfig.js +1 -0
- package/src/newsroom-context/context.tsx +5 -4
- package/src/newsroom-context/hooks/useAlgoliaSettings.ts +2 -2
- package/src/newsroom-context/hooks/useCategories.ts +2 -2
- package/src/newsroom-context/hooks/useCompanyInformation.ts +2 -2
- package/src/newsroom-context/hooks/useCurrentCategory.ts +2 -2
- package/src/newsroom-context/hooks/useCurrentLocale.ts +2 -2
- package/src/newsroom-context/hooks/useCurrentStory.ts +2 -2
- package/src/newsroom-context/hooks/useGetTranslationUrl.ts +1 -1
- package/src/newsroom-context/hooks/useLanguages.ts +2 -2
- package/src/newsroom-context/hooks/useNewsroom.ts +2 -2
- package/src/newsroom-context/hooks/useNewsroomContext.ts +4 -3
- package/src/types.ts +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
|
|
2
|
-
import { PageProps, ServerSidePageProps } from '../types';
|
|
2
|
+
import type { PageProps, ServerSidePageProps } from '../types';
|
|
3
3
|
export declare function processRequest<Props>(context: GetServerSidePropsContext, props: Props & PageProps & ServerSidePageProps, canonicalUrl?: string): GetServerSidePropsResult<Props>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import
|
|
2
|
+
import type { Category, ExtraStoryFields, Newsroom, NewsroomLanguageSettings, Story } from '@prezly/sdk';
|
|
3
|
+
import PrezlySDK from '@prezly/sdk';
|
|
3
4
|
import type { IncomingMessage } from 'http';
|
|
4
|
-
import { PageProps, ServerSidePageProps } from '../../types';
|
|
5
|
+
import type { PageProps, ServerSidePageProps } from '../../types';
|
|
5
6
|
declare type SortOrder = 'desc' | 'asc';
|
|
6
7
|
interface GetStoriesOptions {
|
|
7
8
|
page?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrezlyApi.js","sourceRoot":"","sources":["../../../src/data-fetching/api/PrezlyApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PrezlyApi.js","sourceRoot":"","sources":["../../../src/data-fetching/api/PrezlyApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,oDAAoC;AAGpC,mCAA0C;AAE1C,0CAAiD;AACjD,gEAA+D;AAE/D,yCAKqB;AACrB,qCAMmB;AAEnB,IAAM,kBAAkB,GAAc,MAAM,CAAC;AAiB7C;IAKI,mBAAY,WAAmB,EAAE,YAA8B;QAA/D,iBAQC;;QA2HD,kBAAa,GAA8C,UAAC,OAAO;YAC/D,OAAA,KAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QAAhC,CAAgC,CAAC;QAnIjC,IAAM,OAAO,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,qBAAqB,mCAAI,SAAS,CAAC;QAC/D,IAAI,CAAC,GAAG,GAAG,IAAI,aAAS,CAAC;YACrB,WAAW,aAAA;YACX,OAAO,SAAA;YACP,OAAO,EAAE,EAAE,oBAAoB,EAAE,MAAM,EAAE;SAC5C,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAED,4BAAQ,GAAR,UAAS,IAAY;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAEK,+BAAW,GAAjB;;;gBACI,sBAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,EAAC;;;KACpD;IAEK,uCAAmB,GAAzB;;;gBACI,sBAAO,IAAI,CAAC,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|
|
4
|
+
export declare function getPrezlyApi(req?: IncomingMessage): PrezlyApi;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPrezlyApi = void 0;
|
|
4
4
|
var getEnvVariables_1 = require("../lib/getEnvVariables");
|
|
5
5
|
var PrezlyApi_1 = require("./PrezlyApi");
|
|
6
|
-
|
|
7
|
-
if (
|
|
6
|
+
function getPrezlyApi(req) {
|
|
7
|
+
if (typeof window !== 'undefined') {
|
|
8
8
|
throw new Error('"getPrezlyApi" should only be used on back-end side.');
|
|
9
9
|
}
|
|
10
10
|
// `getEnvVariables` handles both cases for envs parsing - .env and request headers
|
|
@@ -16,6 +16,6 @@ var getPrezlyApi = function (req) {
|
|
|
16
16
|
throw new Error('"PREZLY_NEWSROOM_UUID" is not set in env variables.');
|
|
17
17
|
}
|
|
18
18
|
return new PrezlyApi_1.PrezlyApi(PREZLY_ACCESS_TOKEN, PREZLY_NEWSROOM_UUID);
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
exports.getPrezlyApi = getPrezlyApi;
|
|
21
21
|
//# sourceMappingURL=getPrezlyApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPrezlyApi.js","sourceRoot":"","sources":["../../../src/data-fetching/api/getPrezlyApi.ts"],"names":[],"mappings":";;;AAEA,0DAAyD;AAEzD,yCAAwC;
|
|
1
|
+
{"version":3,"file":"getPrezlyApi.js","sourceRoot":"","sources":["../../../src/data-fetching/api/getPrezlyApi.ts"],"names":[],"mappings":";;;AAEA,0DAAyD;AAEzD,yCAAwC;AAExC,SAAgB,YAAY,CAAC,GAAqB;IAC9C,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;KAC3E;IAED,mFAAmF;IAC7E,IAAA,KAAgD,IAAA,iCAAe,EAAC,GAAG,CAAC,EAAlE,mBAAmB,yBAAA,EAAE,oBAAoB,0BAAyB,CAAC;IAE3E,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,qBAAS,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;AACpE,CAAC;AAjBD,oCAiBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function getSlugQuery(newsroomUuid: string, slug: string): {
|
|
2
2
|
$and: ({
|
|
3
3
|
lifecycle_status: {
|
|
4
4
|
$in: string[];
|
|
@@ -21,9 +21,9 @@ export declare const getSlugQuery: (newsroomUuid: string, slug: string) => {
|
|
|
21
21
|
'newsroom.uuid'?: undefined;
|
|
22
22
|
})[];
|
|
23
23
|
};
|
|
24
|
-
export declare
|
|
25
|
-
export declare
|
|
26
|
-
export declare
|
|
24
|
+
export declare function getStoriesQuery(newsroomUuid: string, categoryId?: number, localeCode?: string): any;
|
|
25
|
+
export declare function getSortByPublishedDate(order: 'asc' | 'desc'): "-published_at" | "published_at";
|
|
26
|
+
export declare function getGalleriesQuery(): {
|
|
27
27
|
$and: ({
|
|
28
28
|
status: {
|
|
29
29
|
$eq: string;
|
|
@@ -36,7 +36,7 @@ export declare const getGalleriesQuery: () => {
|
|
|
36
36
|
status?: undefined;
|
|
37
37
|
})[];
|
|
38
38
|
};
|
|
39
|
-
export declare
|
|
39
|
+
export declare function getContactsQuery(): {
|
|
40
40
|
$and: {
|
|
41
41
|
is_featured: {
|
|
42
42
|
$eq: boolean;
|
|
@@ -34,14 +34,16 @@ var publishedAndPublic = [
|
|
|
34
34
|
{ lifecycle_status: { $in: ['published'] } },
|
|
35
35
|
{ visibility: { $in: ['public'] } },
|
|
36
36
|
];
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
function getSlugQuery(newsroomUuid, slug) {
|
|
38
|
+
return {
|
|
39
|
+
$and: __spreadArray([
|
|
40
|
+
{ 'newsroom.uuid': { $in: [newsroomUuid] } },
|
|
41
|
+
{ slug: { $eq: slug } }
|
|
42
|
+
], __read(publishedAndAccessible), false),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
43
45
|
exports.getSlugQuery = getSlugQuery;
|
|
44
|
-
|
|
46
|
+
function getStoriesQuery(newsroomUuid, categoryId, localeCode) {
|
|
45
47
|
var query = {
|
|
46
48
|
$and: __spreadArray(__spreadArray([], __read(publishedAndPublic), false), [{ 'newsroom.uuid': { $in: [newsroomUuid] } }], false),
|
|
47
49
|
};
|
|
@@ -52,18 +54,22 @@ var getStoriesQuery = function (newsroomUuid, categoryId, localeCode) {
|
|
|
52
54
|
query.$and.push({ locale: { $in: [localeCode] } });
|
|
53
55
|
}
|
|
54
56
|
return query;
|
|
55
|
-
}
|
|
57
|
+
}
|
|
56
58
|
exports.getStoriesQuery = getStoriesQuery;
|
|
57
|
-
|
|
59
|
+
function getSortByPublishedDate(order) {
|
|
58
60
|
return order === 'desc' ? '-published_at' : 'published_at';
|
|
59
|
-
}
|
|
61
|
+
}
|
|
60
62
|
exports.getSortByPublishedDate = getSortByPublishedDate;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
63
|
+
function getGalleriesQuery() {
|
|
64
|
+
return {
|
|
65
|
+
$and: [{ status: { $eq: 'public' } }, { images_number: { $gt: 0 } }],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
64
68
|
exports.getGalleriesQuery = getGalleriesQuery;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
69
|
+
function getContactsQuery() {
|
|
70
|
+
return {
|
|
71
|
+
$and: [{ is_featured: { $eq: true } }],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
68
74
|
exports.getContactsQuery = getContactsQuery;
|
|
69
75
|
//# sourceMappingURL=queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/data-fetching/api/queries.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,sBAAsB,GAAG;IAC3B,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,EAAE;IACvD,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE;CAC5D,CAAC;AAEF,IAAM,kBAAkB,GAAG;IACvB,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE;IAC5C,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;CACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/data-fetching/api/queries.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,sBAAsB,GAAG;IAC3B,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,EAAE;IACvD,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE;CAC5D,CAAC;AAEF,IAAM,kBAAkB,GAAG;IACvB,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE;IAC5C,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;CACtC,CAAC;AAEF,SAAgB,YAAY,CAAC,YAAoB,EAAE,IAAY;IAC3D,OAAO;QACH,IAAI;YACA,EAAE,eAAe,EAAE,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE;Y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prezly/sdk';
|
|
2
|
-
import { LocaleObject } from '../intl';
|
|
3
|
-
import { AlgoliaCategoryRef } from '../types';
|
|
2
|
+
import type { LocaleObject } from '../intl';
|
|
3
|
+
import type { AlgoliaCategoryRef } from '../types';
|
|
4
4
|
export declare function getLocalizedCategoryData(category: Category | AlgoliaCategoryRef, locale: LocaleObject): {
|
|
5
5
|
description: string | null;
|
|
6
6
|
name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { IncomingMessage } from 'http';
|
|
3
|
-
import { AlgoliaSettings } from '../types';
|
|
4
|
-
export declare
|
|
3
|
+
import type { AlgoliaSettings } from '../types';
|
|
4
|
+
export declare function getAlgoliaSettings(req?: IncomingMessage): AlgoliaSettings;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAlgoliaSettings = void 0;
|
|
4
4
|
var getEnvVariables_1 = require("./getEnvVariables");
|
|
5
|
-
|
|
6
|
-
if (
|
|
5
|
+
function getAlgoliaSettings(req) {
|
|
6
|
+
if (typeof window !== 'undefined') {
|
|
7
7
|
throw new Error('"getAlgoliaSettings" should only be used on back-end side.');
|
|
8
8
|
}
|
|
9
9
|
// `getEnvVariables` handles both cases for envs parsing - .env and request headers
|
|
@@ -17,6 +17,6 @@ var getAlgoliaSettings = function (req) {
|
|
|
17
17
|
ALGOLIA_APP_ID: ALGOLIA_APP_ID,
|
|
18
18
|
ALGOLIA_INDEX: ALGOLIA_INDEX,
|
|
19
19
|
};
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
exports.getAlgoliaSettings = getAlgoliaSettings;
|
|
22
22
|
//# sourceMappingURL=getAlgoliaSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAlgoliaSettings.js","sourceRoot":"","sources":["../../../src/data-fetching/lib/getAlgoliaSettings.ts"],"names":[],"mappings":";;;AAIA,qDAAoD;
|
|
1
|
+
{"version":3,"file":"getAlgoliaSettings.js","sourceRoot":"","sources":["../../../src/data-fetching/lib/getAlgoliaSettings.ts"],"names":[],"mappings":";;;AAIA,qDAAoD;AAEpD,SAAgB,kBAAkB,CAAC,GAAqB;IACpD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;KACjF;IAED,mFAAmF;IAC7E,IAAA,KAIF,IAAA,iCAAe,EAAC,GAAG,CAAC,EAHpB,uBAAoB,EAApB,eAAe,mBAAG,EAAE,KAAA,EACpB,sBAA6B,EAA7B,cAAc,mBAAG,YAAY,KAAA,EAC7B,qBAAqC,EAArC,aAAa,mBAAG,qBAAqB,KACjB,CAAC;IAEzB,IAAI,CAAC,eAAe,EAAE;QAClB,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,2EAA2E,CAAC,CAAC;KAC9F;IAED,OAAO;QACH,eAAe,iBAAA;QACf,cAAc,gBAAA;QACd,aAAa,eAAA;KAChB,CAAC;AACN,CAAC;AAtBD,gDAsBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { IncomingMessage } from 'http';
|
|
3
3
|
import type { PrezlyEnv } from '../types';
|
|
4
|
-
export declare
|
|
4
|
+
export declare function getEnvVariables(req?: IncomingMessage): PrezlyEnv;
|
|
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.getEnvVariables = void 0;
|
|
18
18
|
var parse_data_url_1 = __importDefault(require("parse-data-url"));
|
|
19
|
-
|
|
19
|
+
function decodeJson(json) {
|
|
20
20
|
try {
|
|
21
21
|
var decoded = JSON.parse(json);
|
|
22
22
|
if (decoded && typeof decoded === 'object') {
|
|
@@ -27,8 +27,8 @@ var decodeJson = function (json) {
|
|
|
27
27
|
// passthru
|
|
28
28
|
}
|
|
29
29
|
return {};
|
|
30
|
-
}
|
|
31
|
-
|
|
30
|
+
}
|
|
31
|
+
function decodeHttpEnv(header) {
|
|
32
32
|
if (header.startsWith('data:')) {
|
|
33
33
|
var parsed = (0, parse_data_url_1.default)(header);
|
|
34
34
|
if (parsed && parsed.contentType === 'application/json') {
|
|
@@ -38,9 +38,9 @@ var decodeHttpEnv = function (header) {
|
|
|
38
38
|
return {}; // unsupported data-uri
|
|
39
39
|
}
|
|
40
40
|
return decodeJson(header);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (
|
|
41
|
+
}
|
|
42
|
+
function getEnvVariables(req) {
|
|
43
|
+
if (typeof window !== 'undefined') {
|
|
44
44
|
throw new Error('"getEnvVariables" should only be used on back-end side.');
|
|
45
45
|
}
|
|
46
46
|
var headerName = (process.env.HTTP_ENV_HEADER || '').toLowerCase();
|
|
@@ -50,6 +50,6 @@ var getEnvVariables = function (req) {
|
|
|
50
50
|
return __assign(__assign({}, process.env), httpEnv);
|
|
51
51
|
}
|
|
52
52
|
return __assign({}, process.env);
|
|
53
|
-
}
|
|
53
|
+
}
|
|
54
54
|
exports.getEnvVariables = getEnvVariables;
|
|
55
55
|
//# sourceMappingURL=getEnvVariables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEnvVariables.js","sourceRoot":"","sources":["../../../src/data-fetching/lib/getEnvVariables.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,kEAA0C;AAI1C,
|
|
1
|
+
{"version":3,"file":"getEnvVariables.js","sourceRoot":"","sources":["../../../src/data-fetching/lib/getEnvVariables.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,kEAA0C;AAI1C,SAAS,UAAU,CAAC,IAAY;IAC5B,IAAI;QACA,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YACxC,OAAO,OAAO,CAAC;SAClB;KACJ;IAAC,WAAM;QACJ,WAAW;KACd;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,MAAc;IACjC,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAM,MAAM,GAAG,IAAA,wBAAY,EAAC,MAAM,CAAC,CAAC;QACpC,IAAI,MAAM,IAAI,MAAM,CAAC,WAAW,KAAK,kBAAkB,EAAE;YACrD,IAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACjD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;SAC3B;QACD,OAAO,EAAE,CAAC,CAAC,uBAAuB;KACrC;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED,SAAgB,eAAe,CAAC,GAAqB;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;KAC9E;IAED,IAAM,UAAU,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAErE,IAAI,UAAU,IAAI,GAAG,EAAE;QACnB,IAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAuB,CAAC;QAC7D,IAAM,OAAO,GAAG,aAAa,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QAC5C,6BAAY,OAAO,CAAC,GAAG,GAAK,OAAO,EAAG;KACzC;IAED,oBAAY,OAAO,CAAC,GAAG,EAAG;AAC9B,CAAC;AAdD,0CAcC"}
|
package/build/intl/lang.d.ts
CHANGED
package/build/intl/locale.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Redirect } from 'next';
|
|
3
|
-
import { ParsedUrlQuery } from 'querystring';
|
|
3
|
+
import type { ParsedUrlQuery } from 'querystring';
|
|
4
4
|
import { LocaleObject } from './localeObject';
|
|
5
5
|
export declare const DEFAULT_LOCALE = "en";
|
|
6
6
|
export declare const DUMMY_DEFAULT_LOCALE = "qps-ploc";
|
package/build/intl/locale.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/intl/locale.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/intl/locale.ts"],"names":[],"mappings":";;;AAEA,2CAAwC;AAExC,+CAA8C;AAEjC,QAAA,cAAc,GAAG,IAAI,CAAC;AACtB,QAAA,oBAAoB,GAAG,UAAU,CAAC;AAE/C,IAAM,iBAAiB,GAAG;IACtB,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,OAAO;CACV,CAAC;AAEF,SAAgB,yBAAyB,CAAC,MAAoB;IAC1D,IAAM,aAAa,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;IAE5C,IAAM,iBAAiB,GACnB,aAAa,CAAC,MAAM,IAAI,CAAC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,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,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;IAE3D,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;QAClD,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AARD,gDAQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localeConfig.js","sourceRoot":"","sources":["../../src/intl/localeConfig.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kGAAkG;AAClG,IAAM,gBAAgB,GAAG;IACrB,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,KAAK;IACL,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;CACV,CAAC;AAEF,IAAM,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,WAAW,EAAE,EAAf,CAAe,CAAC,CAAC;AAEtE,kGAAkG;AAClG,IAAM,0BAA0B,GAAG,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,sDACA,gBAAgB,kBAChB,gBAAgB,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAlB,CAAkB,CAAC,kBAClD,gBAAgB,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAlB,CAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UACvE,CACL,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,CAAC,OAAO,GAAG,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"localeConfig.js","sourceRoot":"","sources":["../../src/intl/localeConfig.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kGAAkG;AAClG,IAAM,gBAAgB,GAAG;IACrB,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO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CAAC,EAAlB,CAAkB,CAAC,kBAClD,gBAAgB,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAlB,CAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UACvE,CACL,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,CAAC,OAAO,GAAG,0BAA0B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Category, ExtendedStory, Newsroom, NewsroomCompanyInformation, NewsroomContact, NewsroomLanguageSettings, NewsroomThemePreset } from '@prezly/sdk';
|
|
2
|
-
import {
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import type { AlgoliaSettings } from '../data-fetching';
|
|
4
4
|
import { LocaleObject } from '../intl';
|
|
5
5
|
export interface NewsroomContextType {
|
|
@@ -18,4 +18,4 @@ export interface NewsroomContextProps extends Omit<NewsroomContextType, 'locale'
|
|
|
18
18
|
localeCode: string;
|
|
19
19
|
}
|
|
20
20
|
export declare const NewsroomContext: import("react").Context<NewsroomContextType | undefined>;
|
|
21
|
-
export declare
|
|
21
|
+
export declare function NewsroomContextProvider({ categories, contacts, newsroom, currentCategory, currentStory, companyInformation, languages, localeCode, themePreset, algoliaSettings, children, }: PropsWithChildren<NewsroomContextProps>): JSX.Element;
|
|
@@ -16,7 +16,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
16
16
|
var react_1 = require("react");
|
|
17
17
|
var intl_1 = require("../intl");
|
|
18
18
|
exports.NewsroomContext = (0, react_1.createContext)(undefined);
|
|
19
|
-
|
|
19
|
+
function NewsroomContextProvider(_a) {
|
|
20
20
|
var categories = _a.categories, contacts = _a.contacts, newsroom = _a.newsroom, currentCategory = _a.currentCategory, currentStory = _a.currentStory, companyInformation = _a.companyInformation, languages = _a.languages, localeCode = _a.localeCode, themePreset = _a.themePreset, algoliaSettings = _a.algoliaSettings, children = _a.children;
|
|
21
21
|
var locale = (0, react_1.useMemo)(function () { return intl_1.LocaleObject.fromAnyCode(localeCode || intl_1.DEFAULT_LOCALE); }, [localeCode]);
|
|
22
22
|
return ((0, jsx_runtime_1.jsx)(exports.NewsroomContext.Provider, __assign({ value: {
|
|
@@ -31,6 +31,6 @@ var NewsroomContextProvider = function (_a) {
|
|
|
31
31
|
themePreset: themePreset,
|
|
32
32
|
algoliaSettings: algoliaSettings,
|
|
33
33
|
} }, { children: children }), void 0));
|
|
34
|
-
}
|
|
34
|
+
}
|
|
35
35
|
exports.NewsroomContextProvider = NewsroomContextProvider;
|
|
36
36
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/newsroom-context/context.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/newsroom-context/context.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAUA,+BAA+C;AAG/C,gCAAuD;AAmB1C,QAAA,eAAe,GAAG,IAAA,qBAAa,EAAkC,SAAS,CAAC,CAAC;AAEzF,SAAgB,uBAAuB,CAAC,EAYE;QAXtC,UAAU,gBAAA,EACV,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,eAAe,qBAAA,EACf,YAAY,kBAAA,EACZ,kBAAkB,wBAAA,EAClB,SAAS,eAAA,EACT,UAAU,gBAAA,EACV,WAAW,iBAAA,EACX,eAAe,qBAAA,EACf,QAAQ,cAAA;IAER,IAAM,MAAM,GAAG,IAAA,eAAO,EAClB,cAAM,OAAA,mBAAY,CAAC,WAAW,CAAC,UAAU,IAAI,qBAAc,CAAC,EAAtD,CAAsD,EAC5D,CAAC,UAAU,CAAC,CACf,CAAC;IAEF,OAAO,CACH,uBAAC,uBAAe,CAAC,QAAQ,aACrB,KAAK,EAAE;YACH,UAAU,YAAA;YACV,QAAQ,UAAA;YACR,QAAQ,UAAA;YACR,eAAe,iBAAA;YACf,YAAY,cAAA;YACZ,kBAAkB,oBAAA;YAClB,SAAS,WAAA;YACT,MAAM,QAAA;YACN,WAAW,aAAA;YACX,eAAe,iBAAA;SAClB,gBAEA,QAAQ,YACc,CAC9B,CAAC;AACN,CAAC;AApCD,0DAoCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function useAlgoliaSettings(): import("../..").AlgoliaSettings;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useAlgoliaSettings = void 0;
|
|
4
4
|
var useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
-
|
|
5
|
+
function useAlgoliaSettings() {
|
|
6
6
|
var context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
7
|
return context.algoliaSettings;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
exports.useAlgoliaSettings = useAlgoliaSettings;
|
|
10
10
|
//# sourceMappingURL=useAlgoliaSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAlgoliaSettings.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useAlgoliaSettings.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;
|
|
1
|
+
{"version":3,"file":"useAlgoliaSettings.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useAlgoliaSettings.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAE1D,SAAgB,kBAAkB;IAC9B,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,eAAe,CAAC;AACnC,CAAC;AAJD,gDAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function useCategories(): import("@prezly/sdk").Category[];
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCategories = void 0;
|
|
4
4
|
var useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
-
|
|
5
|
+
function useCategories() {
|
|
6
6
|
var context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
7
|
return context.categories;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
exports.useCategories = useCategories;
|
|
10
10
|
//# sourceMappingURL=useCategories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCategories.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCategories.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;
|
|
1
|
+
{"version":3,"file":"useCategories.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCategories.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAE1D,SAAgB,aAAa;IACzB,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,UAAU,CAAC;AAC9B,CAAC;AAJD,sCAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function useCompanyInformation(): import("@prezly/sdk").NewsroomCompanyInformation;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCompanyInformation = void 0;
|
|
4
4
|
var useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
-
|
|
5
|
+
function useCompanyInformation() {
|
|
6
6
|
var context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
7
|
return context.companyInformation;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
exports.useCompanyInformation = useCompanyInformation;
|
|
10
10
|
//# sourceMappingURL=useCompanyInformation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompanyInformation.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCompanyInformation.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;
|
|
1
|
+
{"version":3,"file":"useCompanyInformation.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCompanyInformation.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAE1D,SAAgB,qBAAqB;IACjC,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,kBAAkB,CAAC;AACtC,CAAC;AAJD,sDAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function useCurrentCategory(): import("@prezly/sdk").Category | undefined;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCurrentCategory = void 0;
|
|
4
4
|
var useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
-
|
|
5
|
+
function useCurrentCategory() {
|
|
6
6
|
var context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
7
|
return context.currentCategory;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
exports.useCurrentCategory = useCurrentCategory;
|
|
10
10
|
//# sourceMappingURL=useCurrentCategory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentCategory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCurrentCategory.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;
|
|
1
|
+
{"version":3,"file":"useCurrentCategory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCurrentCategory.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAE1D,SAAgB,kBAAkB;IAC9B,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,eAAe,CAAC;AACnC,CAAC;AAJD,gDAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function useCurrentLocale(): import("../..").LocaleObject;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCurrentLocale = void 0;
|
|
4
4
|
var useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
-
|
|
5
|
+
function useCurrentLocale() {
|
|
6
6
|
var context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
7
|
return context.locale;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
exports.useCurrentLocale = useCurrentLocale;
|
|
10
10
|
//# sourceMappingURL=useCurrentLocale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentLocale.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCurrentLocale.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;
|
|
1
|
+
{"version":3,"file":"useCurrentLocale.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCurrentLocale.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAE1D,SAAgB,gBAAgB;IAC5B,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,MAAM,CAAC;AAC1B,CAAC;AAJD,4CAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function useCurrentStory(): import("@prezly/sdk").ExtendedStory | undefined;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCurrentStory = void 0;
|
|
4
4
|
var useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
-
|
|
5
|
+
function useCurrentStory() {
|
|
6
6
|
var context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
7
|
return context.currentStory;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
exports.useCurrentStory = useCurrentStory;
|
|
10
10
|
//# sourceMappingURL=useCurrentStory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentStory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCurrentStory.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;
|
|
1
|
+
{"version":3,"file":"useCurrentStory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useCurrentStory.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAE1D,SAAgB,eAAe;IAC3B,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,YAAY,CAAC;AAChC,CAAC;AAJD,0CAIC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LocaleObject } from '../../intl';
|
|
1
|
+
import type { LocaleObject } from '../../intl';
|
|
2
2
|
export declare function useGetTranslationUrl(): (locale: LocaleObject, noFallback?: boolean | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function useLanguages(): import("@prezly/sdk").NewsroomLanguageSettings[];
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLanguages = void 0;
|
|
4
4
|
var useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
-
|
|
5
|
+
function useLanguages() {
|
|
6
6
|
var context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
7
|
return context.languages;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
exports.useLanguages = useLanguages;
|
|
10
10
|
//# sourceMappingURL=useLanguages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLanguages.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useLanguages.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;
|
|
1
|
+
{"version":3,"file":"useLanguages.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useLanguages.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAE1D,SAAgB,YAAY;IACxB,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,SAAS,CAAC;AAC7B,CAAC;AAJD,oCAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function useNewsroom(): import("@prezly/sdk").Newsroom;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useNewsroom = void 0;
|
|
4
4
|
var useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
-
|
|
5
|
+
function useNewsroom() {
|
|
6
6
|
var context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
7
|
return context.newsroom;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
exports.useNewsroom = useNewsroom;
|
|
10
10
|
//# sourceMappingURL=useNewsroom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNewsroom.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroom.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;
|
|
1
|
+
{"version":3,"file":"useNewsroom.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroom.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAE1D,SAAgB,WAAW;IACvB,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,QAAQ,CAAC;AAC5B,CAAC;AAJD,kCAIC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { NewsroomContextType } from '../context';
|
|
2
|
-
export declare
|
|
1
|
+
import type { NewsroomContextType } from '../context';
|
|
2
|
+
export declare function useNewsroomContext(): NewsroomContextType;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useNewsroomContext = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
5
|
var context_1 = require("../context");
|
|
6
|
-
|
|
6
|
+
function useNewsroomContext() {
|
|
7
7
|
// TS Compiler is having a hard time figuring this type implicitly, so we have to set it explicitly
|
|
8
8
|
// See https://github.com/microsoft/TypeScript/issues/5711#issuecomment-340283439
|
|
9
9
|
var newsroomContext = (0, react_1.useContext)(context_1.NewsroomContext);
|
|
@@ -11,6 +11,6 @@ var useNewsroomContext = function () {
|
|
|
11
11
|
throw new Error('No `NewsroomContextProvider` found when calling `useNewsroomContext`');
|
|
12
12
|
}
|
|
13
13
|
return newsroomContext;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
exports.useNewsroomContext = useNewsroomContext;
|
|
16
16
|
//# sourceMappingURL=useNewsroomContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNewsroomContext.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroomContext.ts"],"names":[],"mappings":";;;AAAA,+BAAmC;
|
|
1
|
+
{"version":3,"file":"useNewsroomContext.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroomContext.ts"],"names":[],"mappings":";;;AAAA,+BAAmC;AAGnC,sCAA6C;AAE7C,SAAgB,kBAAkB;IAC9B,mGAAmG;IACnG,iFAAiF;IACjF,IAAM,eAAe,GAAoC,IAAA,kBAAU,EAAC,yBAAe,CAAC,CAAC;IACrF,IAAI,CAAC,eAAe,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;KAC3F;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC;AATD,gDASC"}
|
package/build/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CultureRef, ExtraStoryFields, Story } from '@prezly/sdk';
|
|
2
|
-
import { NewsroomContextProps } from './newsroom-context';
|
|
2
|
+
import type { NewsroomContextProps } from './newsroom-context';
|
|
3
3
|
export interface ServerSidePageProps {
|
|
4
4
|
localeResolved: boolean;
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prezly/theme-kit-nextjs",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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",
|
|
@@ -52,20 +52,12 @@
|
|
|
52
52
|
"parse-data-url": "^4.0.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
+
"@prezly/eslint-config": "^4.0.0",
|
|
55
56
|
"@types/node": "^17.0.13",
|
|
56
57
|
"@types/parse-data-url": "^3.0.0",
|
|
57
58
|
"@types/react": "^17.0.38",
|
|
58
59
|
"@types/react-dom": "^17.0.11",
|
|
59
60
|
"eslint": "^8.8.0",
|
|
60
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
61
|
-
"eslint-config-airbnb-typescript": "^16.1.0",
|
|
62
|
-
"eslint-config-prettier": "^8.3.0",
|
|
63
|
-
"eslint-import-resolver-typescript": "^2.5.0",
|
|
64
|
-
"eslint-plugin-import": "^2.25.4",
|
|
65
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
66
|
-
"eslint-plugin-react": "^7.28.0",
|
|
67
|
-
"eslint-plugin-react-hooks": "^4.3.0",
|
|
68
|
-
"eslint-plugin-sort-export-all": "^1.2.1",
|
|
69
61
|
"np": "^7.6.0",
|
|
70
62
|
"prettier": "^2.5.1",
|
|
71
63
|
"rimraf": "^3.0.2",
|
|
@@ -2,7 +2,7 @@ import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
|
|
|
2
2
|
|
|
3
3
|
import { getShortestLocaleCode } from '../data-fetching';
|
|
4
4
|
import { getRedirectToCanonicalLocale, LocaleObject } from '../intl';
|
|
5
|
-
import { PageProps, ServerSidePageProps } from '../types';
|
|
5
|
+
import type { PageProps, ServerSidePageProps } from '../types';
|
|
6
6
|
|
|
7
7
|
export function processRequest<Props>(
|
|
8
8
|
context: GetServerSidePropsContext,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type {
|
|
2
2
|
Category,
|
|
3
3
|
ExtraStoryFields,
|
|
4
4
|
Newsroom,
|
|
5
5
|
NewsroomLanguageSettings,
|
|
6
6
|
Story,
|
|
7
7
|
} from '@prezly/sdk';
|
|
8
|
+
import PrezlySDK from '@prezly/sdk';
|
|
8
9
|
import type { IncomingMessage } from 'http';
|
|
9
10
|
|
|
10
11
|
import { LocaleObject } from '../../intl';
|
|
11
|
-
import { PageProps, ServerSidePageProps } from '../../types';
|
|
12
|
+
import type { PageProps, ServerSidePageProps } from '../../types';
|
|
12
13
|
import { DEFAULT_PAGE_SIZE } from '../constants';
|
|
13
14
|
import { getAlgoliaSettings } from '../lib/getAlgoliaSettings';
|
|
14
15
|
|
|
@@ -4,8 +4,8 @@ import { getEnvVariables } from '../lib/getEnvVariables';
|
|
|
4
4
|
|
|
5
5
|
import { PrezlyApi } from './PrezlyApi';
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
if (
|
|
7
|
+
export function getPrezlyApi(req?: IncomingMessage): PrezlyApi {
|
|
8
|
+
if (typeof window !== 'undefined') {
|
|
9
9
|
throw new Error('"getPrezlyApi" should only be used on back-end side.');
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -21,4 +21,4 @@ export const getPrezlyApi = (req?: IncomingMessage): PrezlyApi => {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
return new PrezlyApi(PREZLY_ACCESS_TOKEN, PREZLY_NEWSROOM_UUID);
|
|
24
|
-
}
|
|
24
|
+
}
|
|
@@ -8,15 +8,17 @@ const publishedAndPublic = [
|
|
|
8
8
|
{ visibility: { $in: ['public'] } },
|
|
9
9
|
];
|
|
10
10
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
export function getSlugQuery(newsroomUuid: string, slug: string) {
|
|
12
|
+
return {
|
|
13
|
+
$and: [
|
|
14
|
+
{ 'newsroom.uuid': { $in: [newsroomUuid] } },
|
|
15
|
+
{ slug: { $eq: slug } },
|
|
16
|
+
...publishedAndAccessible,
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getStoriesQuery(newsroomUuid: string, categoryId?: number, localeCode?: string) {
|
|
20
22
|
const query: any = {
|
|
21
23
|
$and: [...publishedAndPublic, { 'newsroom.uuid': { $in: [newsroomUuid] } }],
|
|
22
24
|
};
|
|
@@ -30,15 +32,20 @@ export const getStoriesQuery = (newsroomUuid: string, categoryId?: number, local
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
return query;
|
|
33
|
-
}
|
|
35
|
+
}
|
|
34
36
|
|
|
35
|
-
export
|
|
36
|
-
order === 'desc' ? '-published_at' : 'published_at';
|
|
37
|
+
export function getSortByPublishedDate(order: 'asc' | 'desc') {
|
|
38
|
+
return order === 'desc' ? '-published_at' : 'published_at';
|
|
39
|
+
}
|
|
37
40
|
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
+
export function getGalleriesQuery() {
|
|
42
|
+
return {
|
|
43
|
+
$and: [{ status: { $eq: 'public' } }, { images_number: { $gt: 0 } }],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
41
46
|
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
}
|
|
47
|
+
export function getContactsQuery() {
|
|
48
|
+
return {
|
|
49
|
+
$and: [{ is_featured: { $eq: true } }],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Category } from '@prezly/sdk';
|
|
2
2
|
|
|
3
|
-
import { LocaleObject } from '../intl';
|
|
4
|
-
import { AlgoliaCategoryRef } from '../types';
|
|
3
|
+
import type { LocaleObject } from '../intl';
|
|
4
|
+
import type { AlgoliaCategoryRef } from '../types';
|
|
5
5
|
|
|
6
6
|
function isAlgoliaCategory(
|
|
7
7
|
category: Category | AlgoliaCategoryRef,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'http';
|
|
2
2
|
|
|
3
|
-
import { AlgoliaSettings } from '../types';
|
|
3
|
+
import type { AlgoliaSettings } from '../types';
|
|
4
4
|
|
|
5
5
|
import { getEnvVariables } from './getEnvVariables';
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
if (
|
|
7
|
+
export function getAlgoliaSettings(req?: IncomingMessage): AlgoliaSettings {
|
|
8
|
+
if (typeof window !== 'undefined') {
|
|
9
9
|
throw new Error('"getAlgoliaSettings" should only be used on back-end side.');
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -26,4 +26,4 @@ export const getAlgoliaSettings = (req?: IncomingMessage): AlgoliaSettings => {
|
|
|
26
26
|
ALGOLIA_APP_ID,
|
|
27
27
|
ALGOLIA_INDEX,
|
|
28
28
|
};
|
|
29
|
-
}
|
|
29
|
+
}
|
|
@@ -3,7 +3,7 @@ import parseDataUrl from 'parse-data-url';
|
|
|
3
3
|
|
|
4
4
|
import type { PrezlyEnv } from '../types';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function decodeJson(json: string): Record<string, any> {
|
|
7
7
|
try {
|
|
8
8
|
const decoded = JSON.parse(json);
|
|
9
9
|
if (decoded && typeof decoded === 'object') {
|
|
@@ -13,9 +13,9 @@ const decodeJson = (json: string): Record<string, any> => {
|
|
|
13
13
|
// passthru
|
|
14
14
|
}
|
|
15
15
|
return {};
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
function decodeHttpEnv(header: string): Record<string, any> {
|
|
19
19
|
if (header.startsWith('data:')) {
|
|
20
20
|
const parsed = parseDataUrl(header);
|
|
21
21
|
if (parsed && parsed.contentType === 'application/json') {
|
|
@@ -25,10 +25,10 @@ const decodeHttpEnv = (header: string): Record<string, any> => {
|
|
|
25
25
|
return {}; // unsupported data-uri
|
|
26
26
|
}
|
|
27
27
|
return decodeJson(header);
|
|
28
|
-
}
|
|
28
|
+
}
|
|
29
29
|
|
|
30
|
-
export
|
|
31
|
-
if (
|
|
30
|
+
export function getEnvVariables(req?: IncomingMessage): PrezlyEnv {
|
|
31
|
+
if (typeof window !== 'undefined') {
|
|
32
32
|
throw new Error('"getEnvVariables" should only be used on back-end side.');
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -41,4 +41,4 @@ export const getEnvVariables = (req?: IncomingMessage): PrezlyEnv => {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return { ...process.env };
|
|
44
|
-
}
|
|
44
|
+
}
|
package/src/intl/lang.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CultureRef, NewsroomLanguageSettings } from '@prezly/sdk';
|
|
1
|
+
import type { CultureRef, NewsroomLanguageSettings } from '@prezly/sdk';
|
|
2
2
|
|
|
3
3
|
function isOnlyCulture(culture: CultureRef, languages: NewsroomLanguageSettings[]): boolean {
|
|
4
4
|
const numberOfLanguages = languages.filter(
|
package/src/intl/locale.ts
CHANGED
package/src/intl/localeConfig.js
CHANGED
|
@@ -7,7 +7,8 @@ import type {
|
|
|
7
7
|
NewsroomLanguageSettings,
|
|
8
8
|
NewsroomThemePreset,
|
|
9
9
|
} from '@prezly/sdk';
|
|
10
|
-
import {
|
|
10
|
+
import type { PropsWithChildren } from 'react';
|
|
11
|
+
import { createContext, useMemo } from 'react';
|
|
11
12
|
|
|
12
13
|
import type { AlgoliaSettings } from '../data-fetching';
|
|
13
14
|
import { DEFAULT_LOCALE, LocaleObject } from '../intl';
|
|
@@ -31,7 +32,7 @@ export interface NewsroomContextProps extends Omit<NewsroomContextType, 'locale'
|
|
|
31
32
|
|
|
32
33
|
export const NewsroomContext = createContext<NewsroomContextType | undefined>(undefined);
|
|
33
34
|
|
|
34
|
-
export
|
|
35
|
+
export function NewsroomContextProvider({
|
|
35
36
|
categories,
|
|
36
37
|
contacts,
|
|
37
38
|
newsroom,
|
|
@@ -43,7 +44,7 @@ export const NewsroomContextProvider: FunctionComponent<NewsroomContextProps> =
|
|
|
43
44
|
themePreset,
|
|
44
45
|
algoliaSettings,
|
|
45
46
|
children,
|
|
46
|
-
})
|
|
47
|
+
}: PropsWithChildren<NewsroomContextProps>) {
|
|
47
48
|
const locale = useMemo(
|
|
48
49
|
() => LocaleObject.fromAnyCode(localeCode || DEFAULT_LOCALE),
|
|
49
50
|
[localeCode],
|
|
@@ -67,4 +68,4 @@ export const NewsroomContextProvider: FunctionComponent<NewsroomContextProps> =
|
|
|
67
68
|
{children}
|
|
68
69
|
</NewsroomContext.Provider>
|
|
69
70
|
);
|
|
70
|
-
}
|
|
71
|
+
}
|
|
@@ -3,7 +3,7 @@ import { useRouter } from 'next/router';
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
|
|
5
5
|
import { getCategoryHasTranslation, getCategoryUrl } from '../../data-fetching';
|
|
6
|
-
import { LocaleObject } from '../../intl';
|
|
6
|
+
import type { LocaleObject } from '../../intl';
|
|
7
7
|
|
|
8
8
|
import { useCurrentCategory } from './useCurrentCategory';
|
|
9
9
|
import { useCurrentStory } from './useCurrentStory';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type { NewsroomContextType } from '../context';
|
|
4
|
+
import { NewsroomContext } from '../context';
|
|
4
5
|
|
|
5
|
-
export
|
|
6
|
+
export function useNewsroomContext() {
|
|
6
7
|
// TS Compiler is having a hard time figuring this type implicitly, so we have to set it explicitly
|
|
7
8
|
// See https://github.com/microsoft/TypeScript/issues/5711#issuecomment-340283439
|
|
8
9
|
const newsroomContext: NewsroomContextType | undefined = useContext(NewsroomContext);
|
|
@@ -11,4 +12,4 @@ export const useNewsroomContext = () => {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
return newsroomContext;
|
|
14
|
-
}
|
|
15
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// TODO: Re-arrange the types to make them isolated to respective libs where possible
|
|
2
2
|
import type { CultureRef, ExtraStoryFields, Story } from '@prezly/sdk';
|
|
3
3
|
|
|
4
|
-
import { NewsroomContextProps } from './newsroom-context';
|
|
4
|
+
import type { NewsroomContextProps } from './newsroom-context';
|
|
5
5
|
|
|
6
6
|
export interface ServerSidePageProps {
|
|
7
7
|
localeResolved: boolean;
|