@prezly/theme-kit-nextjs 2.0.1-1 → 2.1.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 (259) hide show
  1. package/README.md +15 -15
  2. package/build/adapter-nextjs/api-handlers/fetchGalleries.js +21 -31
  3. package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
  4. package/build/adapter-nextjs/api-handlers/fetchStories.js +23 -41
  5. package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
  6. package/build/adapter-nextjs/api-handlers/index.js +7 -18
  7. package/build/adapter-nextjs/api-handlers/index.js.map +1 -1
  8. package/build/adapter-nextjs/getNewsroomServerSideProps.js +13 -20
  9. package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -1
  10. package/build/adapter-nextjs/getNewsroomStaticProps.js +13 -19
  11. package/build/adapter-nextjs/getNewsroomStaticProps.js.map +1 -1
  12. package/build/adapter-nextjs/index.js +21 -69
  13. package/build/adapter-nextjs/index.js.map +1 -1
  14. package/build/adapter-nextjs/page-props/category.js +96 -122
  15. package/build/adapter-nextjs/page-props/category.js.map +1 -1
  16. package/build/adapter-nextjs/page-props/gallery.js +65 -91
  17. package/build/adapter-nextjs/page-props/gallery.js.map +1 -1
  18. package/build/adapter-nextjs/page-props/galleryAlbum.js +49 -68
  19. package/build/adapter-nextjs/page-props/galleryAlbum.js.map +1 -1
  20. package/build/adapter-nextjs/page-props/home.js +66 -87
  21. package/build/adapter-nextjs/page-props/home.js.map +1 -1
  22. package/build/adapter-nextjs/page-props/index.js +40 -136
  23. package/build/adapter-nextjs/page-props/index.js.map +1 -1
  24. package/build/adapter-nextjs/page-props/lib/types.js +3 -1
  25. package/build/adapter-nextjs/page-props/search.js +28 -29
  26. package/build/adapter-nextjs/page-props/search.js.map +1 -1
  27. package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +46 -32
  28. package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +1 -1
  29. package/build/adapter-nextjs/page-props/sitemap/createPaths.js +17 -17
  30. package/build/adapter-nextjs/page-props/sitemap/createPaths.js.map +1 -1
  31. package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +33 -37
  32. package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -1
  33. package/build/adapter-nextjs/page-props/sitemap/index.js +23 -41
  34. package/build/adapter-nextjs/page-props/sitemap/index.js.map +1 -1
  35. package/build/adapter-nextjs/page-props/sitemap/types.js +3 -1
  36. package/build/adapter-nextjs/page-props/story.js +60 -81
  37. package/build/adapter-nextjs/page-props/story.js.map +1 -1
  38. package/build/adapter-nextjs/page-props/storyPreview.js +24 -31
  39. package/build/adapter-nextjs/page-props/storyPreview.js.map +1 -1
  40. package/build/adapter-nextjs/processRequest.js +23 -38
  41. package/build/adapter-nextjs/processRequest.js.map +1 -1
  42. package/build/adapter-nextjs/processStaticRequest.js +14 -23
  43. package/build/adapter-nextjs/processStaticRequest.js.map +1 -1
  44. package/build/components-nextjs/PageSeo/PageSeo.js +77 -89
  45. package/build/components-nextjs/PageSeo/PageSeo.js.map +1 -1
  46. package/build/components-nextjs/PageSeo/index.js +19 -25
  47. package/build/components-nextjs/PageSeo/index.js.map +1 -1
  48. package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +8 -9
  49. package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +1 -1
  50. package/build/components-nextjs/PageSeo/lib/types.js +3 -1
  51. package/build/components-nextjs/StorySeo/StorySeo.js +46 -74
  52. package/build/components-nextjs/StorySeo/StorySeo.js.map +1 -1
  53. package/build/components-nextjs/StorySeo/index.js +5 -11
  54. package/build/components-nextjs/StorySeo/index.js.map +1 -1
  55. package/build/components-nextjs/document.js +44 -36
  56. package/build/components-nextjs/document.js.map +1 -1
  57. package/build/components-nextjs/index.js +9 -25
  58. package/build/components-nextjs/index.js.map +1 -1
  59. package/build/data-fetching/api/PrezlyApi.js +187 -210
  60. package/build/data-fetching/api/PrezlyApi.js.map +1 -1
  61. package/build/data-fetching/api/getPrezlyApi.js +19 -25
  62. package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
  63. package/build/data-fetching/api/index.js +16 -14
  64. package/build/data-fetching/api/index.js.map +1 -1
  65. package/build/data-fetching/api/queries.js +41 -80
  66. package/build/data-fetching/api/queries.js.map +1 -1
  67. package/build/data-fetching/index.js +18 -36
  68. package/build/data-fetching/index.js.map +1 -1
  69. package/build/data-fetching/lib/getAlgoliaSettings.js +20 -26
  70. package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
  71. package/build/data-fetching/lib/getEnvVariables.js +36 -40
  72. package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
  73. package/build/data-fetching/lib/index.js +11 -32
  74. package/build/data-fetching/lib/index.js.map +1 -1
  75. package/build/data-fetching/lib/isSdkError.js +6 -7
  76. package/build/data-fetching/lib/isSdkError.js.map +1 -1
  77. package/build/data-fetching/lib/isUuid.js +6 -7
  78. package/build/data-fetching/lib/isUuid.js.map +1 -1
  79. package/build/data-fetching/types.js +3 -1
  80. package/build/index.js +25 -103
  81. package/build/index.js.map +1 -1
  82. package/build/infinite-loading/index.js +23 -41
  83. package/build/infinite-loading/index.js.map +1 -1
  84. package/build/infinite-loading/types.js +3 -1
  85. package/build/infinite-loading/useInfiniteGalleriesLoading.js +35 -46
  86. package/build/infinite-loading/useInfiniteGalleriesLoading.js.map +1 -1
  87. package/build/infinite-loading/useInfiniteLoading.js +41 -54
  88. package/build/infinite-loading/useInfiniteLoading.js.map +1 -1
  89. package/build/infinite-loading/useInfiniteStoriesLoading.js +48 -60
  90. package/build/infinite-loading/useInfiniteStoriesLoading.js.map +1 -1
  91. package/build/intl/index.d.ts +1 -1
  92. package/build/intl/index.js +24 -47
  93. package/build/intl/index.js.map +1 -1
  94. package/build/intl/languages.js +110 -150
  95. package/build/intl/languages.js.map +1 -1
  96. package/build/intl/locale.d.ts +1 -0
  97. package/build/intl/locale.js +104 -58
  98. package/build/intl/locale.js.map +1 -1
  99. package/build/intl/localeConfig.d.ts +2 -3
  100. package/build/intl/localeConfig.js +13 -28
  101. package/build/intl/localeConfig.js.map +1 -1
  102. package/build/intl/localeList.d.ts +2 -4
  103. package/build/intl/localeList.js +108 -7
  104. package/build/intl/localeList.js.map +1 -1
  105. package/build/intl/localeObject.js +78 -83
  106. package/build/intl/localeObject.js.map +1 -1
  107. package/build/newsroom-context/context.js +24 -42
  108. package/build/newsroom-context/context.js.map +1 -1
  109. package/build/newsroom-context/hooks/index.js +27 -125
  110. package/build/newsroom-context/hooks/index.js.map +1 -1
  111. package/build/newsroom-context/hooks/useAlgoliaSettings.js +8 -9
  112. package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
  113. package/build/newsroom-context/hooks/useCategories.js +8 -9
  114. package/build/newsroom-context/hooks/useCategories.js.map +1 -1
  115. package/build/newsroom-context/hooks/useCompanyInformation.js +8 -9
  116. package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
  117. package/build/newsroom-context/hooks/useCurrentCategory.js +8 -9
  118. package/build/newsroom-context/hooks/useCurrentCategory.js.map +1 -1
  119. package/build/newsroom-context/hooks/useCurrentLocale.js +8 -9
  120. package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
  121. package/build/newsroom-context/hooks/useCurrentStory.js +8 -9
  122. package/build/newsroom-context/hooks/useCurrentStory.js.map +1 -1
  123. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +19 -21
  124. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
  125. package/build/newsroom-context/hooks/useGetTranslationUrl.js +54 -56
  126. package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
  127. package/build/newsroom-context/hooks/useLanguages.js +8 -9
  128. package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
  129. package/build/newsroom-context/hooks/useNewsroom.js +8 -9
  130. package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
  131. package/build/newsroom-context/hooks/useNewsroomContext.js +14 -15
  132. package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
  133. package/build/newsroom-context/index.d.ts +1 -2
  134. package/build/newsroom-context/index.js +20 -32
  135. package/build/newsroom-context/index.js.map +1 -1
  136. package/build/sentry/client.js +7 -8
  137. package/build/sentry/client.js.map +1 -1
  138. package/build/sentry/common.js +27 -30
  139. package/build/sentry/common.js.map +1 -1
  140. package/build/sentry/index.js +7 -18
  141. package/build/sentry/index.js.map +1 -1
  142. package/build/sentry/server.js +7 -8
  143. package/build/sentry/server.js.map +1 -1
  144. package/build/tsconfig.tsbuildinfo +1 -0
  145. package/build/types.js +3 -1
  146. package/build/utils/boilerplate.js +18 -11
  147. package/build/utils/boilerplate.js.map +1 -1
  148. package/build/utils/constants.js +6 -11
  149. package/build/utils/constants.js.map +1 -1
  150. package/build/utils/getAssetsUrl.js +7 -8
  151. package/build/utils/getAssetsUrl.js.map +1 -1
  152. package/build/utils/getDataRequestLink.js +10 -10
  153. package/build/utils/getDataRequestLink.js.map +1 -1
  154. package/build/utils/getLocalizedCategoryData.js +29 -37
  155. package/build/utils/getLocalizedCategoryData.js.map +1 -1
  156. package/build/utils/getNewsroomLogoUrl.js +18 -19
  157. package/build/utils/getNewsroomLogoUrl.js.map +1 -1
  158. package/build/utils/getPrivacyPortalUrl.js +11 -15
  159. package/build/utils/getPrivacyPortalUrl.js.map +1 -1
  160. package/build/utils/getStoryPublicationDate.js +12 -13
  161. package/build/utils/getStoryPublicationDate.js.map +1 -1
  162. package/build/utils/getUploadcareGroupUrl.js +8 -9
  163. package/build/utils/getUploadcareGroupUrl.js.map +1 -1
  164. package/build/utils/index.js +26 -114
  165. package/build/utils/index.js.map +1 -1
  166. package/build/utils/isEmbargoStory.js +6 -7
  167. package/build/utils/isEmbargoStory.js.map +1 -1
  168. package/package.json +12 -26
  169. package/src/@types/global.d.ts +7 -0
  170. package/src/__mocks__/languages.ts +416 -0
  171. package/src/__mocks__/story.ts +359 -0
  172. package/src/adapter-nextjs/api-handlers/fetchGalleries.ts +24 -0
  173. package/src/adapter-nextjs/api-handlers/fetchStories.ts +26 -0
  174. package/src/adapter-nextjs/api-handlers/index.ts +2 -0
  175. package/src/adapter-nextjs/getNewsroomServerSideProps.ts +29 -0
  176. package/src/adapter-nextjs/getNewsroomStaticProps.ts +29 -0
  177. package/src/adapter-nextjs/index.ts +6 -0
  178. package/src/adapter-nextjs/page-props/category.ts +157 -0
  179. package/src/adapter-nextjs/page-props/gallery.ts +114 -0
  180. package/src/adapter-nextjs/page-props/galleryAlbum.ts +89 -0
  181. package/src/adapter-nextjs/page-props/home.ts +113 -0
  182. package/src/adapter-nextjs/page-props/index.ts +26 -0
  183. package/src/adapter-nextjs/page-props/lib/types.ts +8 -0
  184. package/src/adapter-nextjs/page-props/search.ts +53 -0
  185. package/src/adapter-nextjs/page-props/sitemap/SitemapBuilder.ts +56 -0
  186. package/src/adapter-nextjs/page-props/sitemap/createPaths.ts +21 -0
  187. package/src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts +43 -0
  188. package/src/adapter-nextjs/page-props/sitemap/index.ts +5 -0
  189. package/src/adapter-nextjs/page-props/sitemap/types.ts +5 -0
  190. package/src/adapter-nextjs/page-props/story.ts +94 -0
  191. package/src/adapter-nextjs/page-props/storyPreview.ts +33 -0
  192. package/src/adapter-nextjs/processRequest.ts +49 -0
  193. package/src/adapter-nextjs/processStaticRequest.ts +32 -0
  194. package/src/components-nextjs/PageSeo/PageSeo.tsx +131 -0
  195. package/src/components-nextjs/PageSeo/index.ts +2 -0
  196. package/src/components-nextjs/PageSeo/lib/getAbsoluteUrl.ts +7 -0
  197. package/src/components-nextjs/PageSeo/lib/types.ts +4 -0
  198. package/src/components-nextjs/StorySeo/StorySeo.tsx +80 -0
  199. package/src/components-nextjs/StorySeo/index.ts +1 -0
  200. package/src/components-nextjs/document.tsx +38 -0
  201. package/src/components-nextjs/index.ts +3 -0
  202. package/src/data-fetching/api/PrezlyApi.ts +304 -0
  203. package/src/data-fetching/api/getPrezlyApi.ts +24 -0
  204. package/src/data-fetching/api/index.ts +1 -0
  205. package/src/data-fetching/api/queries.ts +51 -0
  206. package/src/data-fetching/index.ts +3 -0
  207. package/src/data-fetching/lib/getAlgoliaSettings.ts +29 -0
  208. package/src/data-fetching/lib/getEnvVariables.ts +46 -0
  209. package/src/data-fetching/lib/index.ts +4 -0
  210. package/src/data-fetching/lib/isSdkError.ts +5 -0
  211. package/src/data-fetching/lib/isUuid.ts +5 -0
  212. package/src/data-fetching/types.ts +14 -0
  213. package/src/index.ts +9 -0
  214. package/src/infinite-loading/index.ts +4 -0
  215. package/src/infinite-loading/types.ts +5 -0
  216. package/src/infinite-loading/useInfiniteGalleriesLoading.ts +53 -0
  217. package/src/infinite-loading/useInfiniteLoading.ts +66 -0
  218. package/src/infinite-loading/useInfiniteStoriesLoading.ts +81 -0
  219. package/src/intl/index.ts +4 -0
  220. package/src/intl/languages.test.ts +232 -0
  221. package/src/intl/languages.ts +233 -0
  222. package/src/intl/locale.test.ts +95 -0
  223. package/src/intl/locale.ts +140 -0
  224. package/src/intl/localeConfig.js +23 -0
  225. package/src/intl/localeList.js +110 -0
  226. package/src/intl/localeObject.test.ts +81 -0
  227. package/src/intl/localeObject.ts +99 -0
  228. package/src/newsroom-context/context.tsx +115 -0
  229. package/src/newsroom-context/hooks/index.ts +11 -0
  230. package/src/newsroom-context/hooks/useAlgoliaSettings.ts +7 -0
  231. package/src/newsroom-context/hooks/useCategories.ts +7 -0
  232. package/src/newsroom-context/hooks/useCompanyInformation.ts +7 -0
  233. package/src/newsroom-context/hooks/useCurrentCategory.ts +7 -0
  234. package/src/newsroom-context/hooks/useCurrentLocale.ts +7 -0
  235. package/src/newsroom-context/hooks/useCurrentStory.ts +7 -0
  236. package/src/newsroom-context/hooks/useGetLinkLocaleSlug.ts +37 -0
  237. package/src/newsroom-context/hooks/useGetTranslationUrl.ts +97 -0
  238. package/src/newsroom-context/hooks/useLanguages.ts +7 -0
  239. package/src/newsroom-context/hooks/useNewsroom.ts +7 -0
  240. package/src/newsroom-context/hooks/useNewsroomContext.ts +15 -0
  241. package/src/newsroom-context/index.ts +2 -0
  242. package/src/sentry/client.ts +7 -0
  243. package/src/sentry/common.ts +27 -0
  244. package/src/sentry/index.ts +2 -0
  245. package/src/sentry/server.ts +7 -0
  246. package/src/types.ts +51 -0
  247. package/src/utils/boilerplate.ts +27 -0
  248. package/src/utils/constants.ts +3 -0
  249. package/src/utils/getAssetsUrl.test.ts +9 -0
  250. package/src/utils/getAssetsUrl.ts +9 -0
  251. package/src/utils/getDataRequestLink.ts +14 -0
  252. package/src/utils/getLocalizedCategoryData.ts +47 -0
  253. package/src/utils/getNewsroomLogoUrl.ts +22 -0
  254. package/src/utils/getPrivacyPortalUrl.ts +25 -0
  255. package/src/utils/getStoryPublicationDate.tsx +15 -0
  256. package/src/utils/getUploadcareGroupUrl.ts +13 -0
  257. package/src/utils/index.ts +10 -0
  258. package/src/utils/isEmbargoStory.ts +10 -0
  259. package/build/@types/global.d.js +0 -1
