@prezly/theme-kit-nextjs 1.1.0 → 1.1.4
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/README.md +195 -3
- package/build/adapter-nextjs/getBasePageProps.js +59 -9
- package/build/adapter-nextjs/getBasePageProps.js.map +1 -1
- package/build/adapter-nextjs/processRequest.js +16 -8
- package/build/adapter-nextjs/processRequest.js.map +1 -1
- package/build/data-fetching/api/PrezlyApi.js +286 -127
- package/build/data-fetching/api/PrezlyApi.js.map +1 -1
- package/build/data-fetching/api/getPrezlyApi.js +4 -4
- package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
- package/build/data-fetching/api/languages.js +62 -32
- package/build/data-fetching/api/languages.js.map +1 -1
- package/build/data-fetching/api/queries.js +44 -18
- package/build/data-fetching/api/queries.js.map +1 -1
- package/build/data-fetching/getAssetsUrl.js +2 -2
- package/build/data-fetching/getAssetsUrl.js.map +1 -1
- package/build/data-fetching/getLocalizedCategoryData.js +23 -12
- package/build/data-fetching/getLocalizedCategoryData.js.map +1 -1
- package/build/data-fetching/getNewsroomLogoUrl.js +4 -3
- package/build/data-fetching/getNewsroomLogoUrl.js.map +1 -1
- package/build/data-fetching/getPrivacyPortalUrl.js +2 -2
- package/build/data-fetching/getPrivacyPortalUrl.js.map +1 -1
- package/build/data-fetching/{getStoryPublicationDate.jsx → getStoryPublicationDate.js} +2 -2
- package/build/data-fetching/getStoryPublicationDate.js.map +1 -0
- package/build/data-fetching/getUploadcareGroupUrl.js +2 -2
- package/build/data-fetching/getUploadcareGroupUrl.js.map +1 -1
- package/build/data-fetching/lib/getAlgoliaSettings.js +6 -6
- package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
- package/build/data-fetching/lib/getEnvVariables.js +24 -13
- package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
- package/build/intl/lang.js +6 -3
- package/build/intl/lang.js.map +1 -1
- package/build/intl/locale.js +14 -14
- package/build/intl/locale.js.map +1 -1
- package/build/intl/localeConfig.js +28 -7
- package/build/intl/localeConfig.js.map +1 -1
- package/build/intl/localeObject.js +41 -29
- package/build/intl/localeObject.js.map +1 -1
- package/build/newsroom-context/context.d.ts +4 -7
- package/build/newsroom-context/context.js +44 -0
- package/build/newsroom-context/context.js.map +1 -0
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +3 -3
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
- package/build/newsroom-context/hooks/useCategories.js +3 -3
- package/build/newsroom-context/hooks/useCategories.js.map +1 -1
- package/build/newsroom-context/hooks/useCompanyInformation.js +3 -3
- package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentLocale.js +3 -3
- package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +9 -9
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +17 -12
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
- package/build/newsroom-context/hooks/useLanguages.js +3 -3
- package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroom.js +3 -3
- package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroomContext.js +4 -4
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
- package/build/newsroom-context/hooks/useSelectedCategory.js +3 -3
- package/build/newsroom-context/hooks/useSelectedCategory.js.map +1 -1
- package/build/newsroom-context/hooks/useSelectedStory.d.ts +1 -1
- package/build/newsroom-context/hooks/useSelectedStory.js +3 -3
- package/build/newsroom-context/hooks/useSelectedStory.js.map +1 -1
- package/build/types.d.ts +2 -2
- package/package.json +1 -1
- package/src/data-fetching/api/queries.ts +2 -2
- package/src/newsroom-context/context.tsx +8 -8
- package/src/newsroom-context/hooks/useGetTranslationUrl.ts +2 -2
- package/src/types.ts +2 -1
- package/build/data-fetching/getStoryPublicationDate.jsx.map +0 -1
- package/build/newsroom-context/context.jsx +0 -26
- package/build/newsroom-context/context.jsx.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSelectedStory = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
+
var useSelectedStory = function () {
|
|
6
|
+
var context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
7
7
|
return context.selectedStory;
|
|
8
8
|
};
|
|
9
9
|
exports.useSelectedStory = useSelectedStory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectedStory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSelectedStory.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"useSelectedStory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSelectedStory.ts"],"names":[],"mappings":";;;AAAA,2DAA0D;AAEnD,IAAM,gBAAgB,GAAG;IAC5B,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,aAAa,CAAC;AACjC,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B"}
|
package/build/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AlgoliaSettings } from './data-fetching';
|
|
2
|
-
import type { Category, CultureRef, ExtraStoryFields, Newsroom, NewsroomCompanyInformation, NewsroomContact, NewsroomLanguageSettings, NewsroomThemePreset, Story } from '@prezly/sdk';
|
|
2
|
+
import type { Category, CultureRef, ExtendedStory, ExtraStoryFields, Newsroom, NewsroomCompanyInformation, NewsroomContact, NewsroomLanguageSettings, NewsroomThemePreset, Story } from '@prezly/sdk';
|
|
3
3
|
export interface BasePageProps {
|
|
4
4
|
newsroom: Newsroom;
|
|
5
5
|
companyInformation: NewsroomCompanyInformation;
|
|
@@ -17,7 +17,7 @@ export interface BasePageProps {
|
|
|
17
17
|
contacts?: NewsroomContact[];
|
|
18
18
|
isTrackingEnabled?: boolean;
|
|
19
19
|
selectedCategory?: Category;
|
|
20
|
-
selectedStory?:
|
|
20
|
+
selectedStory?: ExtendedStory;
|
|
21
21
|
}
|
|
22
22
|
export interface AlgoliaCategoryRef {
|
|
23
23
|
id: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const publishedAndAccessible = [
|
|
2
|
-
{ lifecycle_status: { $in: ['published'] } },
|
|
3
|
-
{ visibility: { $in: ['public', 'private'] } },
|
|
2
|
+
{ lifecycle_status: { $in: ['published', 'embargo'] } },
|
|
3
|
+
{ visibility: { $in: ['public', 'private', 'embargo'] } },
|
|
4
4
|
];
|
|
5
5
|
|
|
6
6
|
const publishedAndPublic = [
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
Category,
|
|
3
|
+
ExtendedStory,
|
|
3
4
|
Newsroom,
|
|
4
5
|
NewsroomCompanyInformation,
|
|
5
6
|
NewsroomContact,
|
|
6
7
|
NewsroomLanguageSettings,
|
|
7
8
|
NewsroomThemePreset,
|
|
8
|
-
Story,
|
|
9
9
|
} from '@prezly/sdk';
|
|
10
|
-
import { createContext, FunctionComponent, useMemo } from 'react';
|
|
10
|
+
import React, { createContext, FunctionComponent, useMemo } from 'react';
|
|
11
11
|
|
|
12
12
|
import type { AlgoliaSettings } from '../data-fetching';
|
|
13
|
-
import { LocaleObject } from '../intl';
|
|
14
|
-
import { Translations } from '../types';
|
|
13
|
+
import { DEFAULT_LOCALE, LocaleObject } from '../intl';
|
|
15
14
|
|
|
16
15
|
export interface INewsroomContext {
|
|
17
16
|
newsroom: Newsroom;
|
|
@@ -19,7 +18,7 @@ export interface INewsroomContext {
|
|
|
19
18
|
categories: Category[];
|
|
20
19
|
contacts?: NewsroomContact[];
|
|
21
20
|
selectedCategory?: Category;
|
|
22
|
-
selectedStory?:
|
|
21
|
+
selectedStory?: ExtendedStory;
|
|
23
22
|
languages: NewsroomLanguageSettings[];
|
|
24
23
|
locale: LocaleObject;
|
|
25
24
|
hasError?: boolean;
|
|
@@ -28,9 +27,7 @@ export interface INewsroomContext {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
interface Props extends Omit<INewsroomContext, 'locale'> {
|
|
31
|
-
isTrackingEnabled?: boolean;
|
|
32
30
|
localeCode: string;
|
|
33
|
-
translations?: Translations;
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
export const NewsroomContext = createContext<INewsroomContext | undefined>(undefined);
|
|
@@ -49,7 +46,10 @@ export const NewsroomContextProvider: FunctionComponent<Props> = ({
|
|
|
49
46
|
algoliaSettings,
|
|
50
47
|
children,
|
|
51
48
|
}) => {
|
|
52
|
-
const locale = useMemo(
|
|
49
|
+
const locale = useMemo(
|
|
50
|
+
() => LocaleObject.fromAnyCode(localeCode || DEFAULT_LOCALE),
|
|
51
|
+
[localeCode],
|
|
52
|
+
);
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
55
|
<NewsroomContext.Provider
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Category,
|
|
1
|
+
import type { Category, ExtendedStory } from '@prezly/sdk';
|
|
2
2
|
import { useRouter } from 'next/router';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ function getTranslationUrl(
|
|
|
13
13
|
locale: LocaleObject,
|
|
14
14
|
path: string,
|
|
15
15
|
selectedCategory?: Category,
|
|
16
|
-
selectedStory?:
|
|
16
|
+
selectedStory?: ExtendedStory,
|
|
17
17
|
noFallback?: boolean,
|
|
18
18
|
) {
|
|
19
19
|
if (selectedCategory) {
|
package/src/types.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { AlgoliaSettings } from './data-fetching';
|
|
|
3
3
|
import type {
|
|
4
4
|
Category,
|
|
5
5
|
CultureRef,
|
|
6
|
+
ExtendedStory,
|
|
6
7
|
ExtraStoryFields,
|
|
7
8
|
Newsroom,
|
|
8
9
|
NewsroomCompanyInformation,
|
|
@@ -29,7 +30,7 @@ export interface BasePageProps {
|
|
|
29
30
|
contacts?: NewsroomContact[];
|
|
30
31
|
isTrackingEnabled?: boolean;
|
|
31
32
|
selectedCategory?: Category;
|
|
32
|
-
selectedStory?:
|
|
33
|
+
selectedStory?: ExtendedStory;
|
|
33
34
|
}
|
|
34
35
|
export interface AlgoliaCategoryRef {
|
|
35
36
|
id: number;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getStoryPublicationDate.jsx","sourceRoot":"","sources":["../../src/data-fetching/getStoryPublicationDate.tsx"],"names":[],"mappings":";;;AAIA,SAAgB,uBAAuB,CAAC,KAA2B;IAC/D,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE/B,IAAI,CAAC,YAAY,EAAE;QACf,OAAO,IAAI,CAAC;KACf;IAED,OAAO,OAAO,YAAY,KAAK,QAAQ;QACnC,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC;QACxB,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;AACxC,CAAC;AAVD,0DAUC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NewsroomContextProvider = exports.NewsroomContext = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const intl_1 = require("../intl");
|
|
6
|
-
exports.NewsroomContext = (0, react_1.createContext)(undefined);
|
|
7
|
-
const NewsroomContextProvider = ({ categories, contacts, newsroom, selectedCategory, selectedStory, companyInformation, languages, localeCode, hasError, themePreset, algoliaSettings, children, }) => {
|
|
8
|
-
const locale = (0, react_1.useMemo)(() => intl_1.LocaleObject.fromAnyCode(localeCode || 'en'), [localeCode]);
|
|
9
|
-
return (<exports.NewsroomContext.Provider value={{
|
|
10
|
-
categories,
|
|
11
|
-
contacts,
|
|
12
|
-
newsroom,
|
|
13
|
-
selectedCategory,
|
|
14
|
-
selectedStory,
|
|
15
|
-
companyInformation,
|
|
16
|
-
languages,
|
|
17
|
-
locale,
|
|
18
|
-
hasError,
|
|
19
|
-
themePreset,
|
|
20
|
-
algoliaSettings,
|
|
21
|
-
}}>
|
|
22
|
-
{children}
|
|
23
|
-
</exports.NewsroomContext.Provider>);
|
|
24
|
-
};
|
|
25
|
-
exports.NewsroomContextProvider = NewsroomContextProvider;
|
|
26
|
-
//# sourceMappingURL=context.jsx.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.jsx","sourceRoot":"","sources":["../../src/newsroom-context/context.tsx"],"names":[],"mappings":";;;AASA,iCAAkE;AAGlE,kCAAuC;AAuB1B,QAAA,eAAe,GAAG,IAAA,qBAAa,EAA+B,SAAS,CAAC,CAAC;AAE/E,MAAM,uBAAuB,GAA6B,CAAC,EAC9D,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,WAAW,EACX,eAAe,EACf,QAAQ,GACX,EAAE,EAAE;IACD,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,mBAAY,CAAC,WAAW,CAAC,UAAU,IAAI,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzF,OAAO,CACH,CAAC,uBAAe,CAAC,QAAQ,CACrB,KAAK,CAAC,CAAC;YACH,UAAU;YACV,QAAQ;YACR,QAAQ;YACR,gBAAgB;YAChB,aAAa;YACb,kBAAkB;YAClB,SAAS;YACT,MAAM;YACN,QAAQ;YACR,WAAW;YACX,eAAe;SAClB,CAAC,CAEF;YAAA,CAAC,QAAQ,CACb;QAAA,EAAE,uBAAe,CAAC,QAAQ,CAAC,CAC9B,CAAC;AACN,CAAC,CAAC;AAnCW,QAAA,uBAAuB,2BAmClC"}
|