@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
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useGetTranslationUrl = void 0;
4
4
  const sdk_1 = require("@prezly/sdk");
5
+ const theme_kit_core_1 = require("@prezly/theme-kit-core");
5
6
  const router_1 = require("next/router");
6
7
  const react_1 = require("react");
7
- const utils_1 = require("../../utils");
8
8
  const useCurrentCategory_1 = require("./useCurrentCategory");
9
9
  const useCurrentStory_1 = require("./useCurrentStory");
10
10
  // Pulled from SDK types to not leak the `@prezly/sdk` dependency into the client bundle
@@ -37,8 +37,8 @@ function getAllowedTranslationVisibilityValues(story) {
37
37
  */
38
38
  function getTranslationUrl(locale, path, currentCategory, currentStory, noFallback) {
39
39
  if (currentCategory) {
40
- if ((0, utils_1.getCategoryHasTranslation)(currentCategory, locale)) {
41
- return (0, utils_1.getCategoryUrl)(currentCategory, locale);
40
+ if ((0, theme_kit_core_1.getCategoryHasTranslation)(currentCategory, locale)) {
41
+ return (0, theme_kit_core_1.getCategoryUrl)(currentCategory, locale);
42
42
  }
43
43
  if (noFallback) {
44
44
  return '';
@@ -1 +1 @@
1
- {"version":3,"file":"useGetTranslationUrl.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetTranslationUrl.ts"],"names":[],"mappings":";;;AACA,qCAAoC;AACpC,wCAAwC;AACxC,iCAAoC;AAGpC,uCAAwE;AAExE,6DAA0D;AAC1D,uDAAoD;AAEpD,wFAAwF;AACxF,wEAAwE;AACxE,IAAK,UAKJ;AALD,WAAK,UAAU;IACX,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,2CAA6B,CAAA;AACjC,CAAC,EALI,UAAU,KAAV,UAAU,QAKd;AAED,SAAS,qCAAqC,CAAC,KAAoB;IAC/D,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAE7B,QAAQ,UAAU,EAAE;QAChB,KAAK,UAAU,CAAC,OAAO;YACnB,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,UAAU,CAAC,OAAO;YACnB,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,UAAU,CAAC,YAAY;YACxB,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5E;YACI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;KAClC;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CACtB,MAAoB,EACpB,IAAY,EACZ,eAA0B,EAC1B,YAA4B,EAC5B,UAAoB;IAEpB,IAAI,eAAe,EAAE;QACjB,IAAI,IAAA,iCAAyB,EAAC,eAAe,EAAE,MAAM,CAAC,EAAE;YACpD,OAAO,IAAA,sBAAc,EAAC,eAAe,EAAE,MAAM,CAAC,CAAC;SAClD;QAED,IAAI,UAAU,EAAE;YACZ,OAAO,EAAE,CAAC;SACb;QAED,OAAO,GAAG,CAAC;KACd;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAE7C,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC5D,MAAM,uBAAuB,GAAG,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAEpF,MAAM,eAAe,GAAG,YAAY,CAAC,YAAY,CAAC,IAAI,CAClD,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,EAAE,CAC1C,OAAO,CAAC,MAAM,KAAK,UAAU;YAC7B,WAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC;YACnC,uBAAuB,CAAC,QAAQ,CAAC,UAAU,CAAC,CACnD,CAAC;QACF,IAAI,eAAe,EAAE;YACjB,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC;SACrC;QAED,IAAI,UAAU,EAAE;YACZ,OAAO,EAAE,CAAC;SACb;QAED,OAAO,GAAG,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB;IAChC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;IAC/B,MAAM,eAAe,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAC7C,MAAM,YAAY,GAAG,IAAA,iCAAe,GAAE,CAAC;IAEvC,OAAO,IAAA,mBAAW,EACd,CAAC,MAAoB,EAAE,UAAoB,EAAE,EAAE,CAC3C,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,CAAC,EAChF,CAAC,MAAM,EAAE,eAAe,EAAE,YAAY,CAAC,CAC1C,CAAC;AACN,CAAC;AAVD,oDAUC"}
1
+ {"version":3,"file":"useGetTranslationUrl.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetTranslationUrl.ts"],"names":[],"mappings":";;;AACA,qCAAoC;AAEpC,2DAAmF;AACnF,wCAAwC;AACxC,iCAAoC;AAEpC,6DAA0D;AAC1D,uDAAoD;AAEpD,wFAAwF;AACxF,wEAAwE;AACxE,IAAK,UAKJ;AALD,WAAK,UAAU;IACX,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,2CAA6B,CAAA;AACjC,CAAC,EALI,UAAU,KAAV,UAAU,QAKd;AAED,SAAS,qCAAqC,CAAC,KAAoB;IAC/D,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAE7B,QAAQ,UAAU,EAAE;QAChB,KAAK,UAAU,CAAC,OAAO;YACnB,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,UAAU,CAAC,OAAO;YACnB,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,UAAU,CAAC,YAAY;YACxB,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5E;YACI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;KAClC;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CACtB,MAAoB,EACpB,IAAY,EACZ,eAA0B,EAC1B,YAA4B,EAC5B,UAAoB;IAEpB,IAAI,eAAe,EAAE;QACjB,IAAI,IAAA,0CAAyB,EAAC,eAAe,EAAE,MAAM,CAAC,EAAE;YACpD,OAAO,IAAA,+BAAc,EAAC,eAAe,EAAE,MAAM,CAAC,CAAC;SAClD;QAED,IAAI,UAAU,EAAE;YACZ,OAAO,EAAE,CAAC;SACb;QAED,OAAO,GAAG,CAAC;KACd;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAE7C,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC5D,MAAM,uBAAuB,GAAG,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAEpF,MAAM,eAAe,GAAG,YAAY,CAAC,YAAY,CAAC,IAAI,CAClD,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,EAAE,CAC1C,OAAO,CAAC,MAAM,KAAK,UAAU;YAC7B,WAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC;YACnC,uBAAuB,CAAC,QAAQ,CAAC,UAAU,CAAC,CACnD,CAAC;QACF,IAAI,eAAe,EAAE;YACjB,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC;SACrC;QAED,IAAI,UAAU,EAAE;YACZ,OAAO,EAAE,CAAC;SACb;QAED,OAAO,GAAG,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB;IAChC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;IAC/B,MAAM,eAAe,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAC7C,MAAM,YAAY,GAAG,IAAA,iCAAe,GAAE,CAAC;IAEvC,OAAO,IAAA,mBAAW,EACd,CAAC,MAAoB,EAAE,UAAoB,EAAE,EAAE,CAC3C,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,CAAC,EAChF,CAAC,MAAM,EAAE,eAAe,EAAE,YAAY,CAAC,CAC1C,CAAC;AACN,CAAC;AAVD,oDAUC"}
@@ -1,2 +1,2 @@
1
- export { NewsroomContext, NewsroomContextProvider, NewsroomContextProps } from './context';
1
+ export { NewsroomContext, NewsroomContextProvider, type NewsroomContextProps } from './context';
2
2
  export * from './hooks';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/newsroom-context/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA2F;AAAlF,0GAAA,eAAe,OAAA;AAAE,kHAAA,uBAAuB,OAAA;AACjD,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/newsroom-context/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAgG;AAAvF,0GAAA,eAAe,OAAA;AAAE,kHAAA,uBAAuB,OAAA;AACjD,0CAAwB"}
package/build/types.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { CultureRef, Story } from '@prezly/sdk';
2
1
  import type { NewsroomContextProps } from './newsroom-context';
3
2
  export interface ServerSidePageProps {
4
3
  /**
@@ -13,31 +12,3 @@ export interface ServerSidePageProps {
13
12
  export interface PageProps {
14
13
  newsroomContextProps: NewsroomContextProps;
15
14
  }
16
- /**
17
- * Categories in Algolia index are stored in a simplified format, with `slug` and `name` properties already saved in the correct locale for the story search result.
18
- */
19
- export interface AlgoliaCategoryRef {
20
- id: number;
21
- name: string;
22
- slug: string;
23
- }
24
- /**
25
- * Stories in Algolia index are stored in a simplified format, with only minimal subset of fields.
26
- */
27
- export type AlgoliaStory = Pick<Story, 'uuid' | 'slug' | 'title' | 'subtitle'> & Pick<Story.ExtraFields, 'thumbnail_image'> & {
28
- content_text: string;
29
- updated_at: number;
30
- published_at: number;
31
- culture: Pick<CultureRef, 'code' | 'name' | 'native_name' | 'language_code'>;
32
- categories: AlgoliaCategoryRef[];
33
- };
34
- export interface SdkError extends Error {
35
- status: number;
36
- statusText: string;
37
- payload: {
38
- errors: {
39
- reason: string;
40
- };
41
- message: string;
42
- };
43
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/theme-kit-nextjs",
3
- "version": "3.3.1",
3
+ "version": "4.0.0-alpha.0",
4
4
  "description": "Data layer and utility library for developing Prezly themes with NextJS",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -18,60 +18,45 @@
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git+https://github.com/prezly/theme-kit-nextjs.git"
21
+ "url": "git+https://github.com/prezly/theme-kit-js.git",
22
+ "directory": "packages/nextjs"
22
23
  },
23
- "keywords": [],
24
- "author": "",
24
+ "keywords": [
25
+ "prezly",
26
+ "nextjs"
27
+ ],
28
+ "author": "Prezly Team",
25
29
  "license": "MIT",
26
30
  "bugs": {
27
- "url": "https://github.com/prezly/theme-kit-nextjs/issues"
31
+ "url": "https://github.com/prezly/theme-kit-js/issues"
28
32
  },
29
- "homepage": "https://github.com/prezly/theme-kit-nextjs#readme",
33
+ "homepage": "https://github.com/prezly/theme-kit-js/tree/main/packages/nextjs#readme",
30
34
  "scripts": {
31
- "clean": "rimraf build/ node_modules/",
35
+ "prebuild": "rimraf build/* *.tsbuildinfo",
32
36
  "build": "tsc --project .",
33
- "watch": "tsc --watch --preserveWatchOutput --project .",
34
- "test": "jest",
37
+ "dev": "tsc --watch --preserveWatchOutput --project .",
35
38
  "typecheck": "tsc --noEmit --incremental --project .",
36
39
  "lint": "eslint src",
37
- "lint:fix": "npm run lint -- --fix",
38
- "prettier": "prettier --check './**/*.(js|ts|tsx|css)'",
39
- "prettier:fix": "npm run prettier -- --write --no-list-different",
40
- "check": "npm run lint && npm run typecheck",
41
- "prerelease": "npm run clean && npm install && npm run check && npm run build",
42
- "release": "np",
43
- "release:preview": "npm run prerelease && np --any-branch --no-release-draft --tag=preview"
40
+ "test": "jest"
44
41
  },
45
42
  "peerDependencies": {
43
+ "@prezly/theme-kit-core": "*",
46
44
  "next": "^12.x || ^13.x",
47
45
  "react": "^17.x || ^18.x",
48
46
  "react-dom": "^17.x || ^18.x"
49
47
  },
50
48
  "dependencies": {
51
49
  "@prezly/sdk": "^11.11.0",
52
- "@prezly/uploadcare": "^2.3.4",
53
50
  "@react-hookz/web": "^16.0.0",
54
- "next-seo": "^5.4.0",
55
- "parse-data-url": "^4.0.1"
51
+ "next-seo": "^5.4.0"
56
52
  },
57
53
  "devDependencies": {
58
- "@prezly/eslint-config": "4.4.1",
59
54
  "@sentry/nextjs": "7.45.0",
60
- "@types/jest": "29.5.0",
61
- "@types/node": "17.0.14",
62
- "@types/parse-data-url": "3.0.0",
63
- "@types/react": "18.0.31",
64
- "@types/react-dom": "18.0.11",
65
- "eslint": "8.36.0",
66
- "jest": "29.5.0",
67
- "np": "7.6.4",
68
- "prettier": "2.8.7",
69
- "rimraf": "3.0.2",
70
- "ts-jest": "29.0.5",
71
- "typescript": "4.9.5"
55
+ "rimraf": "3.0.2"
72
56
  },
73
57
  "publishConfig": {
74
58
  "access": "public"
75
59
  },
76
- "sideEffects": false
60
+ "sideEffects": false,
61
+ "gitHead": "bada4e4ca15d085f19101ac4aa5ecdc7a02c2ab6"
77
62
  }
@@ -1,4 +1,4 @@
1
- import { type NewsroomLanguageSettings, Culture } from '@prezly/sdk';
1
+ import { Culture, type NewsroomLanguageSettings } from '@prezly/sdk';
2
2
 
3
3
  /**
4
4
  * Pulled from The Good Newsroom (with some additions)
@@ -1,6 +1,6 @@
1
1
  import type { NextApiRequest, NextApiResponse } from 'next';
2
2
 
3
- import { getPrezlyApi } from '../../data-fetching';
3
+ import { getNextPrezlyApi } from '../../data-fetching';
4
4
 
5
5
  export async function fetchGalleries(req: NextApiRequest, res: NextApiResponse) {
6
6
  if (req.method !== 'POST') {
@@ -11,7 +11,7 @@ export async function fetchGalleries(req: NextApiRequest, res: NextApiResponse)
11
11
  const { page, pageSize } = req.body;
12
12
 
13
13
  try {
14
- const api = getPrezlyApi(req);
14
+ const api = getNextPrezlyApi(req);
15
15
 
16
16
  const { galleries } = await api.getGalleries({ page, pageSize });
17
17
 
@@ -1,6 +1,6 @@
1
1
  import type { NextApiRequest, NextApiResponse } from 'next';
2
2
 
3
- import { getPrezlyApi } from '../../data-fetching';
3
+ import { getNextPrezlyApi } from '../../data-fetching';
4
4
 
5
5
  export async function fetchStories(req: NextApiRequest, res: NextApiResponse) {
6
6
  if (req.method !== 'POST') {
@@ -12,7 +12,7 @@ export async function fetchStories(req: NextApiRequest, res: NextApiResponse) {
12
12
  req.body;
13
13
 
14
14
  try {
15
- const api = getPrezlyApi(req);
15
+ const api = getNextPrezlyApi(req);
16
16
 
17
17
  const { stories } = await (category
18
18
  ? api.getStoriesFromCategory(category, { page, pageSize, include, localeCode })
@@ -1,7 +1,7 @@
1
1
  import type { Story } from '@prezly/sdk';
2
2
  import type { GetServerSidePropsContext } from 'next';
3
3
 
4
- import { getPrezlyApi } from '../data-fetching';
4
+ import { getNextPrezlyApi } from '../data-fetching';
5
5
 
6
6
  interface Options {
7
7
  loadHomepageContacts?: boolean;
@@ -18,7 +18,7 @@ export async function getNewsroomServerSideProps(
18
18
  ) {
19
19
  const { req: request, locale } = context;
20
20
 
21
- const api = getPrezlyApi(request);
21
+ const api = getNextPrezlyApi(request);
22
22
  const serverSideProps = await api.getNewsroomServerSideProps(request, locale, options.story);
23
23
 
24
24
  if (options.loadHomepageContacts) {
@@ -1,7 +1,7 @@
1
1
  import type { Story } from '@prezly/sdk';
2
2
  import type { GetStaticPropsContext } from 'next';
3
3
 
4
- import { getPrezlyApi } from '../data-fetching';
4
+ import { getNextPrezlyApi } from '../data-fetching';
5
5
 
6
6
  interface Options {
7
7
  loadHomepageContacts?: boolean;
@@ -18,7 +18,7 @@ export async function getNewsroomStaticProps(
18
18
  ) {
19
19
  const { locale } = context;
20
20
 
21
- const api = getPrezlyApi();
21
+ const api = getNextPrezlyApi();
22
22
  const staticProps = await api.getNewsroomServerSideProps(undefined, locale, options.story);
23
23
 
24
24
  if (options.loadHomepageContacts) {
@@ -1,4 +1,5 @@
1
1
  import type { Story } from '@prezly/sdk';
2
+ import { DEFAULT_PAGE_SIZE, getLocalizedCategoryData, LocaleObject } from '@prezly/theme-kit-core';
2
3
  import type {
3
4
  GetServerSidePropsContext,
4
5
  GetServerSidePropsResult,
@@ -7,10 +8,8 @@ import type {
7
8
  GetStaticPropsResult,
8
9
  } from 'next';
9
10
 
10
- import { getPrezlyApi } from '../../data-fetching';
11
+ import { getNextPrezlyApi } from '../../data-fetching';
11
12
  import type { PaginationProps } from '../../infinite-loading/types';
12
- import { LocaleObject } from '../../intl';
13
- import { DEFAULT_PAGE_SIZE, getLocalizedCategoryData } from '../../utils';
14
13
  import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
15
14
  import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
16
15
  import { processRequest } from '../processRequest';
@@ -132,7 +131,7 @@ export function getCategoryPageStaticProps<
132
131
  }
133
132
 
134
133
  export async function getCategoryPageStaticPaths(): Promise<GetStaticPathsResult> {
135
- const api = getPrezlyApi();
134
+ const api = getNextPrezlyApi();
136
135
  const [categories, defaultLanguage] = await Promise.all([
137
136
  api.getCategories(),
138
137
  api.getNewsroomDefaultLanguage(),
@@ -1,4 +1,5 @@
1
1
  import type { NewsroomGallery } from '@prezly/sdk';
2
+ import { DEFAULT_GALLERY_PAGE_SIZE } from '@prezly/theme-kit-core';
2
3
  import type {
3
4
  GetServerSidePropsContext,
4
5
  GetServerSidePropsResult,
@@ -7,7 +8,6 @@ import type {
7
8
  } from 'next';
8
9
 
9
10
  import type { PaginationProps } from '../../infinite-loading/types';
10
- import { DEFAULT_GALLERY_PAGE_SIZE } from '../../utils';
11
11
  import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
12
12
  import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
13
13
  import { processRequest } from '../processRequest';
@@ -7,7 +7,7 @@ import type {
7
7
  GetStaticPropsResult,
8
8
  } from 'next';
9
9
 
10
- import { getPrezlyApi } from '../../data-fetching';
10
+ import { getNextPrezlyApi } from '../../data-fetching';
11
11
  import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
12
12
  import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
13
13
  import { processRequest } from '../processRequest';
@@ -77,7 +77,7 @@ export function getGalleryAlbumPageStaticProps<CustomProps extends Record<string
77
77
  }
78
78
 
79
79
  export async function getGalleryAlbumPageStaticPaths(): Promise<GetStaticPathsResult> {
80
- const api = getPrezlyApi();
80
+ const api = getNextPrezlyApi();
81
81
  const { galleries } = await api.getGalleries({});
82
82
 
83
83
  const paths = galleries.map(({ uuid }) => ({ params: { uuid } }));
@@ -1,4 +1,5 @@
1
1
  import type { Story } from '@prezly/sdk';
2
+ import { DEFAULT_PAGE_SIZE } from '@prezly/theme-kit-core';
2
3
  import type {
3
4
  GetServerSidePropsContext,
4
5
  GetServerSidePropsResult,
@@ -7,7 +8,6 @@ import type {
7
8
  } from 'next';
8
9
 
9
10
  import type { PaginationProps } from '../../infinite-loading/types';
10
- import { DEFAULT_PAGE_SIZE } from '../../utils';
11
11
  import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
12
12
  import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
13
13
  import { processRequest } from '../processRequest';
@@ -1,6 +1,6 @@
1
1
  import type { NextPageContext } from 'next';
2
2
 
3
- import { getPrezlyApi } from '../../../data-fetching';
3
+ import { getNextPrezlyApi } from '../../../data-fetching';
4
4
 
5
5
  import { createPaths } from './createPaths';
6
6
  import { SitemapBuilder } from './SitemapBuilder';
@@ -20,7 +20,7 @@ export function getSitemapServerSideProps(
20
20
 
21
21
  const baseUrl = req.headers.host || '/';
22
22
 
23
- const api = getPrezlyApi(req);
23
+ const api = getNextPrezlyApi(req);
24
24
  const stories = await api.getAllStories({
25
25
  pinning: options.pinning ?? false,
26
26
  });
@@ -5,7 +5,7 @@ import type {
5
5
  GetStaticPropsResult,
6
6
  } from 'next';
7
7
 
8
- import { getPrezlyApi } from '../../data-fetching';
8
+ import { getNextPrezlyApi } from '../../data-fetching';
9
9
  import { DUMMY_DEFAULT_LOCALE } from '../../intl';
10
10
  import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
11
11
  import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
@@ -20,7 +20,7 @@ export function getStoryPageServerSideProps<CustomProps extends Record<string, a
20
20
  return async function getServerSideProps(
21
21
  context: GetServerSidePropsContext,
22
22
  ): Promise<GetServerSidePropsResult<CustomProps>> {
23
- const api = getPrezlyApi(context.req);
23
+ const api = getNextPrezlyApi(context.req);
24
24
 
25
25
  const { slug } = context.params as { slug?: string };
26
26
  const story = slug ? await api.getStoryBySlug(slug) : null;
@@ -57,7 +57,7 @@ export function getStoryPageStaticProps<CustomProps extends Record<string, any>>
57
57
  return async function getStaticProps(
58
58
  context: GetStaticPropsContext,
59
59
  ): Promise<GetStaticPropsResult<CustomProps>> {
60
- const api = getPrezlyApi();
60
+ const api = getNextPrezlyApi();
61
61
 
62
62
  const { slug } = context.params as { slug?: string };
63
63
  const story = slug ? await api.getStoryBySlug(slug) : null;
@@ -82,7 +82,7 @@ export function getStoryPageStaticProps<CustomProps extends Record<string, any>>
82
82
  }
83
83
 
84
84
  export async function getStoryPageStaticPaths(options: { pinning?: boolean } = {}) {
85
- const api = getPrezlyApi();
85
+ const api = getNextPrezlyApi();
86
86
  const stories = await api.getAllStories({
87
87
  pinning: options.pinning ?? false,
88
88
  });
@@ -1,6 +1,6 @@
1
1
  import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
2
2
 
3
- import { getPrezlyApi } from '../../data-fetching';
3
+ import { getNextPrezlyApi } from '../../data-fetching';
4
4
  import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
5
5
  import { processRequest } from '../processRequest';
6
6
 
@@ -12,7 +12,7 @@ export function getStoryPreviewPageServerSideProps<CustomProps extends Record<st
12
12
  return async function getServerSideProps(
13
13
  context: GetServerSidePropsContext,
14
14
  ): Promise<GetServerSidePropsResult<CustomProps>> {
15
- const api = getPrezlyApi(context.req);
15
+ const api = getNextPrezlyApi(context.req);
16
16
  const { uuid } = context.params as { uuid: string };
17
17
  const story = await api.getStory(uuid);
18
18
  if (!story) {
@@ -1,6 +1,7 @@
1
+ import { getShortestLocaleCode, LocaleObject } from '@prezly/theme-kit-core';
1
2
  import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
2
3
 
3
- import { getRedirectToCanonicalLocale, getShortestLocaleCode, LocaleObject } from '../intl';
4
+ import { getRedirectToCanonicalLocale } from '../intl';
4
5
  import type { PageProps, ServerSidePageProps } from '../types';
5
6
 
6
7
  /**
@@ -1,9 +1,14 @@
1
+ import {
2
+ getAlternateLanguageLinks,
3
+ getNewsroomLogoUrl,
4
+ getUsedLanguages,
5
+ } from '@prezly/theme-kit-core';
6
+ import type { AlternateLanguageLink } from '@prezly/theme-kit-core';
1
7
  import { NextSeo } from 'next-seo';
2
8
  import type { NextSeoProps } from 'next-seo';
3
9
  import { useRouter } from 'next/router';
4
10
  import { useMemo } from 'react';
5
11
 
6
- import { getUsedLanguages } from '../../intl';
7
12
  import {
8
13
  useCompanyInformation,
9
14
  useCurrentLocale,
@@ -13,11 +18,8 @@ import {
13
18
  useLanguages,
14
19
  useNewsroom,
15
20
  } from '../../newsroom-context';
16
- import { getAlternateLanguageLinks } from '../../seo';
17
- import { getNewsroomLogoUrl } from '../../utils';
18
21
 
19
- import { getAbsoluteUrl } from './lib/getAbsoluteUrl';
20
- import type { AlternateLanguageLink } from './lib/types';
22
+ import { getAbsoluteUrl } from './lib';
21
23
 
22
24
  type Props = NextSeoProps & {
23
25
  imageUrl?: string;
@@ -1,2 +1 @@
1
1
  export { PageSeo } from './PageSeo';
2
- export * from './lib/types';
@@ -0,0 +1 @@
1
+ export { getAbsoluteUrl } from './getAbsoluteUrl';
@@ -1,6 +1,6 @@
1
+ import { DEFAULT_LOCALE, getLocaleDirection, LocaleObject } from '@prezly/theme-kit-core';
1
2
  import Document, { Head, Html, Main, NextScript } from 'next/document';
2
3
 
3
- import { DEFAULT_LOCALE, getLocaleDirection, LocaleObject } from '../intl';
4
4
  import type { PageProps } from '../types';
5
5
 
6
6
  export class PrezlyThemeDocument extends Document {
@@ -0,0 +1,57 @@
1
+ import type { Story } from '@prezly/sdk';
2
+ import {
3
+ getAlgoliaSettings,
4
+ getCompanyInformation,
5
+ getDefaultLanguage,
6
+ getLanguageFromStory,
7
+ getNotifications,
8
+ LocaleObject,
9
+ PrezlyApi,
10
+ } from '@prezly/theme-kit-core';
11
+ import type { IncomingMessage } from 'http';
12
+
13
+ import { getLanguageFromNextLocaleIsoCode } from '../intl';
14
+ import type { PageProps, ServerSidePageProps } from '../types';
15
+
16
+ export class NextPrezlyApi extends PrezlyApi {
17
+ async getNewsroomServerSideProps(
18
+ request?: IncomingMessage,
19
+ nextLocaleIsoCode?: string,
20
+ story?: Story,
21
+ ): Promise<PageProps & ServerSidePageProps> {
22
+ const [newsroom, languages, categories, themePreset] = await Promise.all([
23
+ this.getNewsroom(),
24
+ this.getNewsroomLanguages(),
25
+ this.getCategories(),
26
+ this.getThemePreset(),
27
+ ]);
28
+
29
+ const currentLanguage = story
30
+ ? getLanguageFromStory(languages, story)
31
+ : getLanguageFromNextLocaleIsoCode(languages, nextLocaleIsoCode);
32
+ const defaultLanguage = getDefaultLanguage(languages);
33
+
34
+ const { code: localeCode } = currentLanguage || defaultLanguage;
35
+ const locale = LocaleObject.fromAnyCode(localeCode);
36
+
37
+ // TODO: if no information given for current language, show boilerplate from default language
38
+ const companyInformation = getCompanyInformation(languages, locale);
39
+
40
+ const notifications = getNotifications(languages, locale);
41
+ const algoliaSettings = getAlgoliaSettings(request);
42
+
43
+ return {
44
+ newsroomContextProps: {
45
+ newsroom,
46
+ companyInformation,
47
+ categories,
48
+ languages,
49
+ localeCode,
50
+ notifications,
51
+ themePreset,
52
+ algoliaSettings,
53
+ },
54
+ localeResolved: Boolean(currentLanguage),
55
+ };
56
+ }
57
+ }
@@ -1,12 +1,11 @@
1
+ import { getEnvVariables } from '@prezly/theme-kit-core';
1
2
  import type { IncomingMessage } from 'http';
2
3
 
3
- import { getEnvVariables } from '../lib/getEnvVariables';
4
+ import { NextPrezlyApi } from './NextPrezlyApi';
4
5
 
5
- import { PrezlyApi } from './PrezlyApi';
6
-
7
- export function getPrezlyApi(req?: IncomingMessage): PrezlyApi {
6
+ export function getNextPrezlyApi(req?: IncomingMessage): NextPrezlyApi {
8
7
  if (typeof window !== 'undefined') {
9
- throw new Error('"getPrezlyApi" should only be used on back-end side.');
8
+ throw new Error('"getNextPrezlyApi" should only be used on back-end side.');
10
9
  }
11
10
 
12
11
  // `getEnvVariables` handles both cases for envs parsing - .env and request headers
@@ -20,5 +19,5 @@ export function getPrezlyApi(req?: IncomingMessage): PrezlyApi {
20
19
  throw new Error('"PREZLY_NEWSROOM_UUID" is not set in env variables.');
21
20
  }
22
21
 
23
- return new PrezlyApi(PREZLY_ACCESS_TOKEN, PREZLY_NEWSROOM_UUID, PREZLY_THEME_UUID);
22
+ return new NextPrezlyApi(PREZLY_ACCESS_TOKEN, PREZLY_NEWSROOM_UUID, PREZLY_THEME_UUID);
24
23
  }
@@ -1,3 +1 @@
1
- export * from './api';
2
- export * from './lib';
3
- export * from './types';
1
+ export { getNextPrezlyApi } from './getNextPrezlyApi';
package/src/index.ts CHANGED
@@ -2,8 +2,6 @@ export * from './adapter-nextjs';
2
2
  export * from './components-nextjs';
3
3
  export * from './data-fetching';
4
4
  export * from './infinite-loading';
5
- export * from './intl';
6
5
  export * from './newsroom-context';
7
6
  export * from './sentry';
8
7
  export * from './types';
9
- export * from './utils';
@@ -1,7 +1,7 @@
1
1
  import type { Category, Story } from '@prezly/sdk';
2
+ import type { LocaleObject } from '@prezly/theme-kit-core';
2
3
  import { useEffect } from 'react';
3
4
 
4
- import type { LocaleObject } from '../intl';
5
5
  import { useCurrentLocale } from '../newsroom-context';
6
6
 
7
7
  import type { PaginationProps } from './types';
package/src/intl/index.ts CHANGED
@@ -1,5 +1,2 @@
1
- export * from './getFallbackLocale';
2
1
  export * from './languages';
3
- export { default as localeConfig } from './localeConfig';
4
2
  export * from './locale';
5
- export * from './localeObject';