@prezly/theme-kit-nextjs 2.0.1-1 → 2.0.1-2
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/@types/global.d.js +1 -1
- package/build/adapter-nextjs/api-handlers/fetchGalleries.js +3 -9
- package/build/adapter-nextjs/api-handlers/fetchStories.js +3 -9
- package/build/adapter-nextjs/api-handlers/index.js +2 -19
- package/build/adapter-nextjs/getNewsroomServerSideProps.js +3 -9
- package/build/adapter-nextjs/getNewsroomStaticProps.js +3 -9
- package/build/adapter-nextjs/index.js +6 -71
- package/build/adapter-nextjs/page-props/category.js +19 -27
- package/build/adapter-nextjs/page-props/gallery.js +13 -20
- package/build/adapter-nextjs/page-props/galleryAlbum.js +13 -21
- package/build/adapter-nextjs/page-props/home.js +13 -20
- package/build/adapter-nextjs/page-props/index.js +8 -138
- package/build/adapter-nextjs/page-props/lib/types.js +1 -1
- package/build/adapter-nextjs/page-props/search.js +10 -17
- package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +2 -9
- package/build/adapter-nextjs/page-props/sitemap/createPaths.js +1 -7
- package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +7 -13
- package/build/adapter-nextjs/page-props/sitemap/index.js +4 -43
- package/build/adapter-nextjs/page-props/sitemap/types.js +1 -1
- package/build/adapter-nextjs/page-props/story.js +17 -25
- package/build/adapter-nextjs/page-props/storyPreview.js +7 -13
- package/build/adapter-nextjs/processRequest.js +5 -11
- package/build/adapter-nextjs/processStaticRequest.js +1 -7
- package/build/components-nextjs/PageSeo/PageSeo.js +24 -30
- package/build/components-nextjs/PageSeo/index.js +2 -27
- package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +1 -7
- package/build/components-nextjs/PageSeo/lib/types.js +1 -1
- package/build/components-nextjs/StorySeo/StorySeo.js +6 -12
- package/build/components-nextjs/StorySeo/index.js +1 -12
- package/build/components-nextjs/document.d.ts +4 -2
- package/build/components-nextjs/document.js +13 -19
- package/build/components-nextjs/document.js.map +1 -1
- package/build/components-nextjs/index.js +3 -26
- package/build/data-fetching/api/PrezlyApi.js +30 -37
- package/build/data-fetching/api/getPrezlyApi.js +5 -11
- package/build/data-fetching/api/index.js +1 -16
- package/build/data-fetching/api/queries.js +5 -15
- package/build/data-fetching/index.js +3 -38
- package/build/data-fetching/lib/getAlgoliaSettings.js +3 -9
- package/build/data-fetching/lib/getEnvVariables.js +3 -10
- package/build/data-fetching/lib/index.js +4 -33
- package/build/data-fetching/lib/isSdkError.js +1 -7
- package/build/data-fetching/lib/isUuid.js +1 -7
- package/build/data-fetching/types.js +1 -1
- package/build/index.js +9 -104
- package/build/infinite-loading/index.js +4 -43
- package/build/infinite-loading/types.js +1 -1
- package/build/infinite-loading/useInfiniteGalleriesLoading.js +3 -9
- package/build/infinite-loading/useInfiniteLoading.js +9 -15
- package/build/infinite-loading/useInfiniteStoriesLoading.js +7 -13
- package/build/intl/index.js +4 -49
- package/build/intl/languages.js +23 -39
- package/build/intl/locale.js +10 -20
- package/build/intl/localeConfig.js +5 -14
- package/build/intl/localeList.js +1 -8
- package/build/intl/localeObject.js +4 -11
- package/build/newsroom-context/context.js +5 -13
- package/build/newsroom-context/hooks/index.js +11 -126
- package/build/newsroom-context/hooks/useAlgoliaSettings.js +3 -9
- package/build/newsroom-context/hooks/useCategories.js +3 -9
- package/build/newsroom-context/hooks/useCompanyInformation.js +3 -9
- package/build/newsroom-context/hooks/useCurrentCategory.js +3 -9
- package/build/newsroom-context/hooks/useCurrentLocale.js +3 -9
- package/build/newsroom-context/hooks/useCurrentStory.js +3 -9
- package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +10 -16
- package/build/newsroom-context/hooks/useGetTranslationUrl.js +20 -26
- package/build/newsroom-context/hooks/useLanguages.js +3 -9
- package/build/newsroom-context/hooks/useNewsroom.js +3 -9
- package/build/newsroom-context/hooks/useNewsroomContext.js +4 -10
- package/build/newsroom-context/index.js +2 -34
- package/build/sentry/client.js +3 -9
- package/build/sentry/common.js +1 -7
- package/build/sentry/index.js +2 -19
- package/build/sentry/server.js +3 -9
- package/build/types.js +1 -1
- package/build/utils/boilerplate.js +3 -11
- package/build/utils/constants.js +3 -12
- package/build/utils/getAssetsUrl.js +3 -9
- package/build/utils/getDataRequestLink.js +3 -9
- package/build/utils/getLocalizedCategoryData.js +3 -11
- package/build/utils/getNewsroomLogoUrl.js +5 -12
- package/build/utils/getPrivacyPortalUrl.js +1 -7
- package/build/utils/getStoryPublicationDate.js +1 -7
- package/build/utils/getUploadcareGroupUrl.js +3 -9
- package/build/utils/index.js +10 -115
- package/build/utils/isEmbargoStory.js +1 -7
- package/package.json +3 -2
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useAlgoliaSettings = useAlgoliaSettings;
|
|
7
|
-
var _useNewsroomContext = require("./useNewsroomContext.js");
|
|
8
|
-
function useAlgoliaSettings() {
|
|
9
|
-
const context = (0, _useNewsroomContext.useNewsroomContext)();
|
|
1
|
+
import { useNewsroomContext } from "./useNewsroomContext.js";
|
|
2
|
+
export function useAlgoliaSettings() {
|
|
3
|
+
const context = useNewsroomContext();
|
|
10
4
|
return context.algoliaSettings;
|
|
11
5
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useCategories = useCategories;
|
|
7
|
-
var _useNewsroomContext = require("./useNewsroomContext.js");
|
|
8
|
-
function useCategories() {
|
|
9
|
-
const context = (0, _useNewsroomContext.useNewsroomContext)();
|
|
1
|
+
import { useNewsroomContext } from "./useNewsroomContext.js";
|
|
2
|
+
export function useCategories() {
|
|
3
|
+
const context = useNewsroomContext();
|
|
10
4
|
return context.categories;
|
|
11
5
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useCompanyInformation = useCompanyInformation;
|
|
7
|
-
var _useNewsroomContext = require("./useNewsroomContext.js");
|
|
8
|
-
function useCompanyInformation() {
|
|
9
|
-
const context = (0, _useNewsroomContext.useNewsroomContext)();
|
|
1
|
+
import { useNewsroomContext } from "./useNewsroomContext.js";
|
|
2
|
+
export function useCompanyInformation() {
|
|
3
|
+
const context = useNewsroomContext();
|
|
10
4
|
return context.companyInformation;
|
|
11
5
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useCurrentCategory = useCurrentCategory;
|
|
7
|
-
var _useNewsroomContext = require("./useNewsroomContext.js");
|
|
8
|
-
function useCurrentCategory() {
|
|
9
|
-
const context = (0, _useNewsroomContext.useNewsroomContext)();
|
|
1
|
+
import { useNewsroomContext } from "./useNewsroomContext.js";
|
|
2
|
+
export function useCurrentCategory() {
|
|
3
|
+
const context = useNewsroomContext();
|
|
10
4
|
return context.currentCategory;
|
|
11
5
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useCurrentLocale = useCurrentLocale;
|
|
7
|
-
var _useNewsroomContext = require("./useNewsroomContext.js");
|
|
8
|
-
function useCurrentLocale() {
|
|
9
|
-
const context = (0, _useNewsroomContext.useNewsroomContext)();
|
|
1
|
+
import { useNewsroomContext } from "./useNewsroomContext.js";
|
|
2
|
+
export function useCurrentLocale() {
|
|
3
|
+
const context = useNewsroomContext();
|
|
10
4
|
return context.locale;
|
|
11
5
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useCurrentStory = useCurrentStory;
|
|
7
|
-
var _useNewsroomContext = require("./useNewsroomContext.js");
|
|
8
|
-
function useCurrentStory() {
|
|
9
|
-
const context = (0, _useNewsroomContext.useNewsroomContext)();
|
|
1
|
+
import { useNewsroomContext } from "./useNewsroomContext.js";
|
|
2
|
+
export function useCurrentStory() {
|
|
3
|
+
const context = useNewsroomContext();
|
|
10
4
|
return context.currentStory;
|
|
11
5
|
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.useGetLinkLocaleSlug = useGetLinkLocaleSlug;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _index = require("../../intl/index.js");
|
|
9
|
-
var _useCurrentLocale = require("./useCurrentLocale.js");
|
|
10
|
-
var _useLanguages = require("./useLanguages.js");
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { getShortestLocaleCode, LocaleObject } from "../../intl/index.js";
|
|
3
|
+
import { useCurrentLocale } from "./useCurrentLocale.js";
|
|
4
|
+
import { useLanguages } from "./useLanguages.js";
|
|
11
5
|
/**
|
|
12
6
|
* Determines correct locale slug for the link (trying to shorten the locale code if possible).
|
|
13
7
|
* E.g. if newsroom has a single locale for Dutch (`nl_BE`), it will be shortened to `nl`.
|
|
@@ -15,17 +9,17 @@ var _useLanguages = require("./useLanguages.js");
|
|
|
15
9
|
* `false` means that a default locale should be used (no locale in URL required).
|
|
16
10
|
*/
|
|
17
11
|
function getLinkLocaleSlug(languages, locale) {
|
|
18
|
-
const shortestLocaleCode =
|
|
12
|
+
const shortestLocaleCode = getShortestLocaleCode(languages, locale);
|
|
19
13
|
// When navigating to default language, we don't append the locale to the URL.
|
|
20
14
|
if (!shortestLocaleCode) {
|
|
21
15
|
return shortestLocaleCode;
|
|
22
16
|
}
|
|
23
|
-
return
|
|
17
|
+
return LocaleObject.fromAnyCode(shortestLocaleCode).toUrlSlug();
|
|
24
18
|
}
|
|
25
|
-
function useGetLinkLocaleSlug() {
|
|
26
|
-
const currentLocale =
|
|
27
|
-
const languages =
|
|
19
|
+
export function useGetLinkLocaleSlug() {
|
|
20
|
+
const currentLocale = useCurrentLocale();
|
|
21
|
+
const languages = useLanguages();
|
|
28
22
|
|
|
29
23
|
// The `locale` parameter is mainly used for Language Dropdown
|
|
30
|
-
return
|
|
24
|
+
return useCallback(locale => getLinkLocaleSlug(languages, locale || currentLocale), [languages, currentLocale]);
|
|
31
25
|
}
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
var _sdk = require("@prezly/sdk");
|
|
8
|
-
var _router = require("next/router");
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _index = require("../../utils/index.js");
|
|
11
|
-
var _useCurrentCategory = require("./useCurrentCategory.js");
|
|
12
|
-
var _useCurrentStory = require("./useCurrentStory.js");
|
|
1
|
+
import { Story } from '@prezly/sdk';
|
|
2
|
+
import { useRouter } from "next/router.js";
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { getCategoryHasTranslation, getCategoryUrl } from "../../utils/index.js";
|
|
5
|
+
import { useCurrentCategory } from "./useCurrentCategory.js";
|
|
6
|
+
import { useCurrentStory } from "./useCurrentStory.js";
|
|
13
7
|
function getAllowedTranslationVisibilityValues(story) {
|
|
14
8
|
const {
|
|
15
9
|
visibility
|
|
16
10
|
} = story;
|
|
17
11
|
switch (visibility) {
|
|
18
|
-
case
|
|
19
|
-
return [
|
|
20
|
-
case
|
|
21
|
-
return [
|
|
22
|
-
case
|
|
23
|
-
return [
|
|
12
|
+
case Story.Visibility.EMBARGO:
|
|
13
|
+
return [Story.Visibility.EMBARGO, Story.Visibility.PUBLIC];
|
|
14
|
+
case Story.Visibility.PRIVATE:
|
|
15
|
+
return [Story.Visibility.PRIVATE, Story.Visibility.PUBLIC];
|
|
16
|
+
case Story.Visibility.CONFIDENTIAL:
|
|
17
|
+
return [Story.Visibility.CONFIDENTIAL, Story.Visibility.PRIVATE, Story.Visibility.PUBLIC];
|
|
24
18
|
default:
|
|
25
|
-
return [
|
|
19
|
+
return [Story.Visibility.PUBLIC];
|
|
26
20
|
}
|
|
27
21
|
}
|
|
28
22
|
|
|
@@ -34,8 +28,8 @@ function getAllowedTranslationVisibilityValues(story) {
|
|
|
34
28
|
*/
|
|
35
29
|
function getTranslationUrl(locale, path, currentCategory, currentStory, noFallback) {
|
|
36
30
|
if (currentCategory) {
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
31
|
+
if (getCategoryHasTranslation(currentCategory, locale)) {
|
|
32
|
+
return getCategoryUrl(currentCategory, locale);
|
|
39
33
|
}
|
|
40
34
|
if (noFallback) {
|
|
41
35
|
return '';
|
|
@@ -64,11 +58,11 @@ function getTranslationUrl(locale, path, currentCategory, currentStory, noFallba
|
|
|
64
58
|
* This hook returns a function that is meant to be used in language pickers and alternate locales list for the pages.
|
|
65
59
|
* `noFallback` parameter is useful for alternate language links in the `head` section of the document (so that there are no unwanted links to the homepage).
|
|
66
60
|
*/
|
|
67
|
-
function useGetTranslationUrl() {
|
|
61
|
+
export function useGetTranslationUrl() {
|
|
68
62
|
const {
|
|
69
63
|
asPath
|
|
70
|
-
} =
|
|
71
|
-
const currentCategory =
|
|
72
|
-
const currentStory =
|
|
73
|
-
return
|
|
64
|
+
} = useRouter();
|
|
65
|
+
const currentCategory = useCurrentCategory();
|
|
66
|
+
const currentStory = useCurrentStory();
|
|
67
|
+
return useCallback((locale, noFallback) => getTranslationUrl(locale, asPath, currentCategory, currentStory, noFallback), [asPath, currentCategory, currentStory]);
|
|
74
68
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useLanguages = useLanguages;
|
|
7
|
-
var _useNewsroomContext = require("./useNewsroomContext.js");
|
|
8
|
-
function useLanguages() {
|
|
9
|
-
const context = (0, _useNewsroomContext.useNewsroomContext)();
|
|
1
|
+
import { useNewsroomContext } from "./useNewsroomContext.js";
|
|
2
|
+
export function useLanguages() {
|
|
3
|
+
const context = useNewsroomContext();
|
|
10
4
|
return context.languages;
|
|
11
5
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useNewsroom = useNewsroom;
|
|
7
|
-
var _useNewsroomContext = require("./useNewsroomContext.js");
|
|
8
|
-
function useNewsroom() {
|
|
9
|
-
const context = (0, _useNewsroomContext.useNewsroomContext)();
|
|
1
|
+
import { useNewsroomContext } from "./useNewsroomContext.js";
|
|
2
|
+
export function useNewsroom() {
|
|
3
|
+
const context = useNewsroomContext();
|
|
10
4
|
return context.newsroom;
|
|
11
5
|
}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useNewsroomContext = useNewsroomContext;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _context = require("../context.js");
|
|
9
|
-
function useNewsroomContext() {
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { NewsroomContext } from "../context.js";
|
|
3
|
+
export function useNewsroomContext() {
|
|
10
4
|
// TS Compiler is having a hard time figuring this type implicitly, so we have to set it explicitly
|
|
11
5
|
// See https://github.com/microsoft/TypeScript/issues/5711#issuecomment-340283439
|
|
12
|
-
const newsroomContext =
|
|
6
|
+
const newsroomContext = useContext(NewsroomContext);
|
|
13
7
|
if (!newsroomContext) {
|
|
14
8
|
throw new Error('No `NewsroomContextProvider` found when calling `useNewsroomContext`');
|
|
15
9
|
}
|
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
NewsroomContext: true,
|
|
8
|
-
NewsroomContextProvider: true
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "NewsroomContext", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _context.NewsroomContext;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "NewsroomContextProvider", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return _context.NewsroomContextProvider;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
var _context = require("./context.js");
|
|
23
|
-
var _index = require("./hooks/index.js");
|
|
24
|
-
Object.keys(_index).forEach(function (key) {
|
|
25
|
-
if (key === "default" || key === "__esModule") return;
|
|
26
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
27
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
28
|
-
Object.defineProperty(exports, key, {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () {
|
|
31
|
-
return _index[key];
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
1
|
+
export { NewsroomContext, NewsroomContextProvider } from "./context.js";
|
|
2
|
+
export * from "./hooks/index.js";
|
package/build/sentry/client.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getSentryClientOptions = getSentryClientOptions;
|
|
7
|
-
var _common = require("./common.js");
|
|
8
|
-
function getSentryClientOptions(dsn, themeName) {
|
|
9
|
-
return (0, _common.getCommonClientOptions)(dsn, themeName);
|
|
1
|
+
import { getCommonClientOptions } from "./common.js";
|
|
2
|
+
export function getSentryClientOptions(dsn, themeName) {
|
|
3
|
+
return getCommonClientOptions(dsn, themeName);
|
|
10
4
|
}
|
package/build/sentry/common.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getCommonClientOptions = getCommonClientOptions;
|
|
7
|
-
function getCommonClientOptions(dsn, themeName) {
|
|
1
|
+
export function getCommonClientOptions(dsn, themeName) {
|
|
8
2
|
return {
|
|
9
3
|
dsn,
|
|
10
4
|
// Adjust this value in production, or use tracesSampler for greater control
|
package/build/sentry/index.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "getSentryClientOptions", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _client.getSentryClientOptions;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "getSentryServerOptions", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _server.getSentryServerOptions;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _client = require("./client.js");
|
|
19
|
-
var _server = require("./server.js");
|
|
1
|
+
export { getSentryClientOptions } from "./client.js";
|
|
2
|
+
export { getSentryServerOptions } from "./server.js";
|
package/build/sentry/server.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getSentryServerOptions = getSentryServerOptions;
|
|
7
|
-
var _common = require("./common.js");
|
|
8
|
-
function getSentryServerOptions(dsn, themeName) {
|
|
9
|
-
return (0, _common.getCommonClientOptions)(dsn, themeName);
|
|
1
|
+
import { getCommonClientOptions } from "./common.js";
|
|
2
|
+
export function getSentryServerOptions(dsn, themeName) {
|
|
3
|
+
return getCommonClientOptions(dsn, themeName);
|
|
10
4
|
}
|
package/build/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.hasAnyAboutInformation = hasAnyAboutInformation;
|
|
7
|
-
exports.hasAnyContactInformation = hasAnyContactInformation;
|
|
8
|
-
exports.hasAnySocialMedia = hasAnySocialMedia;
|
|
9
|
-
function hasAnySocialMedia(companyInformation) {
|
|
1
|
+
export function hasAnySocialMedia(companyInformation) {
|
|
10
2
|
return Boolean(companyInformation.facebook || companyInformation.instagram || companyInformation.linkedin || companyInformation.pinterest || companyInformation.tiktok || companyInformation.twitter || companyInformation.youtube);
|
|
11
3
|
}
|
|
12
|
-
function hasAnyAboutInformation(companyInformation) {
|
|
4
|
+
export function hasAnyAboutInformation(companyInformation) {
|
|
13
5
|
return Boolean(companyInformation.about || companyInformation.website || hasAnySocialMedia(companyInformation));
|
|
14
6
|
}
|
|
15
|
-
function hasAnyContactInformation(companyInformation) {
|
|
7
|
+
export function hasAnyContactInformation(companyInformation) {
|
|
16
8
|
return Boolean(companyInformation.address || companyInformation.phone || companyInformation.email);
|
|
17
9
|
}
|
package/build/utils/constants.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DEFAULT_PAGE_SIZE = exports.DEFAULT_GALLERY_PAGE_SIZE = exports.ASSETS_URL = void 0;
|
|
7
|
-
const ASSETS_URL = 'https://cdn.uc.assets.prezly.com';
|
|
8
|
-
exports.ASSETS_URL = ASSETS_URL;
|
|
9
|
-
const DEFAULT_PAGE_SIZE = 12;
|
|
10
|
-
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
|
11
|
-
const DEFAULT_GALLERY_PAGE_SIZE = 6;
|
|
12
|
-
exports.DEFAULT_GALLERY_PAGE_SIZE = DEFAULT_GALLERY_PAGE_SIZE;
|
|
1
|
+
export const ASSETS_URL = 'https://cdn.uc.assets.prezly.com';
|
|
2
|
+
export const DEFAULT_PAGE_SIZE = 12;
|
|
3
|
+
export const DEFAULT_GALLERY_PAGE_SIZE = 6;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getAssetsUrl = getAssetsUrl;
|
|
7
|
-
var _constants = require("./constants.js");
|
|
1
|
+
import { ASSETS_URL } from "./constants.js";
|
|
8
2
|
/**
|
|
9
3
|
* @param uuid UUID of the assets hosted on Uploadcare
|
|
10
4
|
* @returns Full asset URL that can be used as a source for <img>, <video> and <a> tags.
|
|
11
5
|
*/
|
|
12
|
-
function getAssetsUrl(uuid) {
|
|
13
|
-
return `${
|
|
6
|
+
export function getAssetsUrl(uuid) {
|
|
7
|
+
return `${ASSETS_URL}/${uuid}/`;
|
|
14
8
|
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getDataRequestLink = getDataRequestLink;
|
|
7
|
-
var _getPrivacyPortalUrl = require("./getPrivacyPortalUrl.js");
|
|
8
|
-
function getDataRequestLink(newsroom, currentLocale) {
|
|
9
|
-
return newsroom.custom_data_request_link || (0, _getPrivacyPortalUrl.getPrivacyPortalUrl)(newsroom, currentLocale, {
|
|
1
|
+
import { getPrivacyPortalUrl } from "./getPrivacyPortalUrl.js";
|
|
2
|
+
export function getDataRequestLink(newsroom, currentLocale) {
|
|
3
|
+
return newsroom.custom_data_request_link || getPrivacyPortalUrl(newsroom, currentLocale, {
|
|
10
4
|
action: 'data-request'
|
|
11
5
|
});
|
|
12
6
|
}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getCategoryHasTranslation = getCategoryHasTranslation;
|
|
7
|
-
exports.getCategoryUrl = getCategoryUrl;
|
|
8
|
-
exports.getLocalizedCategoryData = getLocalizedCategoryData;
|
|
9
1
|
function isAlgoliaCategory(category) {
|
|
10
2
|
return 'name' in category && 'slug' in category;
|
|
11
3
|
}
|
|
12
|
-
function getLocalizedCategoryData(category, locale) {
|
|
4
|
+
export function getLocalizedCategoryData(category, locale) {
|
|
13
5
|
if (isAlgoliaCategory(category)) {
|
|
14
6
|
return {
|
|
15
7
|
description: null,
|
|
@@ -29,13 +21,13 @@ function getLocalizedCategoryData(category, locale) {
|
|
|
29
21
|
} = i18n[targetLocale];
|
|
30
22
|
return localizedData;
|
|
31
23
|
}
|
|
32
|
-
function getCategoryUrl(category, locale) {
|
|
24
|
+
export function getCategoryUrl(category, locale) {
|
|
33
25
|
const {
|
|
34
26
|
slug
|
|
35
27
|
} = getLocalizedCategoryData(category, locale);
|
|
36
28
|
return `/category/${slug}`;
|
|
37
29
|
}
|
|
38
|
-
function getCategoryHasTranslation(category, locale) {
|
|
30
|
+
export function getCategoryHasTranslation(category, locale) {
|
|
39
31
|
const targetLocaleCode = locale.toUnderscoreCode();
|
|
40
32
|
const {
|
|
41
33
|
i18n
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getNewsroomFaviconUrl = getNewsroomFaviconUrl;
|
|
7
|
-
exports.getNewsroomLogoUrl = getNewsroomLogoUrl;
|
|
8
|
-
var _uploadcare = require("@prezly/uploadcare");
|
|
9
|
-
function getNewsroomLogoUrl(newsroom) {
|
|
1
|
+
import { UploadcareImage } from '@prezly/uploadcare';
|
|
2
|
+
export function getNewsroomLogoUrl(newsroom) {
|
|
10
3
|
if (newsroom.newsroom_logo) {
|
|
11
|
-
const image =
|
|
4
|
+
const image = UploadcareImage.createFromPrezlyStoragePayload(newsroom.newsroom_logo);
|
|
12
5
|
return image.cdnUrl;
|
|
13
6
|
}
|
|
14
7
|
return '';
|
|
15
8
|
}
|
|
16
|
-
function getNewsroomFaviconUrl(newsroom, previewSize = 400) {
|
|
9
|
+
export function getNewsroomFaviconUrl(newsroom, previewSize = 400) {
|
|
17
10
|
const imageObject = newsroom.icon || newsroom.square_logo;
|
|
18
11
|
if (imageObject) {
|
|
19
|
-
const image =
|
|
12
|
+
const image = UploadcareImage.createFromPrezlyStoragePayload(imageObject);
|
|
20
13
|
return image.preview(previewSize, previewSize).cdnUrl;
|
|
21
14
|
}
|
|
22
15
|
return '';
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getPrivacyPortalUrl = getPrivacyPortalUrl;
|
|
7
|
-
function getPrivacyPortalUrl(newsroom, locale, options) {
|
|
1
|
+
export function getPrivacyPortalUrl(newsroom, locale, options) {
|
|
8
2
|
const {
|
|
9
3
|
email,
|
|
10
4
|
action = 'subscribe'
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getStoryPublicationDate = getStoryPublicationDate;
|
|
7
|
-
function getStoryPublicationDate(story) {
|
|
1
|
+
export function getStoryPublicationDate(story) {
|
|
8
2
|
const {
|
|
9
3
|
published_at
|
|
10
4
|
} = story;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getUploadcareGroupUrl = getUploadcareGroupUrl;
|
|
7
|
-
var _constants = require("./constants.js");
|
|
1
|
+
import { ASSETS_URL } from "./constants.js";
|
|
8
2
|
/**
|
|
9
3
|
* This method constructs a URL to download all images in the Gallery as a single archive.
|
|
10
4
|
*
|
|
@@ -12,7 +6,7 @@ var _constants = require("./constants.js");
|
|
|
12
6
|
* @param title Filename for the saved archive. Usually it is the Gallery title.
|
|
13
7
|
* @returns URL to an archive containing all of the images in the Gallery.
|
|
14
8
|
*/
|
|
15
|
-
function getUploadcareGroupUrl(uuid, title) {
|
|
9
|
+
export function getUploadcareGroupUrl(uuid, title) {
|
|
16
10
|
// UploadCare doesn't like slashes in filenames even in encoded form.
|
|
17
|
-
return `${
|
|
11
|
+
return `${ASSETS_URL}/${uuid}/archive/zip/${encodeURIComponent(title.replace(/\//g, '_'))}.zip`;
|
|
18
12
|
}
|