@prezly/theme-kit-core 7.1.0 → 8.0.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.
Files changed (250) hide show
  1. package/build/boilerplate.cjs +17 -0
  2. package/build/boilerplate.d.ts +8 -0
  3. package/build/boilerplate.mjs +9 -0
  4. package/build/constants.cjs +11 -0
  5. package/build/{utils/constants.d.ts → constants.d.ts} +2 -1
  6. package/build/constants.mjs +5 -0
  7. package/build/content-delivery/ContentDelivery.cjs +348 -0
  8. package/build/content-delivery/ContentDelivery.d.ts +8 -4
  9. package/build/content-delivery/ContentDelivery.mjs +342 -0
  10. package/build/content-delivery/cache/index.cjs +35 -0
  11. package/build/content-delivery/cache/index.d.ts +3 -0
  12. package/build/content-delivery/cache/index.mjs +3 -0
  13. package/build/content-delivery/cache/memory.cjs +65 -0
  14. package/build/content-delivery/cache/memory.d.ts +3 -0
  15. package/build/content-delivery/cache/memory.mjs +58 -0
  16. package/build/content-delivery/cache/memory.test.cjs +54 -0
  17. package/build/content-delivery/cache/memory.test.mjs +52 -0
  18. package/build/content-delivery/cache/stacked.cjs +32 -0
  19. package/build/content-delivery/cache/stacked.d.ts +2 -0
  20. package/build/content-delivery/cache/stacked.mjs +26 -0
  21. package/build/content-delivery/cache/type.cjs +1 -0
  22. package/build/content-delivery/cache/type.d.ts +8 -0
  23. package/build/content-delivery/cache/type.mjs +1 -0
  24. package/build/content-delivery/index.cjs +27 -0
  25. package/build/content-delivery/index.d.ts +2 -1
  26. package/build/content-delivery/index.mjs +2 -0
  27. package/build/environment.cjs +42 -0
  28. package/build/environment.d.ts +2 -0
  29. package/build/environment.mjs +36 -0
  30. package/build/galleries.cjs +38 -0
  31. package/build/galleries.d.ts +11 -0
  32. package/build/galleries.mjs +30 -0
  33. package/build/http/HttpClient.cjs +66 -0
  34. package/build/http/HttpClient.d.ts +20 -0
  35. package/build/http/HttpClient.mjs +59 -0
  36. package/build/http/index.cjs +10 -0
  37. package/build/http/index.d.ts +1 -0
  38. package/build/http/index.mjs +2 -0
  39. package/build/index.cjs +88 -0
  40. package/build/index.d.ts +15 -4
  41. package/build/index.mjs +26 -0
  42. package/build/intl/getLanguageDisplayName.cjs +37 -0
  43. package/build/intl/getLanguageDisplayName.d.ts +20 -0
  44. package/build/intl/getLanguageDisplayName.mjs +32 -0
  45. package/build/intl/getLanguageDisplayName.test.cjs +46 -0
  46. package/build/intl/getLanguageDisplayName.test.mjs +44 -0
  47. package/build/intl/index.cjs +12 -0
  48. package/build/intl/index.d.ts +1 -5
  49. package/build/intl/index.mjs +1 -0
  50. package/build/metadata/getAlternateLanguageLinks.cjs +76 -0
  51. package/build/{seo → metadata}/getAlternateLanguageLinks.d.ts +2 -2
  52. package/build/metadata/getAlternateLanguageLinks.mjs +72 -0
  53. package/build/metadata/getAlternateLanguageLinks.test.cjs +198 -0
  54. package/build/metadata/getAlternateLanguageLinks.test.mjs +196 -0
  55. package/build/metadata/index.cjs +12 -0
  56. package/build/metadata/index.d.ts +2 -0
  57. package/build/metadata/index.mjs +1 -0
  58. package/build/metadata/types.cjs +1 -0
  59. package/build/metadata/types.d.ts +6 -0
  60. package/build/metadata/types.mjs +1 -0
  61. package/build/newsrooms.cjs +36 -0
  62. package/build/newsrooms.d.ts +5 -0
  63. package/build/newsrooms.mjs +28 -0
  64. package/build/privacy-portal.cjs +28 -0
  65. package/build/privacy-portal.d.ts +9 -0
  66. package/build/privacy-portal.mjs +21 -0
  67. package/build/resolvable.cjs +38 -0
  68. package/build/resolvable.d.ts +71 -0
  69. package/build/resolvable.mjs +32 -0
  70. package/build/routing/Route.cjs +46 -0
  71. package/build/routing/Route.d.ts +37 -0
  72. package/build/routing/Route.mjs +40 -0
  73. package/build/routing/Router.cjs +51 -0
  74. package/build/routing/Router.d.ts +23 -0
  75. package/build/routing/Router.mjs +45 -0
  76. package/build/routing/Routing.cjs +24 -0
  77. package/build/routing/Routing.d.ts +1 -0
  78. package/build/routing/Routing.mjs +2 -0
  79. package/build/routing/UrlGenerator.cjs +13 -0
  80. package/build/routing/UrlGenerator.d.ts +39 -0
  81. package/build/routing/UrlGenerator.mjs +7 -0
  82. package/build/routing/index.cjs +24 -0
  83. package/build/routing/index.d.ts +4 -0
  84. package/build/routing/index.mjs +4 -0
  85. package/build/routing/types.cjs +1 -0
  86. package/build/routing/types.d.ts +14 -0
  87. package/build/routing/types.mjs +1 -0
  88. package/build/routing/utils/generateUrlFromPattern.cjs +52 -0
  89. package/build/routing/utils/generateUrlFromPattern.d.ts +12 -0
  90. package/build/routing/utils/generateUrlFromPattern.mjs +47 -0
  91. package/build/routing/utils/generateUrlFromPattern.test.cjs +44 -0
  92. package/build/routing/utils/generateUrlFromPattern.test.mjs +42 -0
  93. package/build/routing/utils/getShortestLocaleSlug.cjs +60 -0
  94. package/build/routing/utils/getShortestLocaleSlug.d.ts +11 -0
  95. package/build/routing/utils/getShortestLocaleSlug.mjs +53 -0
  96. package/build/routing/utils/getShortestLocaleSlug.test.cjs +37 -0
  97. package/build/routing/utils/getShortestLocaleSlug.test.mjs +35 -0
  98. package/build/routing/utils/index.cjs +40 -0
  99. package/build/routing/utils/index.d.ts +5 -0
  100. package/build/routing/utils/index.mjs +5 -0
  101. package/build/routing/utils/isNumberCode.cjs +12 -0
  102. package/build/routing/utils/isNumberCode.d.ts +4 -0
  103. package/build/routing/utils/isNumberCode.mjs +6 -0
  104. package/build/routing/utils/matchLocaleSlug.cjs +41 -0
  105. package/build/routing/utils/matchLocaleSlug.d.ts +15 -0
  106. package/build/routing/utils/matchLocaleSlug.mjs +34 -0
  107. package/build/routing/utils/matchLocaleSlug.test.cjs +43 -0
  108. package/build/routing/utils/matchLocaleSlug.test.mjs +40 -0
  109. package/build/routing/utils/normalizeUrl.cjs +9 -0
  110. package/build/routing/utils/normalizeUrl.d.ts +1 -0
  111. package/build/routing/utils/normalizeUrl.mjs +3 -0
  112. package/build/search.cjs +1 -0
  113. package/build/{types.d.ts → search.d.ts} +3 -3
  114. package/build/search.mjs +1 -0
  115. package/build/sitemap/build.cjs +33 -0
  116. package/build/sitemap/build.d.ts +6 -0
  117. package/build/sitemap/build.mjs +27 -0
  118. package/build/sitemap/generate.cjs +192 -0
  119. package/build/sitemap/generate.d.ts +37 -0
  120. package/build/sitemap/generate.mjs +183 -0
  121. package/build/sitemap/index.cjs +38 -0
  122. package/build/sitemap/index.d.ts +4 -0
  123. package/build/sitemap/index.mjs +3 -0
  124. package/build/sitemap/stringify.cjs +24 -0
  125. package/build/sitemap/stringify.d.ts +2 -0
  126. package/build/sitemap/stringify.mjs +18 -0
  127. package/build/sitemap/types.cjs +1 -0
  128. package/build/sitemap/types.d.ts +67 -0
  129. package/build/sitemap/types.mjs +1 -0
  130. package/build/uploads.cjs +14 -0
  131. package/build/{utils/getAssetsUrl.d.ts → uploads.d.ts} +1 -1
  132. package/build/uploads.mjs +8 -0
  133. package/build/uploads.test.cjs +10 -0
  134. package/build/uploads.test.mjs +8 -0
  135. package/package.json +23 -26
  136. package/build/content-delivery/ContentDelivery.js +0 -238
  137. package/build/content-delivery/ContentDelivery.js.map +0 -1
  138. package/build/content-delivery/index.js +0 -28
  139. package/build/content-delivery/index.js.map +0 -1
  140. package/build/data-fetching/api/index.d.ts +0 -1
  141. package/build/data-fetching/api/index.js +0 -6
  142. package/build/data-fetching/api/index.js.map +0 -1
  143. package/build/data-fetching/api/initContentDeliveryClient.d.ts +0 -4
  144. package/build/data-fetching/api/initContentDeliveryClient.js +0 -25
  145. package/build/data-fetching/api/initContentDeliveryClient.js.map +0 -1
  146. package/build/data-fetching/index.d.ts +0 -3
  147. package/build/data-fetching/index.js +0 -20
  148. package/build/data-fetching/index.js.map +0 -1
  149. package/build/data-fetching/lib/getAlgoliaSettings.d.ts +0 -4
  150. package/build/data-fetching/lib/getAlgoliaSettings.js +0 -21
  151. package/build/data-fetching/lib/getAlgoliaSettings.js.map +0 -1
  152. package/build/data-fetching/lib/getEnvVariables.d.ts +0 -4
  153. package/build/data-fetching/lib/getEnvVariables.js +0 -43
  154. package/build/data-fetching/lib/getEnvVariables.js.map +0 -1
  155. package/build/data-fetching/lib/index.d.ts +0 -3
  156. package/build/data-fetching/lib/index.js +0 -10
  157. package/build/data-fetching/lib/index.js.map +0 -1
  158. package/build/data-fetching/lib/isUuid.d.ts +0 -1
  159. package/build/data-fetching/lib/isUuid.js +0 -9
  160. package/build/data-fetching/lib/isUuid.js.map +0 -1
  161. package/build/data-fetching/types.d.ts +0 -13
  162. package/build/data-fetching/types.js +0 -3
  163. package/build/data-fetching/types.js.map +0 -1
  164. package/build/index.js +0 -21
  165. package/build/index.js.map +0 -1
  166. package/build/intl/getFallbackLocale.d.ts +0 -10
  167. package/build/intl/getFallbackLocale.js +0 -24
  168. package/build/intl/getFallbackLocale.js.map +0 -1
  169. package/build/intl/index.js +0 -27
  170. package/build/intl/index.js.map +0 -1
  171. package/build/intl/languages.d.ts +0 -57
  172. package/build/intl/languages.js +0 -191
  173. package/build/intl/languages.js.map +0 -1
  174. package/build/intl/locale.d.ts +0 -11
  175. package/build/intl/locale.js +0 -41
  176. package/build/intl/locale.js.map +0 -1
  177. package/build/intl/localeConfig.d.ts +0 -2
  178. package/build/intl/localeConfig.js +0 -22
  179. package/build/intl/localeConfig.js.map +0 -1
  180. package/build/intl/localeList.d.ts +0 -2
  181. package/build/intl/localeList.js +0 -114
  182. package/build/intl/localeList.js.map +0 -1
  183. package/build/intl/localeObject.d.ts +0 -51
  184. package/build/intl/localeObject.js +0 -98
  185. package/build/intl/localeObject.js.map +0 -1
  186. package/build/seo/getAlternateLanguageLinks.js +0 -85
  187. package/build/seo/getAlternateLanguageLinks.js.map +0 -1
  188. package/build/seo/index.d.ts +0 -2
  189. package/build/seo/index.js +0 -19
  190. package/build/seo/index.js.map +0 -1
  191. package/build/seo/types.d.ts +0 -4
  192. package/build/seo/types.js +0 -3
  193. package/build/seo/types.js.map +0 -1
  194. package/build/seo/utils/bindLanguagesWithLocales.d.ts +0 -11
  195. package/build/seo/utils/bindLanguagesWithLocales.js +0 -23
  196. package/build/seo/utils/bindLanguagesWithLocales.js.map +0 -1
  197. package/build/seo/utils/createAlternateLanguageLink.d.ts +0 -5
  198. package/build/seo/utils/createAlternateLanguageLink.js +0 -15
  199. package/build/seo/utils/createAlternateLanguageLink.js.map +0 -1
  200. package/build/seo/utils/index.d.ts +0 -2
  201. package/build/seo/utils/index.js +0 -8
  202. package/build/seo/utils/index.js.map +0 -1
  203. package/build/server.d.ts +0 -2
  204. package/build/server.js +0 -21
  205. package/build/server.js.map +0 -1
  206. package/build/types.js +0 -3
  207. package/build/types.js.map +0 -1
  208. package/build/utils/assertServerEnv.d.ts +0 -1
  209. package/build/utils/assertServerEnv.js +0 -10
  210. package/build/utils/assertServerEnv.js.map +0 -1
  211. package/build/utils/boilerplate.d.ts +0 -8
  212. package/build/utils/boilerplate.js +0 -27
  213. package/build/utils/boilerplate.js.map +0 -1
  214. package/build/utils/constants.js +0 -8
  215. package/build/utils/constants.js.map +0 -1
  216. package/build/utils/getAssetsUrl.js +0 -13
  217. package/build/utils/getAssetsUrl.js.map +0 -1
  218. package/build/utils/getDataRequestLink.d.ts +0 -3
  219. package/build/utils/getDataRequestLink.js +0 -12
  220. package/build/utils/getDataRequestLink.js.map +0 -1
  221. package/build/utils/getGalleryThumbnail.d.ts +0 -2
  222. package/build/utils/getGalleryThumbnail.js +0 -15
  223. package/build/utils/getGalleryThumbnail.js.map +0 -1
  224. package/build/utils/getLocalizedCategoryData.d.ts +0 -12
  225. package/build/utils/getLocalizedCategoryData.js +0 -34
  226. package/build/utils/getLocalizedCategoryData.js.map +0 -1
  227. package/build/utils/getNewsroomLogoUrl.d.ts +0 -5
  228. package/build/utils/getNewsroomLogoUrl.js +0 -30
  229. package/build/utils/getNewsroomLogoUrl.js.map +0 -1
  230. package/build/utils/getPrivacyPortalUrl.d.ts +0 -8
  231. package/build/utils/getPrivacyPortalUrl.js +0 -13
  232. package/build/utils/getPrivacyPortalUrl.js.map +0 -1
  233. package/build/utils/getStoryPublicationDate.d.ts +0 -3
  234. package/build/utils/getStoryPublicationDate.js +0 -14
  235. package/build/utils/getStoryPublicationDate.js.map +0 -1
  236. package/build/utils/getUploadcareGroupUrl.d.ts +0 -8
  237. package/build/utils/getUploadcareGroupUrl.js +0 -17
  238. package/build/utils/getUploadcareGroupUrl.js.map +0 -1
  239. package/build/utils/index.d.ts +0 -14
  240. package/build/utils/index.js +0 -31
  241. package/build/utils/index.js.map +0 -1
  242. package/build/utils/isEmbargoStory.d.ts +0 -6
  243. package/build/utils/isEmbargoStory.js +0 -9
  244. package/build/utils/isEmbargoStory.js.map +0 -1
  245. package/build/utils/isGalleryEmpty.d.ts +0 -2
  246. package/build/utils/isGalleryEmpty.js +0 -8
  247. package/build/utils/isGalleryEmpty.js.map +0 -1
  248. package/build/utils/sdkHelpers.d.ts +0 -32
  249. package/build/utils/sdkHelpers.js +0 -42
  250. package/build/utils/sdkHelpers.js.map +0 -1
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDataRequestLink = void 0;
4
- const getPrivacyPortalUrl_1 = require("./getPrivacyPortalUrl");
5
- function getDataRequestLink(newsroom, currentLocale) {
6
- return (newsroom.custom_data_request_link ||
7
- (0, getPrivacyPortalUrl_1.getPrivacyPortalUrl)(newsroom, currentLocale, {
8
- action: 'data-request',
9
- }));
10
- }
11
- exports.getDataRequestLink = getDataRequestLink;
12
- //# sourceMappingURL=getDataRequestLink.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDataRequestLink.js","sourceRoot":"","sources":["../../src/utils/getDataRequestLink.ts"],"names":[],"mappings":";;;AAIA,+DAA4D;AAE5D,SAAgB,kBAAkB,CAC9B,QAA6D,EAC7D,aAA2B;IAE3B,OAAO,CACH,QAAQ,CAAC,wBAAwB;QACjC,IAAA,yCAAmB,EAAC,QAAQ,EAAE,aAAa,EAAE;YACzC,MAAM,EAAE,cAAc;SACzB,CAAC,CACL,CAAC;AACN,CAAC;AAVD,gDAUC"}
@@ -1,2 +0,0 @@
1
- import type { NewsroomGallery, UploadedImage } from '@prezly/sdk';
2
- export declare function getGalleryThumbnail(gallery: NewsroomGallery): UploadedImage | null;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGalleryThumbnail = void 0;
4
- function getGalleryThumbnail(gallery) {
5
- const { thumbnail_image, images } = gallery;
6
- if (thumbnail_image) {
7
- return JSON.parse(thumbnail_image);
8
- }
9
- if (images.length) {
10
- return images[0].uploadcare_image;
11
- }
12
- return null;
13
- }
14
- exports.getGalleryThumbnail = getGalleryThumbnail;
15
- //# sourceMappingURL=getGalleryThumbnail.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGalleryThumbnail.js","sourceRoot":"","sources":["../../src/utils/getGalleryThumbnail.ts"],"names":[],"mappings":";;;AAEA,SAAgB,mBAAmB,CAAC,OAAwB;IACxD,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE5C,IAAI,eAAe,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,eAAe,CAAkB,CAAC;IACxD,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;IACtC,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAZD,kDAYC"}
@@ -1,12 +0,0 @@
1
- import type { Category } from '@prezly/sdk';
2
- import type { LocaleObject } from '../intl';
3
- import type { AlgoliaCategoryRef } from '../types';
4
- interface LocalizedCategoryData {
5
- description: string | null;
6
- name: string;
7
- slug: string | null;
8
- }
9
- export declare function getLocalizedCategoryData(category: Pick<Category, 'i18n' | 'display_name'> | AlgoliaCategoryRef, locale: LocaleObject): LocalizedCategoryData;
10
- export declare function getCategoryUrl(category: Pick<Category, 'i18n' | 'display_name'> | AlgoliaCategoryRef, locale: LocaleObject): string;
11
- export declare function getCategoryHasTranslation(category: Pick<Category, 'i18n'>, locale: LocaleObject): boolean;
12
- export {};
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCategoryHasTranslation = exports.getCategoryUrl = exports.getLocalizedCategoryData = void 0;
4
- function isAlgoliaCategory(category) {
5
- return 'name' in category && 'slug' in category;
6
- }
7
- function getLocalizedCategoryData(category, locale) {
8
- if (isAlgoliaCategory(category)) {
9
- return {
10
- description: null,
11
- name: category.name,
12
- slug: category.slug,
13
- };
14
- }
15
- const targetLocaleCode = locale.toUnderscoreCode();
16
- const translations = Object.values(category.i18n).filter((translation) => Boolean(translation.name));
17
- const targetTranslation = translations.find((translation) => translation.locale.code === targetLocaleCode) ??
18
- translations.find((translation) => translation.name === category.display_name) ??
19
- translations[0];
20
- const { locale: _, ...localizedData } = targetTranslation;
21
- return localizedData;
22
- }
23
- exports.getLocalizedCategoryData = getLocalizedCategoryData;
24
- function getCategoryUrl(category, locale) {
25
- const { slug } = getLocalizedCategoryData(category, locale);
26
- return `/category/${slug}`;
27
- }
28
- exports.getCategoryUrl = getCategoryUrl;
29
- function getCategoryHasTranslation(category, locale) {
30
- const translation = category.i18n[locale.toUnderscoreCode()];
31
- return Boolean(translation && translation.name);
32
- }
33
- exports.getCategoryHasTranslation = getCategoryHasTranslation;
34
- //# sourceMappingURL=getLocalizedCategoryData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getLocalizedCategoryData.js","sourceRoot":"","sources":["../../src/utils/getLocalizedCategoryData.ts"],"names":[],"mappings":";;;AAKA,SAAS,iBAAiB,CACtB,QAAsE;IAEtE,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,IAAI,QAAQ,CAAC;AACpD,CAAC;AAQD,SAAgB,wBAAwB,CACpC,QAAsE,EACtE,MAAoB;IAEpB,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,OAAO;YACH,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;SACtB,CAAC;IACN,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CACrE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAC5B,CAAC;IAEF,MAAM,iBAAiB,GACnB,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,KAAK,gBAAgB,CAAC;QAChF,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC,YAAY,CAAC;QAC9E,YAAY,CAAC,CAAC,CAAC,CAAC;IAEpB,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,aAAa,EAAE,GAAG,iBAAiB,CAAC;IAE1D,OAAO,aAAa,CAAC;AACzB,CAAC;AA1BD,4DA0BC;AAED,SAAgB,cAAc,CAC1B,QAAsE,EACtE,MAAoB;IAEpB,MAAM,EAAE,IAAI,EAAE,GAAG,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5D,OAAO,aAAa,IAAI,EAAE,CAAC;AAC/B,CAAC;AAND,wCAMC;AAED,SAAgB,yBAAyB,CACrC,QAAgC,EAChC,MAAoB;IAEpB,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7D,OAAO,OAAO,CAAC,WAAW,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;AACpD,CAAC;AAND,8DAMC"}
@@ -1,5 +0,0 @@
1
- import type { Newsroom } from '@prezly/sdk';
2
- import type { LocaleObject } from '../intl';
3
- export declare function getNewsroomLogoUrl(newsroom: Pick<Newsroom, 'newsroom_logo'>, previewSize?: number): string;
4
- export declare function getNewsroomFaviconUrl(newsroom: Pick<Newsroom, 'icon' | 'square_logo'>, previewSize?: number): string;
5
- export declare function getNewsroomOgImageUrl(newsroom: Pick<Newsroom, 'uuid'>, locale?: LocaleObject): string;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNewsroomOgImageUrl = exports.getNewsroomFaviconUrl = exports.getNewsroomLogoUrl = void 0;
4
- const uploadcare_1 = require("@prezly/uploadcare");
5
- const constants_1 = require("./constants");
6
- function getNewsroomLogoUrl(newsroom, previewSize) {
7
- if (newsroom.newsroom_logo) {
8
- const image = uploadcare_1.UploadcareImage.createFromPrezlyStoragePayload(newsroom.newsroom_logo);
9
- if (previewSize) {
10
- return image.preview(previewSize, previewSize).cdnUrl;
11
- }
12
- return image.cdnUrl;
13
- }
14
- return '';
15
- }
16
- exports.getNewsroomLogoUrl = getNewsroomLogoUrl;
17
- function getNewsroomFaviconUrl(newsroom, previewSize = 400) {
18
- const imageObject = newsroom.icon || newsroom.square_logo;
19
- if (imageObject) {
20
- const image = uploadcare_1.UploadcareImage.createFromPrezlyStoragePayload(imageObject);
21
- return image.preview(previewSize, previewSize).cdnUrl;
22
- }
23
- return '';
24
- }
25
- exports.getNewsroomFaviconUrl = getNewsroomFaviconUrl;
26
- function getNewsroomOgImageUrl(newsroom, locale) {
27
- return `${constants_1.OG_IMAGE_API_URL}/${newsroom.uuid}${locale ? `?locale=${locale.toUrlSlug()}` : ''}`;
28
- }
29
- exports.getNewsroomOgImageUrl = getNewsroomOgImageUrl;
30
- //# sourceMappingURL=getNewsroomLogoUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNewsroomLogoUrl.js","sourceRoot":"","sources":["../../src/utils/getNewsroomLogoUrl.ts"],"names":[],"mappings":";;;AACA,mDAAqD;AAIrD,2CAA+C;AAE/C,SAAgB,kBAAkB,CAC9B,QAAyC,EACzC,WAAoB;IAEpB,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,4BAAe,CAAC,8BAA8B,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACrF,IAAI,WAAW,EAAE,CAAC;YACd,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC;QAC1D,CAAC;QAED,OAAO,KAAK,CAAC,MAAM,CAAC;IACxB,CAAC;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAdD,gDAcC;AAED,SAAgB,qBAAqB,CACjC,QAAgD,EAChD,WAAW,GAAG,GAAG;IAEjB,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW,CAAC;IAE1D,IAAI,WAAW,EAAE,CAAC;QACd,MAAM,KAAK,GAAG,4BAAe,CAAC,8BAA8B,CAAC,WAAW,CAAC,CAAC;QAC1E,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC;IAC1D,CAAC;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAZD,sDAYC;AAED,SAAgB,qBAAqB,CACjC,QAAgC,EAChC,MAAqB;IAErB,OAAO,GAAG,4BAAgB,IAAI,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAClG,CAAC;AALD,sDAKC"}
@@ -1,8 +0,0 @@
1
- import type { Newsroom } from '@prezly/sdk';
2
- import type { LocaleObject } from '../intl';
3
- type PrivacyPortalUrlOptions = {
4
- email?: string;
5
- action?: 'data-request' | 'subscribe' | 'unsubscribe';
6
- };
7
- export declare function getPrivacyPortalUrl(newsroom: Pick<Newsroom, 'uuid'>, locale: LocaleObject, options?: PrivacyPortalUrlOptions): string;
8
- export {};
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPrivacyPortalUrl = void 0;
4
- function getPrivacyPortalUrl(newsroom, locale, options) {
5
- const { email, action = 'subscribe' } = options || {};
6
- const url = new URL(`/${locale.toUrlSlug()}/newsroom/${newsroom.uuid}/${action}`, 'https://privacy.prezly.com');
7
- if (email) {
8
- url.searchParams.append('email', email);
9
- }
10
- return url.toString();
11
- }
12
- exports.getPrivacyPortalUrl = getPrivacyPortalUrl;
13
- //# sourceMappingURL=getPrivacyPortalUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPrivacyPortalUrl.js","sourceRoot":"","sources":["../../src/utils/getPrivacyPortalUrl.ts"],"names":[],"mappings":";;;AASA,SAAgB,mBAAmB,CAC/B,QAAgC,EAChC,MAAoB,EACpB,OAAiC;IAEjC,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAEtD,MAAM,GAAG,GAAG,IAAI,GAAG,CACf,IAAI,MAAM,CAAC,SAAS,EAAE,aAAa,QAAQ,CAAC,IAAI,IAAI,MAAM,EAAE,EAC5D,4BAA4B,CAC/B,CAAC;IACF,IAAI,KAAK,EAAE,CAAC;QACR,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC;AAfD,kDAeC"}
@@ -1,3 +0,0 @@
1
- import type { Story } from '@prezly/sdk';
2
- import type { AlgoliaStory } from '../types';
3
- export declare function getStoryPublicationDate(story: Pick<Story, 'published_at'> | AlgoliaStory): Date | null;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStoryPublicationDate = void 0;
4
- function getStoryPublicationDate(story) {
5
- const { published_at } = story;
6
- if (!published_at) {
7
- return null;
8
- }
9
- return typeof published_at === 'string'
10
- ? new Date(published_at)
11
- : new Date(published_at * 1000);
12
- }
13
- exports.getStoryPublicationDate = getStoryPublicationDate;
14
- //# sourceMappingURL=getStoryPublicationDate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getStoryPublicationDate.js","sourceRoot":"","sources":["../../src/utils/getStoryPublicationDate.tsx"],"names":[],"mappings":";;;AAIA,SAAgB,uBAAuB,CACnC,KAAiD;IAEjD,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE/B,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IAChB,CAAC;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;AAZD,0DAYC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * This method constructs a URL to download all images in the Gallery as a single archive.
3
- *
4
- * @param uuid Gallery UUID
5
- * @param title Filename for the saved archive. Usually it is the Gallery title.
6
- * @returns URL to an archive containing all of the images in the Gallery.
7
- */
8
- export declare function getUploadcareGroupUrl(uuid: string, title: string): string;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUploadcareGroupUrl = void 0;
4
- const constants_1 = require("./constants");
5
- /**
6
- * This method constructs a URL to download all images in the Gallery as a single archive.
7
- *
8
- * @param uuid Gallery UUID
9
- * @param title Filename for the saved archive. Usually it is the Gallery title.
10
- * @returns URL to an archive containing all of the images in the Gallery.
11
- */
12
- function getUploadcareGroupUrl(uuid, title) {
13
- // UploadCare doesn't like slashes in filenames even in encoded form.
14
- return `${constants_1.ASSETS_URL}/${uuid}/archive/zip/${encodeURIComponent(title.replace(/\//g, '_'))}.zip`;
15
- }
16
- exports.getUploadcareGroupUrl = getUploadcareGroupUrl;
17
- //# sourceMappingURL=getUploadcareGroupUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getUploadcareGroupUrl.js","sourceRoot":"","sources":["../../src/utils/getUploadcareGroupUrl.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAEzC;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,IAAY,EAAE,KAAa;IAC7D,qEAAqE;IACrE,OAAO,GAAG,sBAAU,IAAI,IAAI,gBAAgB,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;AACpG,CAAC;AAHD,sDAGC"}
@@ -1,14 +0,0 @@
1
- export * from './assertServerEnv';
2
- export * from './boilerplate';
3
- export * from './constants';
4
- export * from './getAssetsUrl';
5
- export * from './getDataRequestLink';
6
- export * from './getGalleryThumbnail';
7
- export * from './getLocalizedCategoryData';
8
- export * from './getNewsroomLogoUrl';
9
- export * from './getPrivacyPortalUrl';
10
- export * from './getStoryPublicationDate';
11
- export * from './getUploadcareGroupUrl';
12
- export * from './isEmbargoStory';
13
- export * from './isGalleryEmpty';
14
- export * from './sdkHelpers';
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./assertServerEnv"), exports);
18
- __exportStar(require("./boilerplate"), exports);
19
- __exportStar(require("./constants"), exports);
20
- __exportStar(require("./getAssetsUrl"), exports);
21
- __exportStar(require("./getDataRequestLink"), exports);
22
- __exportStar(require("./getGalleryThumbnail"), exports);
23
- __exportStar(require("./getLocalizedCategoryData"), exports);
24
- __exportStar(require("./getNewsroomLogoUrl"), exports);
25
- __exportStar(require("./getPrivacyPortalUrl"), exports);
26
- __exportStar(require("./getStoryPublicationDate"), exports);
27
- __exportStar(require("./getUploadcareGroupUrl"), exports);
28
- __exportStar(require("./isEmbargoStory"), exports);
29
- __exportStar(require("./isGalleryEmpty"), exports);
30
- __exportStar(require("./sdkHelpers"), exports);
31
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,uDAAqC;AACrC,wDAAsC;AACtC,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,mDAAiC;AACjC,mDAAiC;AACjC,+CAA6B"}
@@ -1,6 +0,0 @@
1
- import type { Story } from '@prezly/sdk';
2
- export type EmbargoStory = Omit<Story, 'is_embargo' | 'published_at'> & {
3
- is_embargo: true;
4
- published_at: string;
5
- };
6
- export declare function isEmbargoStory(story: Pick<Story, 'status'>): story is EmbargoStory;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEmbargoStory = void 0;
4
- const sdkHelpers_1 = require("./sdkHelpers");
5
- function isEmbargoStory(story) {
6
- return (0, sdkHelpers_1.isScheduledEmbargo)(story.status);
7
- }
8
- exports.isEmbargoStory = isEmbargoStory;
9
- //# sourceMappingURL=isEmbargoStory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isEmbargoStory.js","sourceRoot":"","sources":["../../src/utils/isEmbargoStory.ts"],"names":[],"mappings":";;;AAEA,6CAAkD;AAOlD,SAAgB,cAAc,CAAC,KAA4B;IACvD,OAAO,IAAA,+BAAkB,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAFD,wCAEC"}
@@ -1,2 +0,0 @@
1
- import type { NewsroomGallery } from '@prezly/sdk';
2
- export declare function isGalleryEmpty(gallery: NewsroomGallery): boolean;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isGalleryEmpty = void 0;
4
- function isGalleryEmpty(gallery) {
5
- return gallery.images_number === 0 && gallery.videos_number === 0;
6
- }
7
- exports.isGalleryEmpty = isGalleryEmpty;
8
- //# sourceMappingURL=isGalleryEmpty.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isGalleryEmpty.js","sourceRoot":"","sources":["../../src/utils/isGalleryEmpty.ts"],"names":[],"mappings":";;;AAEA,SAAgB,cAAc,CAAC,OAAwB;IACnD,OAAO,OAAO,CAAC,aAAa,KAAK,CAAC,IAAI,OAAO,CAAC,aAAa,KAAK,CAAC,CAAC;AACtE,CAAC;AAFD,wCAEC"}
@@ -1,32 +0,0 @@
1
- /**
2
- * These helpers and enums are ported from @prezly/sdk to avoid leaking the dependency into the client bundle.
3
- * The types are matching SDK v15.
4
- */
5
- import type { Story } from '@prezly/sdk';
6
- export declare enum Visibility {
7
- PUBLIC = "public",
8
- EMBARGO = "embargo",
9
- PRIVATE = "private",
10
- CONFIDENTIAL = "confidential"
11
- }
12
- export declare enum Status {
13
- UNINITIALIZED = "uninitialized",
14
- DRAFT = "draft",
15
- SCHEDULED = "scheduled",
16
- EMBARGO = "embargo",
17
- PUBLISHED = "published"
18
- }
19
- export declare enum FormatVersion {
20
- HTML = 1,
21
- SLATEJS = 3
22
- }
23
- /**
24
- * @see https://github.com/prezly/javascript-sdk/blob/8c735968415ded334f60635a8cef66f76a20a73f/src/types/Story.ts#L337
25
- */
26
- export declare function isStoryPublished(status: Status): boolean;
27
- export declare function isStoryPublished(story: Pick<Story, 'status'>): boolean;
28
- /**
29
- * @see https://github.com/prezly/javascript-sdk/blob/8c735968415ded334f60635a8cef66f76a20a73f/src/types/Story.ts#L328
30
- */
31
- export declare function isScheduledEmbargo(status: Status): boolean;
32
- export declare function isScheduledEmbargo(story: Pick<Story, 'status'>): boolean;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- /**
3
- * These helpers and enums are ported from @prezly/sdk to avoid leaking the dependency into the client bundle.
4
- * The types are matching SDK v15.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isScheduledEmbargo = exports.isStoryPublished = exports.FormatVersion = exports.Status = exports.Visibility = void 0;
8
- var Visibility;
9
- (function (Visibility) {
10
- Visibility["PUBLIC"] = "public";
11
- Visibility["EMBARGO"] = "embargo";
12
- Visibility["PRIVATE"] = "private";
13
- Visibility["CONFIDENTIAL"] = "confidential";
14
- })(Visibility || (exports.Visibility = Visibility = {}));
15
- var Status;
16
- (function (Status) {
17
- Status["UNINITIALIZED"] = "uninitialized";
18
- Status["DRAFT"] = "draft";
19
- Status["SCHEDULED"] = "scheduled";
20
- Status["EMBARGO"] = "embargo";
21
- Status["PUBLISHED"] = "published";
22
- })(Status || (exports.Status = Status = {}));
23
- var FormatVersion;
24
- (function (FormatVersion) {
25
- FormatVersion[FormatVersion["HTML"] = 1] = "HTML";
26
- FormatVersion[FormatVersion["SLATEJS"] = 3] = "SLATEJS";
27
- })(FormatVersion || (exports.FormatVersion = FormatVersion = {}));
28
- function isStoryPublished(arg) {
29
- if (typeof arg === 'object' && arg !== null) {
30
- return isStoryPublished(arg.status);
31
- }
32
- return arg === Status.PUBLISHED;
33
- }
34
- exports.isStoryPublished = isStoryPublished;
35
- function isScheduledEmbargo(arg) {
36
- if (typeof arg === 'object' && arg !== null) {
37
- return isScheduledEmbargo(arg.status);
38
- }
39
- return arg === Status.EMBARGO;
40
- }
41
- exports.isScheduledEmbargo = isScheduledEmbargo;
42
- //# sourceMappingURL=sdkHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdkHelpers.js","sourceRoot":"","sources":["../../src/utils/sdkHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,2CAA6B,CAAA;AACjC,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,IAAY,MAMX;AAND,WAAY,MAAM;IACd,yCAA+B,CAAA;IAC/B,yBAAe,CAAA;IACf,iCAAuB,CAAA;IACvB,6BAAmB,CAAA;IACnB,iCAAuB,CAAA;AAC3B,CAAC,EANW,MAAM,sBAAN,MAAM,QAMjB;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,iDAAQ,CAAA;IACR,uDAAW,CAAA;AACf,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAOD,SAAgB,gBAAgB,CAAC,GAAmC;IAChE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,GAAG,KAAK,MAAM,CAAC,SAAS,CAAC;AACpC,CAAC;AALD,4CAKC;AAOD,SAAgB,kBAAkB,CAAC,GAAmC;IAClE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,GAAG,KAAK,MAAM,CAAC,OAAO,CAAC;AAClC,CAAC;AALD,gDAKC"}