@prezly/theme-kit-nextjs 1.0.0 → 1.1.0
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/getBasePageProps.js +7 -3
- package/build/adapter-nextjs/getBasePageProps.js.map +1 -1
- package/build/adapter-nextjs/index.js +14 -2
- package/build/adapter-nextjs/index.js.map +1 -1
- package/build/adapter-nextjs/processRequest.js +7 -3
- package/build/adapter-nextjs/processRequest.js.map +1 -1
- package/build/data-fetching/api/PrezlyApi.js +33 -26
- package/build/data-fetching/api/PrezlyApi.js.map +1 -1
- package/build/data-fetching/api/getPrezlyApi.js +9 -5
- package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
- package/build/data-fetching/api/index.js +14 -2
- package/build/data-fetching/api/index.js.map +1 -1
- package/build/data-fetching/api/languages.js +26 -17
- package/build/data-fetching/api/languages.js.map +1 -1
- package/build/data-fetching/api/queries.js +13 -5
- package/build/data-fetching/api/queries.js.map +1 -1
- package/build/data-fetching/constants.js +5 -2
- package/build/data-fetching/constants.js.map +1 -1
- package/build/data-fetching/getAssetsUrl.js +7 -3
- package/build/data-fetching/getAssetsUrl.js.map +1 -1
- package/build/data-fetching/getLocalizedCategoryData.js +9 -3
- package/build/data-fetching/getLocalizedCategoryData.js.map +1 -1
- package/build/data-fetching/getNewsroomLogoUrl.js +10 -5
- package/build/data-fetching/getNewsroomLogoUrl.js.map +1 -1
- package/build/data-fetching/getPrivacyPortalUrl.js +5 -1
- package/build/data-fetching/getPrivacyPortalUrl.js.map +1 -1
- package/build/data-fetching/getStoryPublicationDate.jsx +5 -1
- package/build/data-fetching/getStoryPublicationDate.jsx.map +1 -1
- package/build/data-fetching/getUploadcareGroupUrl.js +7 -3
- package/build/data-fetching/getUploadcareGroupUrl.js.map +1 -1
- package/build/data-fetching/index.js +21 -9
- package/build/data-fetching/index.js.map +1 -1
- package/build/data-fetching/lib/getAlgoliaSettings.js +7 -3
- package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
- package/build/data-fetching/lib/getEnvVariables.js +10 -3
- package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
- package/build/data-fetching/types.js +2 -1
- package/build/index.js +17 -5
- package/build/index.js.map +1 -1
- package/build/intl/index.js +21 -4
- package/build/intl/index.js.map +1 -1
- package/build/intl/lang.js +5 -1
- package/build/intl/lang.js.map +1 -1
- package/build/intl/locale.js +17 -11
- package/build/intl/locale.js.map +1 -1
- package/build/intl/localeObject.js +10 -3
- package/build/intl/localeObject.js.map +1 -1
- package/build/newsroom-context/context.jsx +11 -7
- package/build/newsroom-context/context.jsx.map +1 -1
- package/build/newsroom-context/hooks/index.js +23 -11
- package/build/newsroom-context/hooks/index.js.map +1 -1
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +7 -3
- package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
- package/build/newsroom-context/hooks/useCategories.js +7 -3
- package/build/newsroom-context/hooks/useCategories.js.map +1 -1
- package/build/newsroom-context/hooks/useCompanyInformation.js +7 -3
- package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
- package/build/newsroom-context/hooks/useCurrentLocale.js +7 -3
- package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +15 -11
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +16 -12
- package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
- package/build/newsroom-context/hooks/useLanguages.js +7 -3
- package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroom.js +7 -3
- package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
- package/build/newsroom-context/hooks/useNewsroomContext.js +8 -4
- package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
- package/build/newsroom-context/hooks/useSelectedCategory.js +7 -3
- package/build/newsroom-context/hooks/useSelectedCategory.js.map +1 -1
- package/build/newsroom-context/hooks/useSelectedStory.js +7 -3
- package/build/newsroom-context/hooks/useSelectedStory.js.map +1 -1
- package/build/newsroom-context/index.js +17 -2
- package/build/newsroom-context/index.js.map +1 -1
- package/build/types.d.ts +2 -6
- package/build/types.js +2 -1
- package/package.json +1 -1
- package/src/types.ts +2 -9
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGetTranslationUrl = void 0;
|
|
4
|
+
const router_1 = require("next/router");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const data_fetching_1 = require("../../data-fetching");
|
|
7
|
+
const useSelectedCategory_1 = require("./useSelectedCategory");
|
|
8
|
+
const useSelectedStory_1 = require("./useSelectedStory");
|
|
6
9
|
// Determine correct URL for translated stories/categories with a fallback to homepage
|
|
7
10
|
function getTranslationUrl(locale, path, selectedCategory, selectedStory, noFallback) {
|
|
8
11
|
if (selectedCategory) {
|
|
9
|
-
if (getCategoryHasTranslation(selectedCategory, locale)) {
|
|
10
|
-
return getCategoryUrl(selectedCategory, locale);
|
|
12
|
+
if ((0, data_fetching_1.getCategoryHasTranslation)(selectedCategory, locale)) {
|
|
13
|
+
return (0, data_fetching_1.getCategoryUrl)(selectedCategory, locale);
|
|
11
14
|
}
|
|
12
15
|
if (noFallback) {
|
|
13
16
|
return '';
|
|
@@ -27,10 +30,11 @@ function getTranslationUrl(locale, path, selectedCategory, selectedStory, noFall
|
|
|
27
30
|
}
|
|
28
31
|
return path;
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
const { asPath } = useRouter();
|
|
32
|
-
const selectedCategory = useSelectedCategory();
|
|
33
|
-
const selectedStory = useSelectedStory();
|
|
34
|
-
return useCallback((locale, noFallback) => getTranslationUrl(locale, asPath, selectedCategory, selectedStory, noFallback), [asPath, selectedCategory, selectedStory]);
|
|
33
|
+
function useGetTranslationUrl() {
|
|
34
|
+
const { asPath } = (0, router_1.useRouter)();
|
|
35
|
+
const selectedCategory = (0, useSelectedCategory_1.useSelectedCategory)();
|
|
36
|
+
const selectedStory = (0, useSelectedStory_1.useSelectedStory)();
|
|
37
|
+
return (0, react_1.useCallback)((locale, noFallback) => getTranslationUrl(locale, asPath, selectedCategory, selectedStory, noFallback), [asPath, selectedCategory, selectedStory]);
|
|
35
38
|
}
|
|
39
|
+
exports.useGetTranslationUrl = useGetTranslationUrl;
|
|
36
40
|
//# sourceMappingURL=useGetTranslationUrl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetTranslationUrl.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetTranslationUrl.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"useGetTranslationUrl.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetTranslationUrl.ts"],"names":[],"mappings":";;;AACA,wCAAwC;AACxC,iCAAoC;AAEpC,uDAAgF;AAGhF,+DAA4D;AAC5D,yDAAsD;AAEtD,sFAAsF;AACtF,SAAS,iBAAiB,CACtB,MAAoB,EACpB,IAAY,EACZ,gBAA2B,EAC3B,aAAqB,EACrB,UAAoB;IAEpB,IAAI,gBAAgB,EAAE;QAClB,IAAI,IAAA,yCAAyB,EAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE;YACrD,OAAO,IAAA,8BAAc,EAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;SACnD;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,aAAa,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC9D,MAAM,eAAe,GAAG,aAAa,CAAC,YAAY,CAAC,IAAI,CACnD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,CACjD,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,SAAgB,oBAAoB;IAChC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;IAC/B,MAAM,gBAAgB,GAAG,IAAA,yCAAmB,GAAE,CAAC;IAC/C,MAAM,aAAa,GAAG,IAAA,mCAAgB,GAAE,CAAC;IAEzC,OAAO,IAAA,mBAAW,EACd,CAAC,MAAoB,EAAE,UAAoB,EAAE,EAAE,CAC3C,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,CAAC,EAClF,CAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAC5C,CAAC;AACN,CAAC;AAVD,oDAUC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLanguages = void 0;
|
|
4
|
+
const useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
+
const useLanguages = () => {
|
|
6
|
+
const context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
4
7
|
return context.languages;
|
|
5
8
|
};
|
|
9
|
+
exports.useLanguages = useLanguages;
|
|
6
10
|
//# sourceMappingURL=useLanguages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLanguages.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useLanguages.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"useLanguages.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useLanguages.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAEnD,MAAM,YAAY,GAAG,GAAG,EAAE;IAC7B,MAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,SAAS,CAAC;AAC7B,CAAC,CAAC;AAJW,QAAA,YAAY,gBAIvB"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useNewsroom = void 0;
|
|
4
|
+
const useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
+
const useNewsroom = () => {
|
|
6
|
+
const context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
4
7
|
return context.newsroom;
|
|
5
8
|
};
|
|
9
|
+
exports.useNewsroom = useNewsroom;
|
|
6
10
|
//# sourceMappingURL=useNewsroom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNewsroom.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroom.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"useNewsroom.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroom.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAEnD,MAAM,WAAW,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,QAAQ,CAAC;AAC5B,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useNewsroomContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
const useNewsroomContext = () => {
|
|
4
7
|
// TS Compiler is having a hard time figuring this type implicitly, so we have to set it explicitly
|
|
5
8
|
// See https://github.com/microsoft/TypeScript/issues/5711#issuecomment-340283439
|
|
6
|
-
const newsroomContext = useContext(NewsroomContext);
|
|
9
|
+
const newsroomContext = (0, react_1.useContext)(context_1.NewsroomContext);
|
|
7
10
|
if (!newsroomContext) {
|
|
8
11
|
throw new Error('No `NewsroomContextProvider` found when calling `useNewsroomContext`');
|
|
9
12
|
}
|
|
10
13
|
return newsroomContext;
|
|
11
14
|
};
|
|
15
|
+
exports.useNewsroomContext = useNewsroomContext;
|
|
12
16
|
//# sourceMappingURL=useNewsroomContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNewsroomContext.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroomContext.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"useNewsroomContext.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroomContext.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC,wCAA+D;AAExD,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACnC,mGAAmG;IACnG,iFAAiF;IACjF,MAAM,eAAe,GAAiC,IAAA,kBAAU,EAAC,yBAAe,CAAC,CAAC;IAClF,IAAI,CAAC,eAAe,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;KAC3F;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSelectedCategory = void 0;
|
|
4
|
+
const useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
+
const useSelectedCategory = () => {
|
|
6
|
+
const context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
4
7
|
return context.selectedCategory;
|
|
5
8
|
};
|
|
9
|
+
exports.useSelectedCategory = useSelectedCategory;
|
|
6
10
|
//# sourceMappingURL=useSelectedCategory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectedCategory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSelectedCategory.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"useSelectedCategory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSelectedCategory.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAEnD,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACpC,MAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,gBAAgB,CAAC;AACpC,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSelectedStory = void 0;
|
|
4
|
+
const useNewsroomContext_1 = require("./useNewsroomContext");
|
|
5
|
+
const useSelectedStory = () => {
|
|
6
|
+
const context = (0, useNewsroomContext_1.useNewsroomContext)();
|
|
4
7
|
return context.selectedStory;
|
|
5
8
|
};
|
|
9
|
+
exports.useSelectedStory = useSelectedStory;
|
|
6
10
|
//# sourceMappingURL=useSelectedStory.js.map
|
|
@@ -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,6DAA0D;AAEnD,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACjC,MAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,aAAa,CAAC;AACjC,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B"}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.NewsroomContextProvider = exports.NewsroomContext = void 0;
|
|
14
|
+
var context_1 = require("./context");
|
|
15
|
+
Object.defineProperty(exports, "NewsroomContext", { enumerable: true, get: function () { return context_1.NewsroomContext; } });
|
|
16
|
+
Object.defineProperty(exports, "NewsroomContextProvider", { enumerable: true, get: function () { return context_1.NewsroomContextProvider; } });
|
|
17
|
+
__exportStar(require("./hooks"), exports);
|
|
3
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/newsroom-context/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/newsroom-context/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAqE;AAA5D,0GAAA,eAAe,OAAA;AAAE,kHAAA,uBAAuB,OAAA;AACjD,0CAAwB"}
|
package/build/types.d.ts
CHANGED
|
@@ -16,13 +16,9 @@ export interface BasePageProps {
|
|
|
16
16
|
translations?: Translations;
|
|
17
17
|
contacts?: NewsroomContact[];
|
|
18
18
|
isTrackingEnabled?: boolean;
|
|
19
|
+
selectedCategory?: Category;
|
|
20
|
+
selectedStory?: Story;
|
|
19
21
|
}
|
|
20
|
-
export interface PaginationProps {
|
|
21
|
-
itemsTotal: number;
|
|
22
|
-
currentPage: number;
|
|
23
|
-
pageSize: number;
|
|
24
|
-
}
|
|
25
|
-
export declare type StoryWithImage = Story & Pick<ExtraStoryFields, 'thumbnail_image'>;
|
|
26
22
|
export interface AlgoliaCategoryRef {
|
|
27
23
|
id: number;
|
|
28
24
|
name: string;
|
package/build/types.js
CHANGED
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -28,16 +28,9 @@ export interface BasePageProps {
|
|
|
28
28
|
translations?: Translations;
|
|
29
29
|
contacts?: NewsroomContact[];
|
|
30
30
|
isTrackingEnabled?: boolean;
|
|
31
|
+
selectedCategory?: Category;
|
|
32
|
+
selectedStory?: Story;
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
export interface PaginationProps {
|
|
34
|
-
itemsTotal: number;
|
|
35
|
-
currentPage: number;
|
|
36
|
-
pageSize: number;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type StoryWithImage = Story & Pick<ExtraStoryFields, 'thumbnail_image'>;
|
|
40
|
-
|
|
41
34
|
export interface AlgoliaCategoryRef {
|
|
42
35
|
id: number;
|
|
43
36
|
name: string;
|