@prezly/theme-kit-nextjs 1.1.2 → 1.1.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.
|
@@ -2,7 +2,6 @@ import type { Category, Newsroom, NewsroomCompanyInformation, NewsroomContact, N
|
|
|
2
2
|
import React, { FunctionComponent } from 'react';
|
|
3
3
|
import type { AlgoliaSettings } from '../data-fetching';
|
|
4
4
|
import { LocaleObject } from '../intl';
|
|
5
|
-
import { Translations } from '../types';
|
|
6
5
|
export interface INewsroomContext {
|
|
7
6
|
newsroom: Newsroom;
|
|
8
7
|
companyInformation: NewsroomCompanyInformation;
|
|
@@ -17,9 +16,7 @@ export interface INewsroomContext {
|
|
|
17
16
|
algoliaSettings: AlgoliaSettings;
|
|
18
17
|
}
|
|
19
18
|
interface Props extends Omit<INewsroomContext, 'locale'> {
|
|
20
|
-
isTrackingEnabled?: boolean;
|
|
21
19
|
localeCode: string;
|
|
22
|
-
translations?: Translations;
|
|
23
20
|
}
|
|
24
21
|
export declare const NewsroomContext: React.Context<INewsroomContext | undefined>;
|
|
25
22
|
export declare const NewsroomContextProvider: FunctionComponent<Props>;
|
|
@@ -25,7 +25,7 @@ var intl_1 = require("../intl");
|
|
|
25
25
|
exports.NewsroomContext = (0, react_1.createContext)(undefined);
|
|
26
26
|
var NewsroomContextProvider = function (_a) {
|
|
27
27
|
var categories = _a.categories, contacts = _a.contacts, newsroom = _a.newsroom, selectedCategory = _a.selectedCategory, selectedStory = _a.selectedStory, companyInformation = _a.companyInformation, languages = _a.languages, localeCode = _a.localeCode, hasError = _a.hasError, themePreset = _a.themePreset, algoliaSettings = _a.algoliaSettings, children = _a.children;
|
|
28
|
-
var locale = (0, react_1.useMemo)(function () { return intl_1.LocaleObject.fromAnyCode(localeCode ||
|
|
28
|
+
var locale = (0, react_1.useMemo)(function () { return intl_1.LocaleObject.fromAnyCode(localeCode || intl_1.DEFAULT_LOCALE); }, [localeCode]);
|
|
29
29
|
return (react_1.default.createElement(exports.NewsroomContext.Provider, { value: {
|
|
30
30
|
categories: categories,
|
|
31
31
|
contacts: contacts,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/newsroom-context/context.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AASA,6CAAyE;AAGzE,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/newsroom-context/context.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AASA,6CAAyE;AAGzE,gCAAuD;AAoB1C,QAAA,eAAe,GAAG,IAAA,qBAAa,EAA+B,SAAS,CAAC,CAAC;AAE/E,IAAM,uBAAuB,GAA6B,UAAC,EAajE;QAZG,UAAU,gBAAA,EACV,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,gBAAgB,sBAAA,EAChB,aAAa,mBAAA,EACb,kBAAkB,wBAAA,EAClB,SAAS,eAAA,EACT,UAAU,gBAAA,EACV,QAAQ,cAAA,EACR,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,8BAAC,uBAAe,CAAC,QAAQ,IACrB,KAAK,EAAE;YACH,UAAU,YAAA;YACV,QAAQ,UAAA;YACR,QAAQ,UAAA;YACR,gBAAgB,kBAAA;YAChB,aAAa,eAAA;YACb,kBAAkB,oBAAA;YAClB,SAAS,WAAA;YACT,MAAM,QAAA;YACN,QAAQ,UAAA;YACR,WAAW,aAAA;YACX,eAAe,iBAAA;SAClB,IAEA,QAAQ,CACc,CAC9B,CAAC;AACN,CAAC,CAAC;AAtCW,QAAA,uBAAuB,2BAsClC"}
|
package/package.json
CHANGED
|
@@ -10,8 +10,7 @@ import type {
|
|
|
10
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;
|
|
@@ -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
|