@@ -1,40 +1,36 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getSitemapServerSideProps = getSitemapServerSideProps;
7
- var _index = require("../../../data-fetching/index.js");
8
- var _createPaths = require("./createPaths.js");
9
- var _SitemapBuilder = require("./SitemapBuilder.js");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSitemapServerSideProps = void 0;
4
+ const data_fetching_1 = require("../../../data-fetching");
5
+ const createPaths_1 = require("./createPaths");
6
+ const SitemapBuilder_1 = require("./SitemapBuilder");
10
7
  function getSitemapServerSideProps(additionalPaths) {
11
- return async function getServerSideProps(ctx) {
12
- const {
13
- res,
14
- req
15
- } = ctx;
16
- if (!req || !res) {
17
- // client side
18
- return {
19
- props: {}
20
- };
21
- }
22
- const baseUrl = req.headers.host || '/';
23
- const api = (0, _index.getPrezlyApi)(req);
24
- const stories = await api.getAllStories();
25
- const categories = await api.getCategories();
26
- const paths = (0, _createPaths.createPaths)(stories, categories);
27
- const sitemapBuilder = new _SitemapBuilder.SitemapBuilder(baseUrl);
28
- sitemapBuilder.addUrl('/');
29
- paths.forEach(path => sitemapBuilder.addUrl(path));
30
- if (additionalPaths) {
31
- additionalPaths.forEach(path => sitemapBuilder.addUrl(path));
32
- }
33
- res.setHeader('Content-Type', 'text/xml');
34
- res.write(sitemapBuilder.serialize());
35
- res.end();
36
- return {
37
- props: {}
8
+ return async function getServerSideProps(ctx) {
9
+ const { res, req } = ctx;
10
+ if (!req || !res) {
11
+ // client side
12
+ return {
13
+ props: {},
14
+ };
15
+ }
16
+ const baseUrl = req.headers.host || '/';
17
+ const api = (0, data_fetching_1.getPrezlyApi)(req);
18
+ const stories = await api.getAllStories();
19
+ const categories = await api.getCategories();
20
+ const paths = (0, createPaths_1.createPaths)(stories, categories);
21
+ const sitemapBuilder = new SitemapBuilder_1.SitemapBuilder(baseUrl);
22
+ sitemapBuilder.addUrl('/');
23
+ paths.forEach((path) => sitemapBuilder.addUrl(path));
24
+ if (additionalPaths) {
25
+ additionalPaths.forEach((path) => sitemapBuilder.addUrl(path));
26
+ }
27
+ res.setHeader('Content-Type', 'text/xml');
28
+ res.write(sitemapBuilder.serialize());
29
+ res.end();
30
+ return {
31
+ props: {},
32
+ };
38
33
  };
39
- };
40
- }
34
+ }
35
+ exports.getSitemapServerSideProps = getSitemapServerSideProps;
36
+ //# sourceMappingURL=getServerSideProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getServerSideProps.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,UAAU,yBAAyB,CAAC,eAA0B;IAChE,OAAO,KAAK,UAAU,kBAAkB,CAAC,GAAoB;QACzD,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;QAEzB,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE;YACd,cAAc;YACd,OAAO;gBACH,KAAK,EAAE,EAAE;aACZ,CAAC;SACL;QAED,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC;QAExC,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,aAAa,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,aAAa,EAAE,CAAC;QAE7C,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC/C,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QAEnD,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAErD,IAAI,eAAe,EAAE;YACjB,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;SAClE;QAED,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QAC1C,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;QACtC,GAAG,CAAC,GAAG,EAAE,CAAC;QAEV,OAAO;YACH,KAAK,EAAE,EAAE;SACZ,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"getServerSideProps.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/getServerSideProps.ts"],"names":[],"mappings":";;;AAEA,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C"}
@@ -1,43 +1,25 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- getSitemapServerSideProps: true,
8
- SitemapBuilder: true,
9
- createPaths: true
10
- };
11
- Object.defineProperty(exports, "SitemapBuilder", {
12
- enumerable: true,
13
- get: function () {
14
- return _SitemapBuilder.SitemapBuilder;
15
- }
16
- });
17
- Object.defineProperty(exports, "createPaths", {
18
- enumerable: true,
19
- get: function () {
20
- return _createPaths.createPaths;
21
- }
22
- });
23
- Object.defineProperty(exports, "getSitemapServerSideProps", {
24
- enumerable: true,
25
- get: function () {
26
- return _getServerSideProps.getSitemapServerSideProps;
27
- }
28
- });
29
- var _getServerSideProps = require("./getServerSideProps.js");
30
- var _SitemapBuilder = require("./SitemapBuilder.js");
31
- var _createPaths = require("./createPaths.js");
32
- var _types = require("./types.js");
33
- Object.keys(_types).forEach(function (key) {
34
- if (key === "default" || key === "__esModule") return;
35
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
36
- if (key in exports && exports[key] === _types[key]) return;
37
- Object.defineProperty(exports, key, {
38
- enumerable: true,
39
- get: function () {
40
- return _types[key];
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]; } };
41
7
  }
42
- });
43
- });
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
+ exports.createPaths = exports.SitemapBuilder = exports.getSitemapServerSideProps = void 0;
18
+ var getServerSideProps_1 = require("./getServerSideProps");
19
+ Object.defineProperty(exports, "getSitemapServerSideProps", { enumerable: true, get: function () { return getServerSideProps_1.getSitemapServerSideProps; } });
20
+ var SitemapBuilder_1 = require("./SitemapBuilder");
21
+ Object.defineProperty(exports, "SitemapBuilder", { enumerable: true, get: function () { return SitemapBuilder_1.SitemapBuilder; } });
22
+ var createPaths_1 = require("./createPaths");
23
+ Object.defineProperty(exports, "createPaths", { enumerable: true, get: function () { return createPaths_1.createPaths; } });
24
+ __exportStar(require("./types"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapter-nextjs/page-props/sitemap/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2DAAiE;AAAxD,+HAAA,yBAAyB,OAAA;AAElC,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,0CAAwB"}
@@ -1 +1,3 @@
1
- "use strict";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -1,88 +1,67 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getStoryPageServerSideProps = getStoryPageServerSideProps;
7
- exports.getStoryPageStaticPaths = getStoryPageStaticPaths;
8
- exports.getStoryPageStaticProps = getStoryPageStaticProps;
9
- var _index = require("../../data-fetching/index.js");
10
- var _index2 = require("../../intl/index.js");
11
- var _getNewsroomServerSideProps = require("../getNewsroomServerSideProps.js");
12
- var _getNewsroomStaticProps = require("../getNewsroomStaticProps.js");
13
- var _processRequest = require("../processRequest.js");
14
- var _processStaticRequest = require("../processStaticRequest.js");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStoryPageStaticPaths = exports.getStoryPageStaticProps = exports.getStoryPageServerSideProps = void 0;
4
+ const data_fetching_1 = require("../../data-fetching");
5
+ const intl_1 = require("../../intl");
6
+ const getNewsroomServerSideProps_1 = require("../getNewsroomServerSideProps");
7
+ const getNewsroomStaticProps_1 = require("../getNewsroomStaticProps");
8
+ const processRequest_1 = require("../processRequest");
9
+ const processStaticRequest_1 = require("../processStaticRequest");
15
10
  function getStoryPageServerSideProps(customProps) {
16
- return async function getServerSideProps(context) {
17
- const api = (0, _index.getPrezlyApi)(context.req);
18
- const {
19
- slug
20
- } = context.params;
21
- const story = slug ? await api.getStoryBySlug(slug) : null;
22
- if (!story) {
23
- return {
24
- notFound: true
25
- };
26
- }
27
- const {
28
- serverSideProps
29
- } = await (0, _getNewsroomServerSideProps.getNewsroomServerSideProps)(context, {
30
- story
31
- });
32
- const {
33
- locale
34
- } = context;
35
- if (locale && locale !== _index2.DUMMY_DEFAULT_LOCALE) {
36
- return {
37
- redirect: {
38
- destination: `/${slug}`,
39
- permanent: true
11
+ return async function getServerSideProps(context) {
12
+ const api = (0, data_fetching_1.getPrezlyApi)(context.req);
13
+ const { slug } = context.params;
14
+ const story = slug ? await api.getStoryBySlug(slug) : null;
15
+ if (!story) {
16
+ return { notFound: true };
40
17
  }
41
- };
42
- }
43
- serverSideProps.newsroomContextProps.currentStory = story;
44
- return (0, _processRequest.processRequest)(context, {
45
- ...serverSideProps,
46
- ...(typeof customProps === 'function' ? await customProps(context, serverSideProps) : customProps)
47
- });
48
- };
18
+ const { serverSideProps } = await (0, getNewsroomServerSideProps_1.getNewsroomServerSideProps)(context, { story });
19
+ const { locale } = context;
20
+ if (locale && locale !== intl_1.DUMMY_DEFAULT_LOCALE) {
21
+ return {
22
+ redirect: {
23
+ destination: `/${slug}`,
24
+ permanent: true,
25
+ },
26
+ };
27
+ }
28
+ serverSideProps.newsroomContextProps.currentStory = story;
29
+ return (0, processRequest_1.processRequest)(context, {
30
+ ...serverSideProps,
31
+ ...(typeof customProps === 'function'
32
+ ? await customProps(context, serverSideProps)
33
+ : customProps),
34
+ });
35
+ };
49
36
  }
37
+ exports.getStoryPageServerSideProps = getStoryPageServerSideProps;
50
38
  function getStoryPageStaticProps(customProps) {
51
- return async function getStaticProps(context) {
52
- const api = (0, _index.getPrezlyApi)();
53
- const {
54
- slug
55
- } = context.params;
56
- const story = slug ? await api.getStoryBySlug(slug) : null;
57
- if (!story) {
58
- return {
59
- notFound: true
60
- };
61
- }
62
- const {
63
- staticProps
64
- } = await (0, _getNewsroomStaticProps.getNewsroomStaticProps)(context, {
65
- story
66
- });
67
- staticProps.newsroomContextProps.currentStory = story;
68
- return (0, _processStaticRequest.processStaticRequest)(context, {
69
- ...staticProps,
70
- ...(typeof customProps === 'function' ? await customProps(context, staticProps) : customProps)
71
- });
72
- };
39
+ return async function getStaticProps(context) {
40
+ const api = (0, data_fetching_1.getPrezlyApi)();
41
+ const { slug } = context.params;
42
+ const story = slug ? await api.getStoryBySlug(slug) : null;
43
+ if (!story) {
44
+ return { notFound: true };
45
+ }
46
+ const { staticProps } = await (0, getNewsroomStaticProps_1.getNewsroomStaticProps)(context, { story });
47
+ staticProps.newsroomContextProps.currentStory = story;
48
+ return (0, processStaticRequest_1.processStaticRequest)(context, {
49
+ ...staticProps,
50
+ ...(typeof customProps === 'function'
51
+ ? await customProps(context, staticProps)
52
+ : customProps),
53
+ });
54
+ };
73
55
  }
56
+ exports.getStoryPageStaticProps = getStoryPageStaticProps;
74
57
  async function getStoryPageStaticPaths() {
75
- const api = (0, _index.getPrezlyApi)();
76
- const stories = await api.getAllStories();
77
- const paths = stories.map(({
78
- slug
79
- }) => ({
80
- params: {
81
- slug
82
- }
83
- }));
84
- return {
85
- paths,
86
- fallback: 'blocking'
87
- };
88
- }
58
+ const api = (0, data_fetching_1.getPrezlyApi)();
59
+ const stories = await api.getAllStories();
60
+ const paths = stories.map(({ slug }) => ({ params: { slug } }));
61
+ return {
62
+ paths,
63
+ fallback: 'blocking',
64
+ };
65
+ }
66
+ exports.getStoryPageStaticPaths = getStoryPageStaticPaths;
67
+ //# sourceMappingURL=story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"story.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/story.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAI/D,MAAM,UAAU,2BAA2B,CACvC,WAAqD;IAErD,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAEtC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAA2B,CAAC;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3D,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7B;QAED,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,0BAA0B,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QA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,CAAC;AA5BD,0DA4BC;AAEM,KAAK,UAAU,uBAAuB;IACzC,MAAM,GAAG,GAAG,IAAA,4BAAY,GAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,aAAa,EAAE,CAAC;IAE1C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAEhE,OAAO;QACH,KAAK;QACL,QAAQ,EAAE,UAAU;KACvB,CAAC;AACN,CAAC;AAVD,0DAUC"}
@@ -1,33 +1,26 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getStoryPreviewPageServerSideProps = getStoryPreviewPageServerSideProps;
7
- var _index = require("../../data-fetching/index.js");
8
- var _getNewsroomServerSideProps = require("../getNewsroomServerSideProps.js");
9
- var _processRequest = require("../processRequest.js");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStoryPreviewPageServerSideProps = void 0;
4
+ const data_fetching_1 = require("../../data-fetching");
5
+ const getNewsroomServerSideProps_1 = require("../getNewsroomServerSideProps");
6
+ const processRequest_1 = require("../processRequest");
10
7
  function getStoryPreviewPageServerSideProps(customProps) {
11
- return async function getServerSideProps(context) {
12
- const api = (0, _index.getPrezlyApi)(context.req);
13
- const {
14
- uuid
15
- } = context.params;
16
- const story = await api.getStory(uuid);
17
- if (!story) {
18
- return {
19
- notFound: true
20
- };
21
- }
22
- const {
23
- serverSideProps
24
- } = await (0, _getNewsroomServerSideProps.getNewsroomServerSideProps)(context, {
25
- story
26
- });
27
- serverSideProps.newsroomContextProps.currentStory = story;
28
- return (0, _processRequest.processRequest)(context, {
29
- ...serverSideProps,
30
- ...(typeof customProps === 'function' ? await customProps(context, serverSideProps) : customProps)
31
- });
32
- };
33
- }
8
+ return async function getServerSideProps(context) {
9
+ const api = (0, data_fetching_1.getPrezlyApi)(context.req);
10
+ const { uuid } = context.params;
11
+ const story = await api.getStory(uuid);
12
+ if (!story) {
13
+ return { notFound: true };
14
+ }
15
+ const { serverSideProps } = await (0, getNewsroomServerSideProps_1.getNewsroomServerSideProps)(context, { story });
16
+ serverSideProps.newsroomContextProps.currentStory = story;
17
+ return (0, processRequest_1.processRequest)(context, {
18
+ ...serverSideProps,
19
+ ...(typeof customProps === 'function'
20
+ ? await customProps(context, serverSideProps)
21
+ : customProps),
22
+ });
23
+ };
24
+ }
25
+ exports.getStoryPreviewPageServerSideProps = getStoryPreviewPageServerSideProps;
26
+ //# sourceMappingURL=storyPreview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storyPreview.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/storyPreview.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD,MAAM,UAAU,kCAAkC,CAC9C,WAAqD;IAErD,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAA0B,CAAC;QACpD,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7B;QAED,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,0BAA0B,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAEjF,eAAe,CAAC,oBAAoB,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1D,OAAO,cAAc,CAAC,OAAO,EAAE;YAC3B,GAAG,eAAe;YAClB,GAAG,CAAC,OAAO,WAAW,KAAK,UAAU;gBACjC,CAAC,CAAC,MAAO,WAA0C,CAAC,OAAO,EAAE,eAAe,CAAC;gBAC7E,CAAC,CAAC,WAAW,CAAC;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"storyPreview.js","sourceRoot":"","sources":["../../../src/adapter-nextjs/page-props/storyPreview.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AACnD,8EAA2E;AAC3E,sDAAmD;AAInD,SAAgB,kCAAkC,CAC9C,WAAqD;IAErD,OAAO,KAAK,UAAU,kBAAkB,CACpC,OAAkC;QAElC,MAAM,GAAG,GAAG,IAAA,4BAAY,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAA0B,CAAC;QACpD,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7B;QAED,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,IAAA,uDAA0B,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAEjF,eAAe,CAAC,oBAAoB,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1D,OAAO,IAAA,+BAAc,EAAC,OAAO,EAAE;YAC3B,GAAG,eAAe;YAClB,GAAG,CAAC,OAAO,WAAW,KAAK,UAAU;gBACjC,CAAC,CAAC,MAAO,WAA0C,CAAC,OAAO,EAAE,eAAe,CAAC;gBAC7E,CAAC,CAAC,WAAW,CAAC;SACrB,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAxBD,gFAwBC"}
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.processRequest = processRequest;
7
- var _index = require("../intl/index.js");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processRequest = void 0;
4
+ const intl_1 = require("../intl");
8
5
  /**
9
6
  * This function combines the props returned from `getNewsroomServerSideProps` and your optional custom props for the page.
10
7
  * It also handles locale redirects, if `canonicalUrl` parameter is provided.
@@ -15,37 +12,25 @@ var _index = require("../intl/index.js");
15
12
  * @param canonicalUrl Optional: a canonical URL for the current page without locale part. If provided, locale redirects will be handled by the function.
16
13
  */
17
14
  function processRequest(context, props, canonicalUrl) {
18
- const {
19
- locale: nextLocale,
20
- query
21
- } = context;
22
- const {
23
- localeResolved,
24
- ...pageProps
25
- } = props;
26
-
27
- // If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
28
- // In that case we won't show 404 page.
29
- if (!localeResolved && nextLocale) {
15
+ const { locale: nextLocale, query } = context;
16
+ const { localeResolved, ...pageProps } = props;
17
+ // If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
18
+ // In that case we won't show 404 page.
19
+ if (!localeResolved && nextLocale) {
20
+ return { notFound: true };
21
+ }
22
+ if (canonicalUrl) {
23
+ const { languages, localeCode } = pageProps.newsroomContextProps;
24
+ const currentLocale = intl_1.LocaleObject.fromAnyCode(localeCode);
25
+ const shortestLocaleCode = (0, intl_1.getShortestLocaleCode)(languages, currentLocale);
26
+ const redirect = (0, intl_1.getRedirectToCanonicalLocale)(shortestLocaleCode, nextLocale, canonicalUrl, query);
27
+ if (redirect) {
28
+ return { redirect };
29
+ }
30
+ }
30
31
  return {
31
- notFound: true
32
+ props: pageProps,
32
33
  };
33
- }
34
- if (canonicalUrl) {
35
- const {
36
- languages,
37
- localeCode
38
- } = pageProps.newsroomContextProps;
39
- const currentLocale = _index.LocaleObject.fromAnyCode(localeCode);
40
- const shortestLocaleCode = (0, _index.getShortestLocaleCode)(languages, currentLocale);
41
- const redirect = (0, _index.getRedirectToCanonicalLocale)(shortestLocaleCode, nextLocale, canonicalUrl, query);
42
- if (redirect) {
43
- return {
44
- redirect
45
- };
46
- }
47
- }
48
- return {
49
- props: pageProps
50
- };
51
- }
34
+ }
35
+ exports.processRequest = processRequest;
36
+ //# sourceMappingURL=processRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processRequest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5F;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC1B,OAAkC,EAClC,KAA8C,EAC9C,YAAqB;IAErB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE9C,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE;QAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,IAAI,YAAY,EAAE;QACd,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,oBAAoB,CAAC;QACjE,MAAM,aAAa,GAAG,YAAY,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3D,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,4BAA4B,CACzC,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,KAAK,CACR,CAAC;QACF,IAAI,QAAQ,EAAE;YACV,OAAO,EAAE,QAAQ,EAAE,CAAC;SACvB;KACJ;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;KACxC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"processRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processRequest.ts"],"names":[],"mappings":";;;AAEA,kCAA4F;AAG5F;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC1B,OAAkC,EAClC,KAA8C,EAC9C,YAAqB;IAErB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE9C,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE;QAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,IAAI,YAAY,EAAE;QACd,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,oBAAoB,CAAC;QACjE,MAAM,aAAa,GAAG,mBAAY,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3D,MAAM,kBAAkB,GAAG,IAAA,4BAAqB,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,IAAA,mCAA4B,EACzC,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,KAAK,CACR,CAAC;QACF,IAAI,QAAQ,EAAE;YACV,OAAO,EAAE,QAAQ,EAAE,CAAC;SACvB;KACJ;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;KACxC,CAAC;AACN,CAAC;AAlCD,wCAkCC"}
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.processStaticRequest = processStaticRequest;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processStaticRequest = void 0;
7
4
  /**
8
5
  * This function combines the props returned from `getNewsroomStaticProps` and your optional custom props for the page.
9
6
  * See README for usage examples.
@@ -13,23 +10,17 @@ exports.processStaticRequest = processStaticRequest;
13
10
  * @param revalidateTimeout Optional: timeout in seconds to use with Next ISR.
14
11
  */
