@prezly/theme-kit-nextjs 1.18.2 → 2.0.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 (262) hide show
  1. package/build/@types/global.d.js +1 -0
  2. package/build/adapter-nextjs/api-handlers/fetchGalleries.js +27 -23
  3. package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
  4. package/build/adapter-nextjs/api-handlers/fetchStories.js +37 -25
  5. package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
  6. package/build/adapter-nextjs/api-handlers/index.js +2 -8
  7. package/build/adapter-nextjs/api-handlers/index.js.map +1 -1
  8. package/build/adapter-nextjs/getNewsroomServerSideProps.js +16 -15
  9. package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -1
  10. package/build/adapter-nextjs/getNewsroomStaticProps.js +15 -15
  11. package/build/adapter-nextjs/getNewsroomStaticProps.js.map +1 -1
  12. package/build/adapter-nextjs/index.js +6 -23
  13. package/build/adapter-nextjs/index.js.map +1 -1
  14. package/build/adapter-nextjs/page-props/category.d.ts +2 -2
  15. package/build/adapter-nextjs/page-props/category.js +118 -100
  16. package/build/adapter-nextjs/page-props/category.js.map +1 -1
  17. package/build/adapter-nextjs/page-props/gallery.js +87 -68
  18. package/build/adapter-nextjs/page-props/gallery.js.map +1 -1
  19. package/build/adapter-nextjs/page-props/galleryAlbum.js +64 -53
  20. package/build/adapter-nextjs/page-props/galleryAlbum.js.map +1 -1
  21. package/build/adapter-nextjs/page-props/home.d.ts +2 -2
  22. package/build/adapter-nextjs/page-props/home.js +83 -69
  23. package/build/adapter-nextjs/page-props/home.js.map +1 -1
  24. package/build/adapter-nextjs/page-props/index.js +8 -42
  25. package/build/adapter-nextjs/page-props/index.js.map +1 -1
  26. package/build/adapter-nextjs/page-props/lib/types.js +1 -3
  27. package/build/adapter-nextjs/page-props/search.js +25 -31
  28. package/build/adapter-nextjs/page-props/search.js.map +1 -1
  29. package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +29 -50
  30. package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +1 -1
  31. package/build/adapter-nextjs/page-props/sitemap/createPaths.js +13 -19
  32. package/build/adapter-nextjs/page-props/sitemap/createPaths.js.map +1 -1
  33. package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +33 -35
  34. package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -1
  35. package/build/adapter-nextjs/page-props/sitemap/index.js +4 -25
  36. package/build/adapter-nextjs/page-props/sitemap/index.js.map +1 -1
  37. package/build/adapter-nextjs/page-props/sitemap/types.js +1 -3
  38. package/build/adapter-nextjs/page-props/story.js +77 -64
  39. package/build/adapter-nextjs/page-props/story.js.map +1 -1
  40. package/build/adapter-nextjs/page-props/storyPreview.js +27 -26
  41. package/build/adapter-nextjs/page-props/storyPreview.js.map +1 -1
  42. package/build/adapter-nextjs/processRequest.js +34 -25
  43. package/build/adapter-nextjs/processRequest.js.map +1 -1
  44. package/build/adapter-nextjs/processStaticRequest.js +19 -16
  45. package/build/adapter-nextjs/processStaticRequest.js.map +1 -1
  46. package/build/components-nextjs/PageSeo/PageSeo.js +84 -78
  47. package/build/components-nextjs/PageSeo/PageSeo.js.map +1 -1
  48. package/build/components-nextjs/PageSeo/index.js +2 -21
  49. package/build/components-nextjs/PageSeo/index.js.map +1 -1
  50. package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +5 -10
  51. package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +1 -1
  52. package/build/components-nextjs/PageSeo/lib/types.js +1 -3
  53. package/build/components-nextjs/StorySeo/StorySeo.js +69 -47
  54. package/build/components-nextjs/StorySeo/StorySeo.js.map +1 -1
  55. package/build/components-nextjs/StorySeo/index.js +1 -6
  56. package/build/components-nextjs/StorySeo/index.js.map +1 -1
  57. package/build/components-nextjs/document.js +31 -48
  58. package/build/components-nextjs/document.js.map +1 -1
  59. package/build/components-nextjs/index.js +3 -10
  60. package/build/components-nextjs/index.js.map +1 -1
  61. package/build/data-fetching/api/PrezlyApi.d.ts +4 -5
  62. package/build/data-fetching/api/PrezlyApi.js +207 -192
  63. package/build/data-fetching/api/PrezlyApi.js.map +1 -1
  64. package/build/data-fetching/api/getPrezlyApi.js +21 -21
  65. package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
  66. package/build/data-fetching/api/index.js +1 -18
  67. package/build/data-fetching/api/index.js.map +1 -1
  68. package/build/data-fetching/api/queries.js +76 -47
  69. package/build/data-fetching/api/queries.js.map +1 -1
  70. package/build/data-fetching/index.js +3 -20
  71. package/build/data-fetching/index.js.map +1 -1
  72. package/build/data-fetching/lib/getAlgoliaSettings.js +22 -22
  73. package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
  74. package/build/data-fetching/lib/getEnvVariables.js +35 -38
  75. package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
  76. package/build/data-fetching/lib/index.js +4 -12
  77. package/build/data-fetching/lib/index.js.map +1 -1
  78. package/build/data-fetching/lib/isSdkError.js +3 -8
  79. package/build/data-fetching/lib/isSdkError.js.map +1 -1
  80. package/build/data-fetching/lib/isUuid.js +3 -8
  81. package/build/data-fetching/lib/isUuid.js.map +1 -1
  82. package/build/data-fetching/types.js +1 -3
  83. package/build/index.js +9 -26
  84. package/build/index.js.map +1 -1
  85. package/build/infinite-loading/index.js +4 -25
  86. package/build/infinite-loading/index.js.map +1 -1
  87. package/build/infinite-loading/types.js +1 -3
  88. package/build/infinite-loading/useInfiniteGalleriesLoading.js +42 -37
  89. package/build/infinite-loading/useInfiniteGalleriesLoading.js.map +1 -1
  90. package/build/infinite-loading/useInfiniteLoading.js +50 -43
  91. package/build/infinite-loading/useInfiniteLoading.js.map +1 -1
  92. package/build/infinite-loading/useInfiniteStoriesLoading.d.ts +2 -2
  93. package/build/infinite-loading/useInfiniteStoriesLoading.js +56 -50
  94. package/build/infinite-loading/useInfiniteStoriesLoading.js.map +1 -1
  95. package/build/intl/index.d.ts +1 -1
  96. package/build/intl/index.js +4 -26
  97. package/build/intl/index.js.map +1 -1
  98. package/build/intl/languages.d.ts +1 -1
  99. package/build/intl/languages.js +146 -122
  100. package/build/intl/languages.js.map +1 -1
  101. package/build/intl/locale.js +52 -107
  102. package/build/intl/locale.js.map +1 -1
  103. package/build/intl/localeConfig.d.ts +1 -2
  104. package/build/intl/localeConfig.js +7 -14
  105. package/build/intl/localeConfig.js.map +1 -1
  106. package/build/intl/localeList.d.ts +4 -2
  107. package/build/intl/localeList.js +1 -109
  108. package/build/intl/localeList.js.map +1 -1
  109. package/build/intl/localeObject.js +80 -82
  110. package/build/intl/localeObject.js.map +1 -1
  111. package/build/newsroom-context/context.js +35 -25
  112. package/build/newsroom-context/context.js.map +1 -1
  113. package/build/newsroom-context/hooks/index.js +11 -28
  114. package/build/newsroom-context/hooks/index.js.map +1 -1
  115. package/build/newsroom-context/hooks/useAlgoliaSettings.js +5 -10
  116. package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
  117. package/build/newsroom-context/hooks/useCategories.js +5 -10
  118. package/build/newsroom-context/hooks/useCategories.js.map +1 -1
  119. package/build/newsroom-context/hooks/useCompanyInformation.js +5 -10
  120. package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
  121. package/build/newsroom-context/hooks/useCurrentCategory.js +5 -10
  122. package/build/newsroom-context/hooks/useCurrentCategory.js.map +1 -1
  123. package/build/newsroom-context/hooks/useCurrentLocale.js +5 -10
  124. package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
  125. package/build/newsroom-context/hooks/useCurrentStory.js +5 -10
  126. package/build/newsroom-context/hooks/useCurrentStory.js.map +1 -1
  127. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +17 -21
  128. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
  129. package/build/newsroom-context/hooks/useGetTranslationUrl.js +52 -55
  130. package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
  131. package/build/newsroom-context/hooks/useLanguages.js +5 -10
  132. package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
  133. package/build/newsroom-context/hooks/useNewsroom.js +5 -10
  134. package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
  135. package/build/newsroom-context/hooks/useNewsroomContext.js +11 -16
  136. package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
  137. package/build/newsroom-context/index.js +2 -22
  138. package/build/newsroom-context/index.js.map +1 -1
  139. package/build/sentry/client.js +4 -9
  140. package/build/sentry/client.js.map +1 -1
  141. package/build/sentry/common.js +26 -29
  142. package/build/sentry/common.js.map +1 -1
  143. package/build/sentry/index.js +2 -8
  144. package/build/sentry/index.js.map +1 -1
  145. package/build/sentry/server.js +4 -9
  146. package/build/sentry/server.js.map +1 -1
  147. package/build/types.d.ts +2 -2
  148. package/build/types.js +1 -3
  149. package/build/utils/boilerplate.js +7 -22
  150. package/build/utils/boilerplate.js.map +1 -1
  151. package/build/utils/constants.js +3 -7
  152. package/build/utils/constants.js.map +1 -1
  153. package/build/utils/getAssetsUrl.js +4 -9
  154. package/build/utils/getAssetsUrl.js.map +1 -1
  155. package/build/utils/getDataRequestLink.js +6 -12
  156. package/build/utils/getDataRequestLink.js.map +1 -1
  157. package/build/utils/getLocalizedCategoryData.js +33 -33
  158. package/build/utils/getLocalizedCategoryData.js.map +1 -1
  159. package/build/utils/getNewsroomLogoUrl.js +15 -21
  160. package/build/utils/getNewsroomLogoUrl.js.map +1 -1
  161. package/build/utils/getPrivacyPortalUrl.js +11 -13
  162. package/build/utils/getPrivacyPortalUrl.js.map +1 -1
  163. package/build/utils/getStoryPublicationDate.js +9 -14
  164. package/build/utils/getStoryPublicationDate.js.map +1 -1
  165. package/build/utils/getUploadcareGroupUrl.js +5 -10
  166. package/build/utils/getUploadcareGroupUrl.js.map +1 -1
  167. package/build/utils/index.js +10 -27
  168. package/build/utils/index.js.map +1 -1
  169. package/build/utils/isEmbargoStory.js +3 -8
  170. package/build/utils/isEmbargoStory.js.map +1 -1
  171. package/package.json +26 -18
  172. package/build/tsconfig.tsbuildinfo +0 -1
  173. package/src/@types/global.d.ts +0 -7
  174. package/src/__mocks__/languages.ts +0 -417
  175. package/src/__mocks__/story.ts +0 -351
  176. package/src/adapter-nextjs/api-handlers/fetchGalleries.ts +0 -24
  177. package/src/adapter-nextjs/api-handlers/fetchStories.ts +0 -26
  178. package/src/adapter-nextjs/api-handlers/index.ts +0 -2
  179. package/src/adapter-nextjs/getNewsroomServerSideProps.ts +0 -29
  180. package/src/adapter-nextjs/getNewsroomStaticProps.ts +0 -29
  181. package/src/adapter-nextjs/index.ts +0 -6
  182. package/src/adapter-nextjs/page-props/category.ts +0 -157
  183. package/src/adapter-nextjs/page-props/gallery.ts +0 -114
  184. package/src/adapter-nextjs/page-props/galleryAlbum.ts +0 -89
  185. package/src/adapter-nextjs/page-props/home.ts +0 -113
  186. package/src/adapter-nextjs/page-props/index.ts +0 -26
  187. package/src/adapter-nextjs/page-props/lib/types.ts +0 -8
  188. package/src/adapter-nextjs/page-props/search.ts +0 -53
  189. package/src/adapter-nextjs/page-props/sitemap/SitemapBuilder.ts +0 -56
  190. package/src/adapter-nextjs/page-props/sitemap/createPaths.ts +0 -21
  191. package/src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts +0 -43
  192. package/src/adapter-nextjs/page-props/sitemap/index.ts +0 -5
  193. package/src/adapter-nextjs/page-props/sitemap/types.ts +0 -5
  194. package/src/adapter-nextjs/page-props/story.ts +0 -94
  195. package/src/adapter-nextjs/page-props/storyPreview.ts +0 -33
  196. package/src/adapter-nextjs/processRequest.ts +0 -49
  197. package/src/adapter-nextjs/processStaticRequest.ts +0 -32
  198. package/src/components-nextjs/PageSeo/PageSeo.tsx +0 -131
  199. package/src/components-nextjs/PageSeo/index.ts +0 -2
  200. package/src/components-nextjs/PageSeo/lib/getAbsoluteUrl.ts +0 -7
  201. package/src/components-nextjs/PageSeo/lib/types.ts +0 -4
  202. package/src/components-nextjs/StorySeo/StorySeo.tsx +0 -80
  203. package/src/components-nextjs/StorySeo/index.ts +0 -1
  204. package/src/components-nextjs/document.tsx +0 -38
  205. package/src/components-nextjs/index.ts +0 -3
  206. package/src/data-fetching/api/PrezlyApi.ts +0 -302
  207. package/src/data-fetching/api/getPrezlyApi.ts +0 -24
  208. package/src/data-fetching/api/index.ts +0 -1
  209. package/src/data-fetching/api/queries.ts +0 -51
  210. package/src/data-fetching/index.ts +0 -3
  211. package/src/data-fetching/lib/getAlgoliaSettings.ts +0 -29
  212. package/src/data-fetching/lib/getEnvVariables.ts +0 -46
  213. package/src/data-fetching/lib/index.ts +0 -4
  214. package/src/data-fetching/lib/isSdkError.ts +0 -5
  215. package/src/data-fetching/lib/isUuid.ts +0 -5
  216. package/src/data-fetching/types.ts +0 -14
  217. package/src/index.ts +0 -9
  218. package/src/infinite-loading/index.ts +0 -4
  219. package/src/infinite-loading/types.ts +0 -5
  220. package/src/infinite-loading/useInfiniteGalleriesLoading.ts +0 -53
  221. package/src/infinite-loading/useInfiniteLoading.ts +0 -66
  222. package/src/infinite-loading/useInfiniteStoriesLoading.ts +0 -81
  223. package/src/intl/index.ts +0 -4
  224. package/src/intl/languages.test.ts +0 -232
  225. package/src/intl/languages.ts +0 -233
  226. package/src/intl/locale.test.ts +0 -94
  227. package/src/intl/locale.ts +0 -140
  228. package/src/intl/localeConfig.js +0 -23
  229. package/src/intl/localeList.js +0 -110
  230. package/src/intl/localeObject.test.ts +0 -81
  231. package/src/intl/localeObject.ts +0 -99
  232. package/src/newsroom-context/context.tsx +0 -115
  233. package/src/newsroom-context/hooks/index.ts +0 -11
  234. package/src/newsroom-context/hooks/useAlgoliaSettings.ts +0 -7
  235. package/src/newsroom-context/hooks/useCategories.ts +0 -7
  236. package/src/newsroom-context/hooks/useCompanyInformation.ts +0 -7
  237. package/src/newsroom-context/hooks/useCurrentCategory.ts +0 -7
  238. package/src/newsroom-context/hooks/useCurrentLocale.ts +0 -7
  239. package/src/newsroom-context/hooks/useCurrentStory.ts +0 -7
  240. package/src/newsroom-context/hooks/useGetLinkLocaleSlug.ts +0 -37
  241. package/src/newsroom-context/hooks/useGetTranslationUrl.ts +0 -96
  242. package/src/newsroom-context/hooks/useLanguages.ts +0 -7
  243. package/src/newsroom-context/hooks/useNewsroom.ts +0 -7
  244. package/src/newsroom-context/hooks/useNewsroomContext.ts +0 -15
  245. package/src/newsroom-context/index.ts +0 -2
  246. package/src/sentry/client.ts +0 -7
  247. package/src/sentry/common.ts +0 -27
  248. package/src/sentry/index.ts +0 -2
  249. package/src/sentry/server.ts +0 -7
  250. package/src/types.ts +0 -51
  251. package/src/utils/boilerplate.ts +0 -27
  252. package/src/utils/constants.ts +0 -3
  253. package/src/utils/getAssetsUrl.test.ts +0 -9
  254. package/src/utils/getAssetsUrl.ts +0 -9
  255. package/src/utils/getDataRequestLink.ts +0 -14
  256. package/src/utils/getLocalizedCategoryData.ts +0 -47
  257. package/src/utils/getNewsroomLogoUrl.ts +0 -22
  258. package/src/utils/getPrivacyPortalUrl.ts +0 -25
  259. package/src/utils/getStoryPublicationDate.tsx +0 -15
  260. package/src/utils/getUploadcareGroupUrl.ts +0 -13
  261. package/src/utils/index.ts +0 -10
  262. package/src/utils/isEmbargoStory.ts +0 -10
