@prezly/theme-kit-nextjs 3.3.1 → 4.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/README.md +5 -4
  2. package/build/adapter-nextjs/api-handlers/fetchGalleries.js +1 -1
  3. package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
  4. package/build/adapter-nextjs/api-handlers/fetchStories.js +1 -1
  5. package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
  6. package/build/adapter-nextjs/getNewsroomServerSideProps.d.ts +1 -1
  7. package/build/adapter-nextjs/getNewsroomServerSideProps.js +1 -1
  8. package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -1
  9. package/build/adapter-nextjs/getNewsroomStaticProps.d.ts +1 -1
  10. package/build/adapter-nextjs/getNewsroomStaticProps.js +1 -1
  11. package/build/adapter-nextjs/getNewsroomStaticProps.js.map +1 -1
  12. package/build/adapter-nextjs/page-props/category.js +6 -7
  13. package/build/adapter-nextjs/page-props/category.js.map +1 -1
  14. package/build/adapter-nextjs/page-props/gallery.js +3 -3
  15. package/build/adapter-nextjs/page-props/gallery.js.map +1 -1
  16. package/build/adapter-nextjs/page-props/galleryAlbum.js +1 -1
  17. package/build/adapter-nextjs/page-props/galleryAlbum.js.map +1 -1
  18. package/build/adapter-nextjs/page-props/home.js +3 -3
  19. package/build/adapter-nextjs/page-props/home.js.map +1 -1
  20. package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +1 -1
  21. package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -1
  22. package/build/adapter-nextjs/page-props/story.js +3 -3
  23. package/build/adapter-nextjs/page-props/story.js.map +1 -1
  24. package/build/adapter-nextjs/page-props/storyPreview.js +1 -1
  25. package/build/adapter-nextjs/page-props/storyPreview.js.map +1 -1
  26. package/build/adapter-nextjs/processRequest.js +3 -2
  27. package/build/adapter-nextjs/processRequest.js.map +1 -1
  28. package/build/components-nextjs/PageSeo/PageSeo.js +8 -10
  29. package/build/components-nextjs/PageSeo/PageSeo.js.map +1 -1
  30. package/build/components-nextjs/PageSeo/index.d.ts +0 -1
  31. package/build/components-nextjs/PageSeo/index.js +0 -15
  32. package/build/components-nextjs/PageSeo/index.js.map +1 -1
  33. package/build/components-nextjs/PageSeo/lib/index.d.ts +1 -0
  34. package/build/components-nextjs/PageSeo/lib/index.js +6 -0
  35. package/build/components-nextjs/PageSeo/lib/index.js.map +1 -0
  36. package/build/components-nextjs/document.js +4 -4
  37. package/build/components-nextjs/document.js.map +1 -1
  38. package/build/data-fetching/NextPrezlyApi.d.ts +8 -0
  39. package/build/data-fetching/NextPrezlyApi.js +40 -0
  40. package/build/data-fetching/NextPrezlyApi.js.map +1 -0
  41. package/build/data-fetching/getNextPrezlyApi.d.ts +4 -0
  42. package/build/data-fetching/getNextPrezlyApi.js +21 -0
  43. package/build/data-fetching/getNextPrezlyApi.js.map +1 -0
  44. package/build/data-fetching/index.d.ts +1 -3
  45. package/build/data-fetching/index.js +3 -17
  46. package/build/data-fetching/index.js.map +1 -1
  47. package/build/index.d.ts +0 -2
  48. package/build/index.js +0 -2
  49. package/build/index.js.map +1 -1
  50. package/build/infinite-loading/useInfiniteStoriesLoading.js.map +1 -1
  51. package/build/intl/index.d.ts +0 -3
  52. package/build/intl/index.js +0 -8
  53. package/build/intl/index.js.map +1 -1
  54. package/build/intl/languages.d.ts +1 -44
  55. package/build/intl/languages.js +8 -151
  56. package/build/intl/languages.js.map +1 -1
  57. package/build/intl/locale.d.ts +0 -11
  58. package/build/intl/locale.js +3 -93
  59. package/build/intl/locale.js.map +1 -1
  60. package/build/newsroom-context/context.d.ts +2 -2
  61. package/build/newsroom-context/context.js +2 -2
  62. package/build/newsroom-context/context.js.map +1 -1
  63. package/build/newsroom-context/hooks/useAlgoliaSettings.d.ts +1 -1
  64. package/build/newsroom-context/hooks/useCurrentLocale.d.ts +1 -1
  65. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.d.ts +1 -1
  66. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +3 -3
  67. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
  68. package/build/newsroom-context/hooks/useGetTranslationUrl.d.ts +1 -1
  69. package/build/newsroom-context/hooks/useGetTranslationUrl.js +3 -3
  70. package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
  71. package/build/newsroom-context/index.d.ts +1 -1
  72. package/build/newsroom-context/index.js.map +1 -1
  73. package/build/types.d.ts +0 -29
  74. package/package.json +18 -33
  75. package/src/__mocks__/languages.ts +1 -1
  76. package/src/adapter-nextjs/api-handlers/fetchGalleries.ts +2 -2
  77. package/src/adapter-nextjs/api-handlers/fetchStories.ts +2 -2
  78. package/src/adapter-nextjs/getNewsroomServerSideProps.ts +2 -2
  79. package/src/adapter-nextjs/getNewsroomStaticProps.ts +2 -2
  80. package/src/adapter-nextjs/page-props/category.ts +3 -4
  81. package/src/adapter-nextjs/page-props/gallery.ts +1 -1
  82. package/src/adapter-nextjs/page-props/galleryAlbum.ts +2 -2
  83. package/src/adapter-nextjs/page-props/home.ts +1 -1
  84. package/src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts +2 -2
  85. package/src/adapter-nextjs/page-props/story.ts +4 -4
  86. package/src/adapter-nextjs/page-props/storyPreview.ts +2 -2
  87. package/src/adapter-nextjs/processRequest.ts +2 -1
  88. package/src/components-nextjs/PageSeo/PageSeo.tsx +7 -5
  89. package/src/components-nextjs/PageSeo/index.ts +0 -1
  90. package/src/components-nextjs/PageSeo/lib/index.ts +1 -0
  91. package/src/components-nextjs/document.tsx +1 -1
  92. package/src/data-fetching/NextPrezlyApi.ts +57 -0
  93. package/src/data-fetching/{api/getPrezlyApi.ts → getNextPrezlyApi.ts} +5 -6
  94. package/src/data-fetching/index.ts +1 -3
  95. package/src/index.ts +0 -2
  96. package/src/infinite-loading/useInfiniteStoriesLoading.ts +1 -1
  97. package/src/intl/index.ts +0 -3
  98. package/src/intl/languages.test.ts +1 -196
  99. package/src/intl/languages.ts +8 -201
  100. package/src/intl/locale.test.ts +1 -54
  101. package/src/intl/locale.ts +1 -106
  102. package/src/newsroom-context/context.tsx +2 -3
  103. package/src/newsroom-context/hooks/useGetLinkLocaleSlug.ts +1 -2
  104. package/src/newsroom-context/hooks/useGetTranslationUrl.ts +2 -3
  105. package/src/newsroom-context/index.ts +1 -1
  106. package/src/types.ts +0 -35
  107. package/build/components-nextjs/PageSeo/lib/types.d.ts +0 -4
  108. package/build/components-nextjs/PageSeo/lib/types.js +0 -3
  109. package/build/components-nextjs/PageSeo/lib/types.js.map +0 -1
  110. package/build/data-fetching/api/PrezlyApi.d.ts +0 -57
  111. package/build/data-fetching/api/PrezlyApi.js +0 -200
  112. package/build/data-fetching/api/PrezlyApi.js.map +0 -1
  113. package/build/data-fetching/api/getPrezlyApi.d.ts +0 -4
  114. package/build/data-fetching/api/getPrezlyApi.js +0 -21
  115. package/build/data-fetching/api/getPrezlyApi.js.map +0 -1
  116. package/build/data-fetching/api/index.d.ts +0 -1
  117. package/build/data-fetching/api/index.js +0 -18
  118. package/build/data-fetching/api/index.js.map +0 -1
  119. package/build/data-fetching/api/lib.d.ts +0 -11
  120. package/build/data-fetching/api/lib.js +0 -20
  121. package/build/data-fetching/api/lib.js.map +0 -1
  122. package/build/data-fetching/api/queries.d.ts +0 -46
  123. package/build/data-fetching/api/queries.js +0 -56
  124. package/build/data-fetching/api/queries.js.map +0 -1
  125. package/build/data-fetching/lib/getAlgoliaSettings.d.ts +0 -4
  126. package/build/data-fetching/lib/getAlgoliaSettings.js +0 -22
  127. package/build/data-fetching/lib/getAlgoliaSettings.js.map +0 -1
  128. package/build/data-fetching/lib/getEnvVariables.d.ts +0 -4
  129. package/build/data-fetching/lib/getEnvVariables.js +0 -44
  130. package/build/data-fetching/lib/getEnvVariables.js.map +0 -1
  131. package/build/data-fetching/lib/index.d.ts +0 -4
  132. package/build/data-fetching/lib/index.js +0 -12
  133. package/build/data-fetching/lib/index.js.map +0 -1
  134. package/build/data-fetching/lib/isSdkError.d.ts +0 -2
  135. package/build/data-fetching/lib/isSdkError.js +0 -8
  136. package/build/data-fetching/lib/isSdkError.js.map +0 -1
  137. package/build/data-fetching/lib/isUuid.d.ts +0 -1
  138. package/build/data-fetching/lib/isUuid.js +0 -9
  139. package/build/data-fetching/lib/isUuid.js.map +0 -1
  140. package/build/data-fetching/types.d.ts +0 -13
  141. package/build/data-fetching/types.js +0 -3
  142. package/build/data-fetching/types.js.map +0 -1
  143. package/build/intl/getFallbackLocale.d.ts +0 -10
  144. package/build/intl/getFallbackLocale.js +0 -24
  145. package/build/intl/getFallbackLocale.js.map +0 -1
  146. package/build/intl/localeConfig.d.ts +0 -2
  147. package/build/intl/localeConfig.js +0 -20
  148. package/build/intl/localeConfig.js.map +0 -1
  149. package/build/intl/localeList.d.ts +0 -2
  150. package/build/intl/localeList.js +0 -112
  151. package/build/intl/localeList.js.map +0 -1
  152. package/build/intl/localeObject.d.ts +0 -50
  153. package/build/intl/localeObject.js +0 -98
  154. package/build/intl/localeObject.js.map +0 -1
  155. package/build/seo/getAlternateLanguageLinks.d.ts +0 -4
  156. package/build/seo/getAlternateLanguageLinks.js +0 -84
  157. package/build/seo/getAlternateLanguageLinks.js.map +0 -1
  158. package/build/seo/index.d.ts +0 -1
  159. package/build/seo/index.js +0 -18
  160. package/build/seo/index.js.map +0 -1
  161. package/build/seo/utils/bindLanguagesWithLocales.d.ts +0 -11
  162. package/build/seo/utils/bindLanguagesWithLocales.js +0 -23
  163. package/build/seo/utils/bindLanguagesWithLocales.js.map +0 -1
  164. package/build/seo/utils/createAlternateLanguageLink.d.ts +0 -5
  165. package/build/seo/utils/createAlternateLanguageLink.js +0 -15
  166. package/build/seo/utils/createAlternateLanguageLink.js.map +0 -1
  167. package/build/tsconfig.tsbuildinfo +0 -1
  168. package/build/utils/boilerplate.d.ts +0 -4
  169. package/build/utils/boilerplate.js +0 -27
  170. package/build/utils/boilerplate.js.map +0 -1
  171. package/build/utils/constants.d.ts +0 -3
  172. package/build/utils/constants.js +0 -7
  173. package/build/utils/constants.js.map +0 -1
  174. package/build/utils/getAssetsUrl.d.ts +0 -5
  175. package/build/utils/getAssetsUrl.js +0 -13
  176. package/build/utils/getAssetsUrl.js.map +0 -1
  177. package/build/utils/getDataRequestLink.d.ts +0 -3
  178. package/build/utils/getDataRequestLink.js +0 -12
  179. package/build/utils/getDataRequestLink.js.map +0 -1
  180. package/build/utils/getLocalizedCategoryData.d.ts +0 -10
  181. package/build/utils/getLocalizedCategoryData.js +0 -37
  182. package/build/utils/getLocalizedCategoryData.js.map +0 -1
  183. package/build/utils/getNewsroomLogoUrl.d.ts +0 -3
  184. package/build/utils/getNewsroomLogoUrl.js +0 -22
  185. package/build/utils/getNewsroomLogoUrl.js.map +0 -1
  186. package/build/utils/getPrivacyPortalUrl.d.ts +0 -8
  187. package/build/utils/getPrivacyPortalUrl.js +0 -13
  188. package/build/utils/getPrivacyPortalUrl.js.map +0 -1
  189. package/build/utils/getStoryPublicationDate.d.ts +0 -3
  190. package/build/utils/getStoryPublicationDate.js +0 -14
  191. package/build/utils/getStoryPublicationDate.js.map +0 -1
  192. package/build/utils/getUploadcareGroupUrl.d.ts +0 -8
  193. package/build/utils/getUploadcareGroupUrl.js +0 -17
  194. package/build/utils/getUploadcareGroupUrl.js.map +0 -1
  195. package/build/utils/index.d.ts +0 -10
  196. package/build/utils/index.js +0 -27
  197. package/build/utils/index.js.map +0 -1
  198. package/build/utils/isEmbargoStory.d.ts +0 -6
  199. package/build/utils/isEmbargoStory.js +0 -8
  200. package/build/utils/isEmbargoStory.js.map +0 -1
  201. package/src/@types/global.d.ts +0 -7
  202. package/src/__mocks__/story.ts +0 -359
  203. package/src/components-nextjs/PageSeo/lib/types.ts +0 -4
  204. package/src/data-fetching/api/PrezlyApi.ts +0 -312
  205. package/src/data-fetching/api/index.ts +0 -1
  206. package/src/data-fetching/api/lib.ts +0 -24
  207. package/src/data-fetching/api/queries.ts +0 -59
  208. package/src/data-fetching/lib/getAlgoliaSettings.ts +0 -29
  209. package/src/data-fetching/lib/getEnvVariables.ts +0 -46
  210. package/src/data-fetching/lib/index.ts +0 -4
  211. package/src/data-fetching/lib/isSdkError.ts +0 -5
  212. package/src/data-fetching/lib/isUuid.ts +0 -5
  213. package/src/data-fetching/types.ts +0 -14
  214. package/src/intl/getFallbackLocale.ts +0 -29
  215. package/src/intl/localeConfig.js +0 -23
  216. package/src/intl/localeList.js +0 -110
  217. package/src/intl/localeObject.test.ts +0 -81
  218. package/src/intl/localeObject.ts +0 -107
  219. package/src/seo/getAlternateLanguageLinks.test.ts +0 -164
  220. package/src/seo/getAlternateLanguageLinks.ts +0 -115
  221. package/src/seo/index.ts +0 -1
  222. package/src/seo/utils/bindLanguagesWithLocales.ts +0 -31
  223. package/src/seo/utils/createAlternateLanguageLink.ts +0 -17
  224. package/src/utils/boilerplate.ts +0 -30
  225. package/src/utils/constants.ts +0 -3
  226. package/src/utils/getAssetsUrl.test.ts +0 -9
  227. package/src/utils/getAssetsUrl.ts +0 -9
  228. package/src/utils/getDataRequestLink.ts +0 -14
  229. package/src/utils/getLocalizedCategoryData.ts +0 -47
  230. package/src/utils/getNewsroomLogoUrl.ts +0 -22
  231. package/src/utils/getPrivacyPortalUrl.ts +0 -25
  232. package/src/utils/getStoryPublicationDate.tsx +0 -15
  233. package/src/utils/getUploadcareGroupUrl.ts +0 -13
  234. package/src/utils/index.ts +0 -10
  235. package/src/utils/isEmbargoStory.ts +0 -10