15
12
  function processStaticRequest(context, props, revalidateTimeout) {
16
- const {
17
- locale: nextLocale
18
- } = context;
19
- const {
20
- localeResolved,
21
- ...pageProps
22
- } = props;
23
-
24
- // If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
25
- // In that case we won't show 404 page.
26
- if (!localeResolved && nextLocale) {
13
+ const { locale: nextLocale } = context;
14
+ const { localeResolved, ...pageProps } = props;
15
+ // If no locale was provided by Next, it most likely means that the theme is not supporting multi-language.
16
+ // In that case we won't show 404 page.
17
+ if (!localeResolved && nextLocale) {
18
+ return { notFound: true };
19
+ }
27
20
  return {
28
- notFound: true
21
+ props: pageProps,
22
+ revalidate: revalidateTimeout,
29
23
  };
30
- }
31
- return {
32
- props: pageProps,
33
- revalidate: revalidateTimeout
34
- };
35
- }
24
+ }
25
+ exports.processStaticRequest = processStaticRequest;
26
+ //# sourceMappingURL=processStaticRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"processStaticRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processStaticRequest.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAChC,OAA8B,EAC9B,KAA8C,EAC9C,iBAA0B;IAE1B,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE;QAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;QACrC,UAAU,EAAE,iBAAiB;KAChC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"processStaticRequest.js","sourceRoot":"","sources":["../../src/adapter-nextjs/processStaticRequest.ts"],"names":[],"mappings":";;;AAIA;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAChC,OAA8B,EAC9B,KAA8C,EAC9C,iBAA0B;IAE1B,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE/C,2GAA2G;IAC3G,uCAAuC;IACvC,IAAI,CAAC,cAAc,IAAI,UAAU,EAAE;QAC/B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,OAAO;QACH,KAAK,EAAE,SAA8B;QACrC,UAAU,EAAE,iBAAiB;KAChC,CAAC;AACN,CAAC;AAnBD,oDAmBC"}