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