@@ -1,25 +0,0 @@
1
- import type { Newsroom } from '@prezly/sdk';
2
-
3
- import type { LocaleObject } from '../intl';
4
-
5
- type PrivacyPortalUrlOptions = {
6
- email?: string;
7
- action?: 'data-request' | 'subscribe' | 'unsubscribe';
8
- };
9
-
10
- export function getPrivacyPortalUrl(
11
- newsroom: Newsroom,
12
- locale: LocaleObject,
13
- options?: PrivacyPortalUrlOptions,
14
- ) {
15
- const { email, action = 'subscribe' } = options || {};
16
-
17
- const url = new URL(
18
- `/${locale.toUrlSlug()}/newsroom/${newsroom.uuid}/${action}`,
19
- 'https://privacy.prezly.com',
20
- );
21
- if (email) {
22
- url.searchParams.append('email', email);
23
- }
24
- return url.toString();
25
- }
@@ -1,15 +0,0 @@
1
- import type { Story } from '@prezly/sdk';
2
-
3
- import type { AlgoliaStory } from '../types';
4
-
5
- export function getStoryPublicationDate(story: Story | AlgoliaStory): Date | null {
6
- const { published_at } = story;
7
-
8
- if (!published_at) {
9
- return null;
10
- }
11
-
12
- return typeof published_at === 'string'
13
- ? new Date(published_at)
14
- : new Date(published_at * 1000);
15
- }
@@ -1,13 +0,0 @@
1
- import { ASSETS_URL } from './constants';
2
-
3
- /**
4
- * This method constructs a URL to download all images in the Gallery as a single archive.
5
- *
6
- * @param uuid Gallery UUID
7
- * @param title Filename for the saved archive. Usually it is the Gallery title.
8
- * @returns URL to an archive containing all of the images in the Gallery.
9
- */
10
- export function getUploadcareGroupUrl(uuid: string, title: string) {
11
- // UploadCare doesn't like slashes in filenames even in encoded form.
12
- return `${ASSETS_URL}/${uuid}/archive/zip/${encodeURIComponent(title.replace(/\//g, '_'))}.zip`;
13
- }
@@ -1,10 +0,0 @@
1
- export * from './boilerplate';
2
- export * from './constants';
3
- export * from './getAssetsUrl';
4
- export * from './getDataRequestLink';
5
- export * from './getLocalizedCategoryData';
6
- export * from './getNewsroomLogoUrl';
7
- export * from './getPrivacyPortalUrl';
8
- export * from './getStoryPublicationDate';
9
- export * from './getUploadcareGroupUrl';
10
- export * from './isEmbargoStory';
@@ -1,10 +0,0 @@
1
- import type { Story } from '@prezly/sdk';
2
-
3
- export type EmbargoStory = Omit<Story, 'is_embargo' | 'published_at'> & {
4
- is_embargo: true;
5
- published_at: string;
6
- };
7
-
8
- export function isEmbargoStory(story: Story): story is EmbargoStory {
9
- return story.is_embargo && Boolean(story.published_at);
10
- }