@@ -1,9 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSentryServerOptions = void 0;
4
- const common_1 = require("./common");
5
- function getSentryServerOptions(dsn, themeName) {
6
- return (0, common_1.getCommonClientOptions)(dsn, themeName);
7
- }
8
- exports.getSentryServerOptions = getSentryServerOptions;
9
- //# sourceMappingURL=server.js.map
1
+ import { getCommonClientOptions } from "./common.js";
2
+ export function getSentryServerOptions(dsn, themeName) {
3
+ return getCommonClientOptions(dsn, themeName);
4
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/sentry/server.ts"],"names":[],"mappings":";;;AAEA,qCAAkD;AAElD,SAAgB,sBAAsB,CAAC,GAAW,EAAE,SAAiB;IACjE,OAAO,IAAA,+BAAsB,EAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC;AAFD,wDAEC"}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/sentry/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,SAAiB;IACjE,OAAO,sBAAsB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC"}
package/build/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CultureRef, ExtraStoryFields, Story } from '@prezly/sdk';
1
+ import type { CultureRef, Story } from '@prezly/sdk';
2
2
  import type { NewsroomContextProps } from './newsroom-context';
3
3
  export interface ServerSidePageProps {
4
4
  /**
@@ -24,7 +24,7 @@ export interface AlgoliaCategoryRef {
24
24
  /**
25
25
  * Stories in Algolia index are stored in a simplified format, with only minimal subset of fields.
26
26
  */
27
- export declare type AlgoliaStory = Pick<Story, 'uuid' | 'slug' | 'title' | 'subtitle'> & Pick<ExtraStoryFields, 'thumbnail_image'> & {
27
+ export declare type AlgoliaStory = Pick<Story, 'uuid' | 'slug' | 'title' | 'subtitle'> & Pick<Story.ExtraFields, 'thumbnail_image'> & {
28
28
  content_text: string;
29
29
  updated_at: number;
30
30
  published_at: number;
package/build/types.js CHANGED
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
1
+ export {};
@@ -1,24 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasAnyContactInformation = exports.hasAnyAboutInformation = exports.hasAnySocialMedia = void 0;
4
- function hasAnySocialMedia(companyInformation) {
5
- return Boolean(companyInformation.facebook ||
6
- companyInformation.instagram ||
7
- companyInformation.linkedin ||
8
- companyInformation.pinterest ||
9
- companyInformation.tiktok ||
10
- companyInformation.twitter ||
11
- companyInformation.youtube);
1
+ export function hasAnySocialMedia(companyInformation) {
2
+ return Boolean(companyInformation.facebook || companyInformation.instagram || companyInformation.linkedin || companyInformation.pinterest || companyInformation.tiktok || companyInformation.twitter || companyInformation.youtube);
12
3
  }
13
- exports.hasAnySocialMedia = hasAnySocialMedia;
14
- function hasAnyAboutInformation(companyInformation) {
15
- return Boolean(companyInformation.about ||
16
- companyInformation.website ||
17
- hasAnySocialMedia(companyInformation));
4
+ export function hasAnyAboutInformation(companyInformation) {
5
+ return Boolean(companyInformation.about || companyInformation.website || hasAnySocialMedia(companyInformation));
18
6
  }
19
- exports.hasAnyAboutInformation = hasAnyAboutInformation;
20
- function hasAnyContactInformation(companyInformation) {
21
- return Boolean(companyInformation.address || companyInformation.phone || companyInformation.email);
22
- }
23
- exports.hasAnyContactInformation = hasAnyContactInformation;
24
- //# sourceMappingURL=boilerplate.js.map
7
+ export function hasAnyContactInformation(companyInformation) {
8
+ return Boolean(companyInformation.address || companyInformation.phone || companyInformation.email);
9
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"boilerplate.js","sourceRoot":"","sources":["../../src/utils/boilerplate.ts"],"names":[],"mappings":";;;AAEA,SAAgB,iBAAiB,CAAC,kBAA8C;IAC5E,OAAO,OAAO,CACV,kBAAkB,CAAC,QAAQ;QACvB,kBAAkB,CAAC,SAAS;QAC5B,kBAAkB,CAAC,QAAQ;QAC3B,kBAAkB,CAAC,SAAS;QAC5B,kBAAkB,CAAC,MAAM;QACzB,kBAAkB,CAAC,OAAO;QAC1B,kBAAkB,CAAC,OAAO,CACjC,CAAC;AACN,CAAC;AAVD,8CAUC;AAED,SAAgB,sBAAsB,CAAC,kBAA8C;IACjF,OAAO,OAAO,CACV,kBAAkB,CAAC,KAAK;QACpB,kBAAkB,CAAC,OAAO;QAC1B,iBAAiB,CAAC,kBAAkB,CAAC,CAC5C,CAAC;AACN,CAAC;AAND,wDAMC;AAED,SAAgB,wBAAwB,CAAC,kBAA8C;IACnF,OAAO,OAAO,CACV,kBAAkB,CAAC,OAAO,IAAI,kBAAkB,CAAC,KAAK,IAAI,kBAAkB,CAAC,KAAK,CACrF,CAAC;AACN,CAAC;AAJD,4DAIC"}
1
+ {"version":3,"file":"boilerplate.js","sourceRoot":"","sources":["../../src/utils/boilerplate.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,kBAA8C;IAC5E,OAAO,OAAO,CACV,kBAAkB,CAAC,QAAQ;QACvB,kBAAkB,CAAC,SAAS;QAC5B,kBAAkB,CAAC,QAAQ;QAC3B,kBAAkB,CAAC,SAAS;QAC5B,kBAAkB,CAAC,MAAM;QACzB,kBAAkB,CAAC,OAAO;QAC1B,kBAAkB,CAAC,OAAO,CACjC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,kBAA8C;IACjF,OAAO,OAAO,CACV,kBAAkB,CAAC,KAAK;QACpB,kBAAkB,CAAC,OAAO;QAC1B,iBAAiB,CAAC,kBAAkB,CAAC,CAC5C,CAAC;AACN,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,kBAA8C;IACnF,OAAO,OAAO,CACV,kBAAkB,CAAC,OAAO,IAAI,kBAAkB,CAAC,KAAK,IAAI,kBAAkB,CAAC,KAAK,CACrF,CAAC;AACN,CAAC"}
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_GALLERY_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = exports.ASSETS_URL = void 0;
4
- exports.ASSETS_URL = 'https://cdn.uc.assets.prezly.com';
5
- exports.DEFAULT_PAGE_SIZE = 12;
6
- exports.DEFAULT_GALLERY_PAGE_SIZE = 6;
7
- //# sourceMappingURL=constants.js.map
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 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,kCAAkC,CAAC;AAChD,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,yBAAyB,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,kCAAkC,CAAC;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC"}
@@ -1,13 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAssetsUrl = void 0;
4
- const constants_1 = require("./constants");
1
+ import { ASSETS_URL } from "./constants.js";
5
2
  /**
6
3
  * @param uuid UUID of the assets hosted on Uploadcare
7
4
  * @returns Full asset URL that can be used as a source for <img>, <video> and <a> tags.
8
5
  */
9
- function getAssetsUrl(uuid) {
10
- return `${constants_1.ASSETS_URL}/${uuid}/`;
11
- }
12
- exports.getAssetsUrl = getAssetsUrl;
13
- //# sourceMappingURL=getAssetsUrl.js.map
6
+ export function getAssetsUrl(uuid) {
7
+ return `${ASSETS_URL}/${uuid}/`;
8
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"getAssetsUrl.js","sourceRoot":"","sources":["../../src/utils/getAssetsUrl.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAEzC;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAY;IACrC,OAAO,GAAG,sBAAU,IAAI,IAAI,GAAG,CAAC;AACpC,CAAC;AAFD,oCAEC"}
1
+ {"version":3,"file":"getAssetsUrl.js","sourceRoot":"","sources":["../../src/utils/getAssetsUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACrC,OAAO,GAAG,UAAU,IAAI,IAAI,GAAG,CAAC;AACpC,CAAC"}
@@ -1,12 +1,6 @@
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
+ import { getPrivacyPortalUrl } from "./getPrivacyPortalUrl.js";
2
+ export function getDataRequestLink(newsroom, currentLocale) {
3
+ return newsroom.custom_data_request_link || getPrivacyPortalUrl(newsroom, currentLocale, {
4
+ action: 'data-request'
5
+ });
6
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"getDataRequestLink.js","sourceRoot":"","sources":["../../src/utils/getDataRequestLink.ts"],"names":[],"mappings":";;;AAIA,+DAA4D;AAE5D,SAAgB,kBAAkB,CAAC,QAAkB,EAAE,aAA2B;IAC9E,OAAO,CACH,QAAQ,CAAC,wBAAwB;QACjC,IAAA,yCAAmB,EAAC,QAAQ,EAAE,aAAa,EAAE;YACzC,MAAM,EAAE,cAAc;SACzB,CAAC,CACL,CAAC;AACN,CAAC;AAPD,gDAOC"}
1
+ {"version":3,"file":"getDataRequestLink.js","sourceRoot":"","sources":["../../src/utils/getDataRequestLink.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,kBAAkB,CAAC,QAAkB,EAAE,aAA2B;IAC9E,OAAO,CACH,QAAQ,CAAC,wBAAwB;QACjC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE;YACzC,MAAM,EAAE,cAAc;SACzB,CAAC,CACL,CAAC;AACN,CAAC"}
@@ -1,37 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCategoryHasTranslation = exports.getCategoryUrl = exports.getLocalizedCategoryData = void 0;
4
1
  function isAlgoliaCategory(category) {
5
- return 'name' in category && 'slug' in category;
2
+ return 'name' in category && 'slug' in category;
6
3
  }
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 { i18n } = category;
17
- const populatedLocales = Object.keys(i18n).filter((localeCode) => i18n[localeCode].name);
18
- const targetLocale = populatedLocales.find((localeCode) => localeCode === targetLocaleCode) ||
19
- populatedLocales.find((localeCode) => i18n[localeCode].name === category.display_name) ||
20
- populatedLocales[0];
21
- const { locale: _, ...localizedData } = i18n[targetLocale];
22
- return localizedData;
4
+ export function getLocalizedCategoryData(category, locale) {
5
+ if (isAlgoliaCategory(category)) {
6
+ return {
7
+ description: null,
8
+ name: category.name,
9
+ slug: category.slug
10
+ };
11
+ }
12
+ const targetLocaleCode = locale.toUnderscoreCode();
13
+ const {
14
+ i18n
15
+ } = category;
16
+ const populatedLocales = Object.keys(i18n).filter(localeCode => i18n[localeCode].name);
17
+ const targetLocale = populatedLocales.find(localeCode => localeCode === targetLocaleCode) || populatedLocales.find(localeCode => i18n[localeCode].name === category.display_name) || populatedLocales[0];
18
+ const {
19
+ locale: _,
20
+ ...localizedData
21
+ } = i18n[targetLocale];
22
+ return localizedData;
23
23
  }
24
- exports.getLocalizedCategoryData = getLocalizedCategoryData;
25
- function getCategoryUrl(category, locale) {
26
- const { slug } = getLocalizedCategoryData(category, locale);
27
- return `/category/${slug}`;
24
+ export function getCategoryUrl(category, locale) {
25
+ const {
26
+ slug
27
+ } = getLocalizedCategoryData(category, locale);
28
+ return `/category/${slug}`;
28
29
  }
29
- exports.getCategoryUrl = getCategoryUrl;
30
- function getCategoryHasTranslation(category, locale) {
31
- const targetLocaleCode = locale.toUnderscoreCode();
32
- const { i18n } = category;
33
- const populatedLocales = Object.keys(i18n).filter((localeCode) => i18n[localeCode].name);
34
- return Boolean(populatedLocales.find((localeCode) => localeCode === targetLocaleCode));
35
- }
36
- exports.getCategoryHasTranslation = getCategoryHasTranslation;
37
- //# sourceMappingURL=getLocalizedCategoryData.js.map
30
+ export function getCategoryHasTranslation(category, locale) {
31
+ const targetLocaleCode = locale.toUnderscoreCode();
32
+ const {
33
+ i18n
34
+ } = category;
35
+ const populatedLocales = Object.keys(i18n).filter(localeCode => i18n[localeCode].name);
36
+ return Boolean(populatedLocales.find(localeCode => localeCode === targetLocaleCode));
37
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"getLocalizedCategoryData.js","sourceRoot":"","sources":["../../src/utils/getLocalizedCategoryData.ts"],"names":[],"mappings":";;;AAKA,SAAS,iBAAiB,CACtB,QAAuC;IAEvC,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,IAAI,QAAQ,CAAC;AACpD,CAAC;AAED,SAAgB,wBAAwB,CACpC,QAAuC,EACvC,MAAoB;IAEpB,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE;QAC7B,OAAO;YACH,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;SACtB,CAAC;KACL;IAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAC1B,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;IACzF,MAAM,YAAY,GACd,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,gBAAgB,CAAC;QACtE,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,YAAY,CAAC;QACtF,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAExB,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,aAAa,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IAE3D,OAAO,aAAa,CAAC;AACzB,CAAC;AAvBD,4DAuBC;AAED,SAAgB,cAAc,CAAC,QAAuC,EAAE,MAAoB;IACxF,MAAM,EAAE,IAAI,EAAE,GAAG,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5D,OAAO,aAAa,IAAI,EAAE,CAAC;AAC/B,CAAC;AAHD,wCAGC;AAED,SAAgB,yBAAyB,CAAC,QAAkB,EAAE,MAAoB;IAC9E,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAC1B,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;IACzF,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,gBAAgB,CAAC,CAAC,CAAC;AAC3F,CAAC;AALD,8DAKC"}
1
+ {"version":3,"file":"getLocalizedCategoryData.js","sourceRoot":"","sources":["../../src/utils/getLocalizedCategoryData.ts"],"names":[],"mappings":"AAKA,SAAS,iBAAiB,CACtB,QAAuC;IAEvC,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,IAAI,QAAQ,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,wBAAwB,CACpC,QAAuC,EACvC,MAAoB;IAEpB,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE;QAC7B,OAAO;YACH,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;SACtB,CAAC;KACL;IAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAC1B,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;IACzF,MAAM,YAAY,GACd,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,gBAAgB,CAAC;QACtE,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,YAAY,CAAC;QACtF,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAExB,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,aAAa,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IAE3D,OAAO,aAAa,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAuC,EAAE,MAAoB;IACxF,MAAM,EAAE,IAAI,EAAE,GAAG,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5D,OAAO,aAAa,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,QAAkB,EAAE,MAAoB;IAC9E,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAC1B,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;IACzF,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,gBAAgB,CAAC,CAAC,CAAC;AAC3F,CAAC"}
@@ -1,22 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNewsroomFaviconUrl = exports.getNewsroomLogoUrl = void 0;
4
- const uploadcare_1 = require("@prezly/uploadcare");
5
- function getNewsroomLogoUrl(newsroom) {
6
- if (newsroom.newsroom_logo) {
7
- const image = uploadcare_1.UploadcareImage.createFromPrezlyStoragePayload(newsroom.newsroom_logo);
8
- return image.cdnUrl;
9
- }
10
- return '';
1
+ import { UploadcareImage } from '@prezly/uploadcare';
2
+ export function getNewsroomLogoUrl(newsroom) {
3
+ if (newsroom.newsroom_logo) {
4
+ const image = UploadcareImage.createFromPrezlyStoragePayload(newsroom.newsroom_logo);
5
+ return image.cdnUrl;
6
+ }
7
+ return '';
11
8
  }
12
- exports.getNewsroomLogoUrl = getNewsroomLogoUrl;
13
- function getNewsroomFaviconUrl(newsroom, previewSize = 400) {
14
- const imageObject = newsroom.icon || newsroom.square_logo;
15
- if (imageObject) {
16
- const image = uploadcare_1.UploadcareImage.createFromPrezlyStoragePayload(imageObject);
17
- return image.preview(previewSize, previewSize).cdnUrl;
18
- }
19
- return '';
20
- }
21
- exports.getNewsroomFaviconUrl = getNewsroomFaviconUrl;
22
- //# sourceMappingURL=getNewsroomLogoUrl.js.map
9
+ export function getNewsroomFaviconUrl(newsroom, previewSize = 400) {
10
+ const imageObject = newsroom.icon || newsroom.square_logo;
11
+ if (imageObject) {
12
+ const image = UploadcareImage.createFromPrezlyStoragePayload(imageObject);
13
+ return image.preview(previewSize, previewSize).cdnUrl;
14
+ }
15
+ return '';
16
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"getNewsroomLogoUrl.js","sourceRoot":"","sources":["../../src/utils/getNewsroomLogoUrl.ts"],"names":[],"mappings":";;;AACA,mDAAqD;AAErD,SAAgB,kBAAkB,CAAC,QAAkB;IACjD,IAAI,QAAQ,CAAC,aAAa,EAAE;QACxB,MAAM,KAAK,GAAG,4BAAe,CAAC,8BAA8B,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACrF,OAAO,KAAK,CAAC,MAAM,CAAC;KACvB;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAPD,gDAOC;AAED,SAAgB,qBAAqB,CAAC,QAAkB,EAAE,WAAW,GAAG,GAAG;IACvE,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW,CAAC;IAE1D,IAAI,WAAW,EAAE;QACb,MAAM,KAAK,GAAG,4BAAe,CAAC,8BAA8B,CAAC,WAAW,CAAC,CAAC;QAC1E,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC;KACzD;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AATD,sDASC"}
1
+ {"version":3,"file":"getNewsroomLogoUrl.js","sourceRoot":"","sources":["../../src/utils/getNewsroomLogoUrl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,UAAU,kBAAkB,CAAC,QAAkB;IACjD,IAAI,QAAQ,CAAC,aAAa,EAAE;QACxB,MAAM,KAAK,GAAG,eAAe,CAAC,8BAA8B,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACrF,OAAO,KAAK,CAAC,MAAM,CAAC;KACvB;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAkB,EAAE,WAAW,GAAG,GAAG;IACvE,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW,CAAC;IAE1D,IAAI,WAAW,EAAE;QACb,MAAM,KAAK,GAAG,eAAe,CAAC,8BAA8B,CAAC,WAAW,CAAC,CAAC;QAC1E,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC;KACzD;IAED,OAAO,EAAE,CAAC;AACd,CAAC"}
@@ -1,13 +1,11 @@
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
+ export function getPrivacyPortalUrl(newsroom, locale, options) {
2
+ const {
3
+ email,
4
+ action = 'subscribe'
5
+ } = 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
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"getPrivacyPortalUrl.js","sourceRoot":"","sources":["../../src/utils/getPrivacyPortalUrl.ts"],"names":[],"mappings":";;;AASA,SAAgB,mBAAmB,CAC/B,QAAkB,EAClB,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;QACP,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAC3C;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC;AAfD,kDAeC"}
1
+ {"version":3,"file":"getPrivacyPortalUrl.js","sourceRoot":"","sources":["../../src/utils/getPrivacyPortalUrl.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,mBAAmB,CAC/B,QAAkB,EAClB,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;QACP,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAC3C;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC"}
@@ -1,14 +1,9 @@
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
+ export function getStoryPublicationDate(story) {
2
+ const {
3
+ published_at
4
+ } = story;
5
+ if (!published_at) {
6
+ return null;
7
+ }
8
+ return typeof published_at === 'string' ? new Date(published_at) : new Date(published_at * 1000);
9
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"getStoryPublicationDate.js","sourceRoot":"","sources":["../../src/utils/getStoryPublicationDate.tsx"],"names":[],"mappings":";;;AAIA,SAAgB,uBAAuB,CAAC,KAA2B;IAC/D,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE/B,IAAI,CAAC,YAAY,EAAE;QACf,OAAO,IAAI,CAAC;KACf;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;AAVD,0DAUC"}
1
+ {"version":3,"file":"getStoryPublicationDate.js","sourceRoot":"","sources":["../../src/utils/getStoryPublicationDate.tsx"],"names":[],"mappings":"AAIA,MAAM,UAAU,uBAAuB,CAAC,KAA2B;IAC/D,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE/B,IAAI,CAAC,YAAY,EAAE;QACf,OAAO,IAAI,CAAC;KACf;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"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUploadcareGroupUrl = void 0;
4
- const constants_1 = require("./constants");
1
+ import { ASSETS_URL } from "./constants.js";
5
2
  /**
6
3
  * This method constructs a URL to download all images in the Gallery as a single archive.
7
4
  *
@@ -9,9 +6,7 @@ const constants_1 = require("./constants");
9
6
  * @param title Filename for the saved archive. Usually it is the Gallery title.
10
7
  * @returns URL to an archive containing all of the images in the Gallery.
11
8
  */
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('/', '_'))}.zip`;
15
- }
16
- exports.getUploadcareGroupUrl = getUploadcareGroupUrl;
17
- //# sourceMappingURL=getUploadcareGroupUrl.js.map
9
+ export function getUploadcareGroupUrl(uuid, title) {
10
+ // UploadCare doesn't like slashes in filenames even in encoded form.
11
+ return `${ASSETS_URL}/${uuid}/archive/zip/${encodeURIComponent(title.replace('/', '_'))}.zip`;
12
+ }
@@ -1 +1 @@
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,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;AAClG,CAAC;AAHD,sDAGC"}
1
+ {"version":3,"file":"getUploadcareGroupUrl.js","sourceRoot":"","sources":["../../src/utils/getUploadcareGroupUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,KAAa;IAC7D,qEAAqE;IACrE,OAAO,GAAG,UAAU,IAAI,IAAI,gBAAgB,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;AAClG,CAAC"}
@@ -1,27 +1,10 @@
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("./boilerplate"), exports);
18
- __exportStar(require("./constants"), exports);
19
- __exportStar(require("./getAssetsUrl"), exports);
20
- __exportStar(require("./getDataRequestLink"), exports);
21
- __exportStar(require("./getLocalizedCategoryData"), exports);
22
- __exportStar(require("./getNewsroomLogoUrl"), exports);
23
- __exportStar(require("./getPrivacyPortalUrl"), exports);
24
- __exportStar(require("./getStoryPublicationDate"), exports);
25
- __exportStar(require("./getUploadcareGroupUrl"), exports);
26
- __exportStar(require("./isEmbargoStory"), exports);
27
- //# sourceMappingURL=index.js.map
1
+ export * from "./boilerplate.js";
2
+ export * from "./constants.js";
3
+ export * from "./getAssetsUrl.js";
4
+ export * from "./getDataRequestLink.js";
5
+ export * from "./getLocalizedCategoryData.js";
6
+ export * from "./getNewsroomLogoUrl.js";
7
+ export * from "./getPrivacyPortalUrl.js";
8
+ export * from "./getStoryPublicationDate.js";
9
+ export * from "./getUploadcareGroupUrl.js";
10
+ export * from "./isEmbargoStory.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,uDAAqC;AACrC,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC"}
@@ -1,8 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEmbargoStory = void 0;
4
- function isEmbargoStory(story) {
5
- return story.is_embargo && Boolean(story.published_at);
6
- }
7
- exports.isEmbargoStory = isEmbargoStory;
8
- //# sourceMappingURL=isEmbargoStory.js.map
1
+ export function isEmbargoStory(story) {
2
+ return story.is_embargo && Boolean(story.published_at);
3
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"isEmbargoStory.js","sourceRoot":"","sources":["../../src/utils/isEmbargoStory.ts"],"names":[],"mappings":";;;AAOA,SAAgB,cAAc,CAAC,KAAY;IACvC,OAAO,KAAK,CAAC,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAC3D,CAAC;AAFD,wCAEC"}
1
+ {"version":3,"file":"isEmbargoStory.js","sourceRoot":"","sources":["../../src/utils/isEmbargoStory.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,cAAc,CAAC,KAAY;IACvC,OAAO,KAAK,CAAC,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAC3D,CAAC"}
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@prezly/theme-kit-nextjs",
3
- "version": "1.18.2",
3
+ "version": "2.0.0-1",
4
4
  "description": "Data layer and utility library for developing Prezly themes with NextJS",
5
+ "type": "module",
5
6
  "main": "build/index.js",
6
7
  "types": "build/index.d.ts",
7
8
  "files": [
8
- "build",
9
- "src"
9
+ "build"
10
10
  ],
11
11
  "engines": {
12
- "node": ">= 14.x",
13
- "npm": ">= 7.x"
12
+ "node": ">= 16.x",
13
+ "npm": ">= 8.x"
14
14
  },
15
15
  "devEngines": {
16
- "node": ">= 14.x",
17
- "npm": ">= 7.x"
16
+ "node": ">= 16.x",
17
+ "npm": ">= 8.x"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -29,9 +29,12 @@
29
29
  "homepage": "https://github.com/prezly/theme-kit-nextjs#readme",
30
30
  "scripts": {
31
31
  "clean": "rimraf build/ node_modules/",
32
- "build": "tsc --project .",
32
+ "prebuild": "rimraf build/",
33
+ "build": "npm run build:types && npm run build:es",
34
+ "build:types": "tsc --project .",
35
+ "build:es": "babel ./src --ignore='**/*.test.ts','**/__mocks__/**' --config-file=./babel.config.json --extensions=.ts,.tsx --source-root=./src --out-dir=./build",
33
36
  "watch": "tsc --watch --preserveWatchOutput --project .",
34
- "test": "jest",
37
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
35
38
  "typecheck": "tsc --noEmit --incremental --project .",
36
39
  "lint": "eslint src",
37
40
  "lint:fix": "npm run lint -- --fix",
@@ -43,31 +46,36 @@
43
46
  "release:preview": "npm run prerelease && np --any-branch --no-release-draft --tag=preview"
44
47
  },
45
48
  "peerDependencies": {
46
- "next": "^12.x",
49
+ "next": "^12.x || ^13.x",
47
50
  "react": "^17.x || ^18.x",
48
51
  "react-dom": "^17.x || ^18.x"
49
52
  },
50
53
  "dependencies": {
51
- "@prezly/sdk": "^7.11.0-0",
54
+ "@prezly/sdk": "^10.0.0",
52
55
  "@prezly/uploadcare": "^2.3.4",
53
- "@react-hookz/web": "^14.2.2",
56
+ "@react-hookz/web": "^16.0.0",
54
57
  "next-seo": "^5.4.0",
55
58
  "parse-data-url": "^4.0.1"
56
59
  },
57
60
  "devDependencies": {
61
+ "@babel/cli": "7.19.3",
62
+ "@babel/preset-env": "^7.19.4",
63
+ "@babel/preset-react": "7.18.6",
64
+ "@babel/preset-typescript": "7.18.6",
58
65
  "@prezly/eslint-config": "4.2.0",
59
- "@sentry/nextjs": "7.16.0",
60
- "@types/jest": "28.1.8",
66
+ "@sentry/nextjs": "7.17.1",
67
+ "@types/jest": "29.2.0",
61
68
  "@types/node": "17.0.14",
62
69
  "@types/parse-data-url": "3.0.0",
63
- "@types/react": "18.0.22",
64
- "@types/react-dom": "18.0.7",
70
+ "@types/react": "18.0.24",
71
+ "@types/react-dom": "18.0.8",
72
+ "babel-plugin-add-import-extension": "1.6.0",
65
73
  "eslint": "8.26.0",
66
- "jest": "28.1.3",
74
+ "jest": "29.2.2",
67
75
  "np": "7.6.2",
68
76
  "prettier": "2.7.1",
69
77
  "rimraf": "3.0.2",
70
- "ts-jest": "28.0.8",
78
+ "ts-jest": "29.0.3",
71
79
  "typescript": "4.8.4"
72
80
  },
73
81
  "publishConfig": {