@prezly/theme-kit-nextjs 1.15.0 → 1.16.0-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/build/adapter-nextjs/api-handlers/fetchGalleries.js +15 -69
  2. package/build/adapter-nextjs/api-handlers/fetchGalleries.js.map +1 -1
  3. package/build/adapter-nextjs/api-handlers/fetchStories.js +17 -71
  4. package/build/adapter-nextjs/api-handlers/fetchStories.js.map +1 -1
  5. package/build/adapter-nextjs/api-handlers/index.js +2 -7
  6. package/build/adapter-nextjs/api-handlers/index.js.map +1 -1
  7. package/build/adapter-nextjs/getNewsroomServerSideProps.js +9 -63
  8. package/build/adapter-nextjs/getNewsroomServerSideProps.js.map +1 -1
  9. package/build/adapter-nextjs/getNewsroomStaticProps.js +9 -63
  10. package/build/adapter-nextjs/getNewsroomStaticProps.js.map +1 -1
  11. package/build/adapter-nextjs/index.js +6 -22
  12. package/build/adapter-nextjs/index.js.map +1 -1
  13. package/build/adapter-nextjs/page-props/category.d.ts +1 -1
  14. package/build/adapter-nextjs/page-props/category.js +95 -202
  15. package/build/adapter-nextjs/page-props/category.js.map +1 -1
  16. package/build/adapter-nextjs/page-props/gallery.d.ts +1 -1
  17. package/build/adapter-nextjs/page-props/gallery.js +59 -141
  18. package/build/adapter-nextjs/page-props/gallery.js.map +1 -1
  19. package/build/adapter-nextjs/page-props/galleryAlbum.d.ts +1 -1
  20. package/build/adapter-nextjs/page-props/galleryAlbum.js +41 -139
  21. package/build/adapter-nextjs/page-props/galleryAlbum.js.map +1 -1
  22. package/build/adapter-nextjs/page-props/home.d.ts +1 -1
  23. package/build/adapter-nextjs/page-props/home.js +58 -142
  24. package/build/adapter-nextjs/page-props/home.js.map +1 -1
  25. package/build/adapter-nextjs/page-props/index.js +8 -41
  26. package/build/adapter-nextjs/page-props/index.js.map +1 -1
  27. package/build/adapter-nextjs/page-props/lib/types.d.ts +1 -1
  28. package/build/adapter-nextjs/page-props/lib/types.js +1 -2
  29. package/build/adapter-nextjs/page-props/search.d.ts +2 -2
  30. package/build/adapter-nextjs/page-props/search.js +21 -103
  31. package/build/adapter-nextjs/page-props/search.js.map +1 -1
  32. package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js +18 -22
  33. package/build/adapter-nextjs/page-props/sitemap/SitemapBuilder.js.map +1 -1
  34. package/build/adapter-nextjs/page-props/sitemap/createPaths.js +10 -45
  35. package/build/adapter-nextjs/page-props/sitemap/createPaths.js.map +1 -1
  36. package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js +29 -81
  37. package/build/adapter-nextjs/page-props/sitemap/getServerSideProps.js.map +1 -1
  38. package/build/adapter-nextjs/page-props/sitemap/index.js +4 -24
  39. package/build/adapter-nextjs/page-props/sitemap/index.js.map +1 -1
  40. package/build/adapter-nextjs/page-props/sitemap/types.js +1 -2
  41. package/build/adapter-nextjs/page-props/story.d.ts +1 -1
  42. package/build/adapter-nextjs/page-props/story.js +58 -166
  43. package/build/adapter-nextjs/page-props/story.js.map +1 -1
  44. package/build/adapter-nextjs/page-props/storyPreview.js +20 -85
  45. package/build/adapter-nextjs/page-props/storyPreview.js.map +1 -1
  46. package/build/adapter-nextjs/processRequest.js +9 -24
  47. package/build/adapter-nextjs/processRequest.js.map +1 -1
  48. package/build/adapter-nextjs/processStaticRequest.js +3 -18
  49. package/build/adapter-nextjs/processStaticRequest.js.map +1 -1
  50. package/build/components-nextjs/PageSeo/PageSeo.js +42 -57
  51. package/build/components-nextjs/PageSeo/PageSeo.js.map +1 -1
  52. package/build/components-nextjs/PageSeo/index.js +2 -20
  53. package/build/components-nextjs/PageSeo/index.js.map +1 -1
  54. package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js +2 -6
  55. package/build/components-nextjs/PageSeo/lib/getAbsoluteUrl.js.map +1 -1
  56. package/build/components-nextjs/PageSeo/lib/types.js +1 -2
  57. package/build/components-nextjs/StorySeo/StorySeo.js +28 -36
  58. package/build/components-nextjs/StorySeo/StorySeo.js.map +1 -1
  59. package/build/components-nextjs/StorySeo/index.js +1 -5
  60. package/build/components-nextjs/StorySeo/index.js.map +1 -1
  61. package/build/components-nextjs/document.d.ts +6 -0
  62. package/build/components-nextjs/document.js +21 -0
  63. package/build/components-nextjs/document.js.map +1 -0
  64. package/build/components-nextjs/index.d.ts +1 -0
  65. package/build/components-nextjs/index.js +3 -7
  66. package/build/components-nextjs/index.js.map +1 -1
  67. package/build/data-fetching/api/PrezlyApi.js +171 -363
  68. package/build/data-fetching/api/PrezlyApi.js.map +1 -1
  69. package/build/data-fetching/api/getPrezlyApi.js +5 -9
  70. package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
  71. package/build/data-fetching/api/index.js +1 -17
  72. package/build/data-fetching/api/index.js.map +1 -1
  73. package/build/data-fetching/api/queries.js +13 -45
  74. package/build/data-fetching/api/queries.js.map +1 -1
  75. package/build/data-fetching/index.js +3 -19
  76. package/build/data-fetching/index.js.map +1 -1
  77. package/build/data-fetching/lib/getAlgoliaSettings.js +6 -10
  78. package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
  79. package/build/data-fetching/lib/getEnvVariables.js +11 -29
  80. package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
  81. package/build/data-fetching/lib/index.js +4 -11
  82. package/build/data-fetching/lib/index.js.map +1 -1
  83. package/build/data-fetching/lib/isSdkError.js +1 -5
  84. package/build/data-fetching/lib/isSdkError.js.map +1 -1
  85. package/build/data-fetching/lib/isUuid.js +2 -6
  86. package/build/data-fetching/lib/isUuid.js.map +1 -1
  87. package/build/data-fetching/types.js +1 -2
  88. package/build/index.d.ts +1 -0
  89. package/build/index.js +9 -24
  90. package/build/index.js.map +1 -1
  91. package/build/infinite-loading/index.js +4 -24
  92. package/build/infinite-loading/index.js.map +1 -1
  93. package/build/infinite-loading/types.js +1 -2
  94. package/build/infinite-loading/useInfiniteGalleriesLoading.js +25 -83
  95. package/build/infinite-loading/useInfiniteGalleriesLoading.js.map +1 -1
  96. package/build/infinite-loading/useInfiniteLoading.js +21 -97
  97. package/build/infinite-loading/useInfiniteLoading.js.map +1 -1
  98. package/build/infinite-loading/useInfiniteStoriesLoading.js +36 -99
  99. package/build/infinite-loading/useInfiniteStoriesLoading.js.map +1 -1
  100. package/build/intl/index.js +4 -25
  101. package/build/intl/index.js.map +1 -1
  102. package/build/intl/languages.js +47 -93
  103. package/build/intl/languages.js.map +1 -1
  104. package/build/intl/locale.js +21 -27
  105. package/build/intl/locale.js.map +1 -1
  106. package/build/intl/localeConfig.js +11 -32
  107. package/build/intl/localeConfig.js.map +1 -1
  108. package/build/intl/localeObject.js +30 -49
  109. package/build/intl/localeObject.js.map +1 -1
  110. package/build/newsroom-context/context.js +18 -34
  111. package/build/newsroom-context/context.js.map +1 -1
  112. package/build/newsroom-context/hooks/index.js +11 -27
  113. package/build/newsroom-context/hooks/index.js.map +1 -1
  114. package/build/newsroom-context/hooks/useAlgoliaSettings.js +3 -7
  115. package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
  116. package/build/newsroom-context/hooks/useCategories.js +3 -7
  117. package/build/newsroom-context/hooks/useCategories.js.map +1 -1
  118. package/build/newsroom-context/hooks/useCompanyInformation.js +3 -7
  119. package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
  120. package/build/newsroom-context/hooks/useCurrentCategory.js +3 -7
  121. package/build/newsroom-context/hooks/useCurrentCategory.js.map +1 -1
  122. package/build/newsroom-context/hooks/useCurrentLocale.js +3 -7
  123. package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
  124. package/build/newsroom-context/hooks/useCurrentStory.js +3 -7
  125. package/build/newsroom-context/hooks/useCurrentStory.js.map +1 -1
  126. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +10 -14
  127. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
  128. package/build/newsroom-context/hooks/useGetTranslationUrl.js +17 -26
  129. package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
  130. package/build/newsroom-context/hooks/useLanguages.js +3 -7
  131. package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
  132. package/build/newsroom-context/hooks/useNewsroom.js +3 -7
  133. package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
  134. package/build/newsroom-context/hooks/useNewsroomContext.js +4 -8
  135. package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
  136. package/build/newsroom-context/index.js +2 -21
  137. package/build/newsroom-context/index.js.map +1 -1
  138. package/build/sentry/client.d.ts +2 -0
  139. package/build/sentry/client.js +5 -0
  140. package/build/sentry/client.js.map +1 -0
  141. package/build/sentry/common.d.ts +2 -0
  142. package/build/sentry/common.js +25 -0
  143. package/build/sentry/common.js.map +1 -0
  144. package/build/sentry/index.d.ts +2 -0
  145. package/build/sentry/index.js +3 -0
  146. package/build/sentry/index.js.map +1 -0
  147. package/build/sentry/server.d.ts +2 -0
  148. package/build/sentry/server.js +5 -0
  149. package/build/sentry/server.js.map +1 -0
  150. package/build/tsconfig.tsbuildinfo +1 -1
  151. package/build/types.js +1 -2
  152. package/build/utils/boilerplate.js +3 -9
  153. package/build/utils/boilerplate.js.map +1 -1
  154. package/build/utils/constants.js +3 -6
  155. package/build/utils/constants.js.map +1 -1
  156. package/build/utils/getAssetsUrl.js +3 -7
  157. package/build/utils/getAssetsUrl.js.map +1 -1
  158. package/build/utils/getDataRequestLink.js +3 -7
  159. package/build/utils/getDataRequestLink.js.map +1 -1
  160. package/build/utils/getLocalizedCategoryData.js +15 -32
  161. package/build/utils/getLocalizedCategoryData.js.map +1 -1
  162. package/build/utils/getNewsroomLogoUrl.js +6 -12
  163. package/build/utils/getNewsroomLogoUrl.js.map +1 -1
  164. package/build/utils/getPrivacyPortalUrl.js +3 -7
  165. package/build/utils/getPrivacyPortalUrl.js.map +1 -1
  166. package/build/utils/getStoryPublicationDate.js +2 -6
  167. package/build/utils/getStoryPublicationDate.js.map +1 -1
  168. package/build/utils/getUploadcareGroupUrl.js +3 -7
  169. package/build/utils/getUploadcareGroupUrl.js.map +1 -1
  170. package/build/utils/index.js +10 -26
  171. package/build/utils/index.js.map +1 -1
  172. package/build/utils/isEmbargoStory.js +1 -5
  173. package/build/utils/isEmbargoStory.js.map +1 -1
  174. package/package.json +2 -1
  175. package/src/adapter-nextjs/page-props/category.ts +5 -2
  176. package/src/adapter-nextjs/page-props/gallery.ts +5 -2
  177. package/src/adapter-nextjs/page-props/galleryAlbum.ts +5 -2
  178. package/src/adapter-nextjs/page-props/home.ts +5 -2
  179. package/src/adapter-nextjs/page-props/lib/types.ts +4 -4
  180. package/src/adapter-nextjs/page-props/search.ts +10 -3
  181. package/src/adapter-nextjs/page-props/story.ts +5 -2
  182. package/src/components-nextjs/document.tsx +38 -0
  183. package/src/components-nextjs/index.ts +1 -0
  184. package/src/index.ts +1 -0
  185. package/src/sentry/client.ts +7 -0
  186. package/src/sentry/common.ts +27 -0
  187. package/src/sentry/index.ts +2 -0
  188. package/src/sentry/server.ts +7 -0
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_GALLERY_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = exports.ASSETS_URL = void 0;
4
- exports.ASSETS_URL = 'https://cdn.uc.assets.prezly.com';
5
- exports.DEFAULT_PAGE_SIZE = 12;
6
- exports.DEFAULT_GALLERY_PAGE_SIZE = 6;
1
+ export const ASSETS_URL = 'https://cdn.uc.assets.prezly.com';
2
+ export const DEFAULT_PAGE_SIZE = 12;
3
+ export const DEFAULT_GALLERY_PAGE_SIZE = 6;
7
4
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,kCAAkC,CAAC;AAChD,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,yBAAyB,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,kCAAkC,CAAC;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC"}
@@ -1,13 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAssetsUrl = void 0;
4
- var constants_1 = require("./constants");
1
+ import { ASSETS_URL } from './constants';
5
2
  /**
6
3
  * @param uuid UUID of the assets hosted on Uploadcare
7
4
  * @returns Full asset URL that can be used as a source for <img>, <video> and <a> tags.
8
5
  */
9
- function getAssetsUrl(uuid) {
10
- return "".concat(constants_1.ASSETS_URL, "/").concat(uuid, "/");
6
+ export function getAssetsUrl(uuid) {
7
+ return `${ASSETS_URL}/${uuid}/`;
11
8
  }
12
- exports.getAssetsUrl = getAssetsUrl;
13
9
  //# sourceMappingURL=getAssetsUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAssetsUrl.js","sourceRoot":"","sources":["../../src/utils/getAssetsUrl.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AAEzC;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAY;IACrC,OAAO,UAAG,sBAAU,cAAI,IAAI,MAAG,CAAC;AACpC,CAAC;AAFD,oCAEC"}
1
+ {"version":3,"file":"getAssetsUrl.js","sourceRoot":"","sources":["../../src/utils/getAssetsUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACrC,OAAO,GAAG,UAAU,IAAI,IAAI,GAAG,CAAC;AACpC,CAAC"}
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDataRequestLink = void 0;
4
- var getPrivacyPortalUrl_1 = require("./getPrivacyPortalUrl");
5
- function getDataRequestLink(newsroom, currentLocale) {
1
+ import { getPrivacyPortalUrl } from './getPrivacyPortalUrl';
2
+ export function getDataRequestLink(newsroom, currentLocale) {
6
3
  return (newsroom.custom_data_request_link ||
7
- (0, getPrivacyPortalUrl_1.getPrivacyPortalUrl)(newsroom, currentLocale, {
4
+ getPrivacyPortalUrl(newsroom, currentLocale, {
8
5
  action: 'data-request',
9
6
  }));
10
7
  }
11
- exports.getDataRequestLink = getDataRequestLink;
12
8
  //# sourceMappingURL=getDataRequestLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDataRequestLink.js","sourceRoot":"","sources":["../../src/utils/getDataRequestLink.ts"],"names":[],"mappings":";;;AAIA,6DAA4D;AAE5D,SAAgB,kBAAkB,CAAC,QAAkB,EAAE,aAA2B;IAC9E,OAAO,CACH,QAAQ,CAAC,wBAAwB;QACjC,IAAA,yCAAmB,EAAC,QAAQ,EAAE,aAAa,EAAE;YACzC,MAAM,EAAE,cAAc;SACzB,CAAC,CACL,CAAC;AACN,CAAC;AAPD,gDAOC"}
1
+ {"version":3,"file":"getDataRequestLink.js","sourceRoot":"","sources":["../../src/utils/getDataRequestLink.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,kBAAkB,CAAC,QAAkB,EAAE,aAA2B;IAC9E,OAAO,CACH,QAAQ,CAAC,wBAAwB;QACjC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE;YACzC,MAAM,EAAE,cAAc;SACzB,CAAC,CACL,CAAC;AACN,CAAC"}
@@ -1,21 +1,7 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.getCategoryHasTranslation = exports.getCategoryUrl = exports.getLocalizedCategoryData = void 0;
15
1
  function isAlgoliaCategory(category) {
16
2
  return 'name' in category && 'slug' in category;
17
3
  }
18
- function getLocalizedCategoryData(category, locale) {
4
+ export function getLocalizedCategoryData(category, locale) {
19
5
  if (isAlgoliaCategory(category)) {
20
6
  return {
21
7
  description: null,
@@ -23,26 +9,23 @@ function getLocalizedCategoryData(category, locale) {
23
9
  slug: category.slug,
24
10
  };
25
11
  }
26
- var targetLocaleCode = locale.toUnderscoreCode();
27
- var i18n = category.i18n;
28
- var populatedLocales = Object.keys(i18n).filter(function (localeCode) { return i18n[localeCode].name; });
29
- var targetLocale = populatedLocales.find(function (localeCode) { return localeCode === targetLocaleCode; }) ||
30
- populatedLocales.find(function (localeCode) { return i18n[localeCode].name === category.display_name; }) ||
12
+ const targetLocaleCode = locale.toUnderscoreCode();
13
+ const { i18n } = category;
14
+ const populatedLocales = Object.keys(i18n).filter((localeCode) => i18n[localeCode].name);
15
+ const targetLocale = populatedLocales.find((localeCode) => localeCode === targetLocaleCode) ||
16
+ populatedLocales.find((localeCode) => i18n[localeCode].name === category.display_name) ||
31
17
  populatedLocales[0];
32
- var _a = i18n[targetLocale], _ = _a.locale, localizedData = __rest(_a, ["locale"]);
18
+ const { locale: _, ...localizedData } = i18n[targetLocale];
33
19
  return localizedData;
34
20
  }
35
- exports.getLocalizedCategoryData = getLocalizedCategoryData;
36
- function getCategoryUrl(category, locale) {
37
- var slug = getLocalizedCategoryData(category, locale).slug;
38
- return "/category/".concat(slug);
21
+ export function getCategoryUrl(category, locale) {
22
+ const { slug } = getLocalizedCategoryData(category, locale);
23
+ return `/category/${slug}`;
39
24
  }
40
- exports.getCategoryUrl = getCategoryUrl;
41
- function getCategoryHasTranslation(category, locale) {
42
- var targetLocaleCode = locale.toUnderscoreCode();
43
- var i18n = category.i18n;
44
- var populatedLocales = Object.keys(i18n).filter(function (localeCode) { return i18n[localeCode].name; });
45
- return Boolean(populatedLocales.find(function (localeCode) { return localeCode === targetLocaleCode; }));
25
+ export function getCategoryHasTranslation(category, locale) {
26
+ const targetLocaleCode = locale.toUnderscoreCode();
27
+ const { i18n } = category;
28
+ const populatedLocales = Object.keys(i18n).filter((localeCode) => i18n[localeCode].name);
29
+ return Boolean(populatedLocales.find((localeCode) => localeCode === targetLocaleCode));
46
30
  }
47
- exports.getCategoryHasTranslation = getCategoryHasTranslation;
48
31
  //# sourceMappingURL=getLocalizedCategoryData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getLocalizedCategoryData.js","sourceRoot":"","sources":["../../src/utils/getLocalizedCategoryData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAKA,SAAS,iBAAiB,CACtB,QAAuC;IAEvC,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,IAAI,QAAQ,CAAC;AACpD,CAAC;AAED,SAAgB,wBAAwB,CACpC,QAAuC,EACvC,MAAoB;IAEpB,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE;QAC7B,OAAO;YACH,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;SACtB,CAAC;KACL;IAED,IAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC3C,IAAA,IAAI,GAAK,QAAQ,KAAb,CAAc;IAC1B,IAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAC,UAAU,IAAK,OAAA,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,EAArB,CAAqB,CAAC,CAAC;IACzF,IAAM,YAAY,GACd,gBAAgB,CAAC,IAAI,CAAC,UAAC,UAAU,IAAK,OAAA,UAAU,KAAK,gBAAgB,EAA/B,CAA+B,CAAC;QACtE,gBAAgB,CAAC,IAAI,CAAC,UAAC,UAAU,IAAK,OAAA,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,YAAY,EAA/C,CAA+C,CAAC;QACtF,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAExB,IAAM,KAAkC,IAAI,CAAC,YAAY,CAAC,EAA1C,CAAC,YAAA,EAAK,aAAa,cAA7B,UAA+B,CAAqB,CAAC;IAE3D,OAAO,aAAa,CAAC;AACzB,CAAC;AAvBD,4DAuBC;AAED,SAAgB,cAAc,CAAC,QAAuC,EAAE,MAAoB;IAChF,IAAA,IAAI,GAAK,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,KAA/C,CAAgD;IAC5D,OAAO,oBAAa,IAAI,CAAE,CAAC;AAC/B,CAAC;AAHD,wCAGC;AAED,SAAgB,yBAAyB,CAAC,QAAkB,EAAE,MAAoB;IAC9E,IAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC3C,IAAA,IAAI,GAAK,QAAQ,KAAb,CAAc;IAC1B,IAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAC,UAAU,IAAK,OAAA,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,EAArB,CAAqB,CAAC,CAAC;IACzF,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAC,UAAU,IAAK,OAAA,UAAU,KAAK,gBAAgB,EAA/B,CAA+B,CAAC,CAAC,CAAC;AAC3F,CAAC;AALD,8DAKC"}
1
+ {"version":3,"file":"getLocalizedCategoryData.js","sourceRoot":"","sources":["../../src/utils/getLocalizedCategoryData.ts"],"names":[],"mappings":"AAKA,SAAS,iBAAiB,CACtB,QAAuC;IAEvC,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,IAAI,QAAQ,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,wBAAwB,CACpC,QAAuC,EACvC,MAAoB;IAEpB,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE;QAC7B,OAAO;YACH,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;SACtB,CAAC;KACL;IAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAC1B,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;IACzF,MAAM,YAAY,GACd,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,gBAAgB,CAAC;QACtE,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,YAAY,CAAC;QACtF,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAExB,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,aAAa,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IAE3D,OAAO,aAAa,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAuC,EAAE,MAAoB;IACxF,MAAM,EAAE,IAAI,EAAE,GAAG,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5D,OAAO,aAAa,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,QAAkB,EAAE,MAAoB;IAC9E,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAC1B,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;IACzF,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,gBAAgB,CAAC,CAAC,CAAC;AAC3F,CAAC"}
@@ -1,21 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNewsroomFaviconUrl = exports.getNewsroomLogoUrl = void 0;
4
- var getAssetsUrl_1 = require("./getAssetsUrl");
5
- function getNewsroomLogoUrl(newsroom) {
1
+ import { getAssetsUrl } from './getAssetsUrl';
2
+ export function getNewsroomLogoUrl(newsroom) {
6
3
  if (newsroom.newsroom_logo) {
7
- return (0, getAssetsUrl_1.getAssetsUrl)(newsroom.newsroom_logo.uuid);
4
+ return getAssetsUrl(newsroom.newsroom_logo.uuid);
8
5
  }
9
6
  return '';
10
7
  }
11
- exports.getNewsroomLogoUrl = getNewsroomLogoUrl;
12
- function getNewsroomFaviconUrl(newsroom, previewSize) {
13
- if (previewSize === void 0) { previewSize = 400; }
14
- var image = newsroom.icon || newsroom.square_logo;
8
+ export function getNewsroomFaviconUrl(newsroom, previewSize = 400) {
9
+ const image = newsroom.icon || newsroom.square_logo;
15
10
  if (image) {
16
- return "".concat((0, getAssetsUrl_1.getAssetsUrl)(image.uuid), "-/preview/").concat(previewSize, "x").concat(previewSize, "/-/quality/best/");
11
+ return `${getAssetsUrl(image.uuid)}-/preview/${previewSize}x${previewSize}/-/quality/best/`;
17
12
  }
18
13
  return '';
19
14
  }
20
- exports.getNewsroomFaviconUrl = getNewsroomFaviconUrl;
21
15
  //# sourceMappingURL=getNewsroomLogoUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getNewsroomLogoUrl.js","sourceRoot":"","sources":["../../src/utils/getNewsroomLogoUrl.ts"],"names":[],"mappings":";;;AAEA,+CAA8C;AAE9C,SAAgB,kBAAkB,CAAC,QAAkB;IACjD,IAAI,QAAQ,CAAC,aAAa,EAAE;QACxB,OAAO,IAAA,2BAAY,EAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KACpD;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAND,gDAMC;AAED,SAAgB,qBAAqB,CAAC,QAAkB,EAAE,WAAiB;IAAjB,4BAAA,EAAA,iBAAiB;IACvE,IAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW,CAAC;IACpD,IAAI,KAAK,EAAE;QACP,OAAO,UAAG,IAAA,2BAAY,EAAC,KAAK,CAAC,IAAI,CAAC,uBAAa,WAAW,cAAI,WAAW,qBAAkB,CAAC;KAC/F;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAPD,sDAOC"}
1
+ {"version":3,"file":"getNewsroomLogoUrl.js","sourceRoot":"","sources":["../../src/utils/getNewsroomLogoUrl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,UAAU,kBAAkB,CAAC,QAAkB;IACjD,IAAI,QAAQ,CAAC,aAAa,EAAE;QACxB,OAAO,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KACpD;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAkB,EAAE,WAAW,GAAG,GAAG;IACvE,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW,CAAC;IACpD,IAAI,KAAK,EAAE;QACP,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,WAAW,IAAI,WAAW,kBAAkB,CAAC;KAC/F;IAED,OAAO,EAAE,CAAC;AACd,CAAC"}
@@ -1,13 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPrivacyPortalUrl = void 0;
4
- function getPrivacyPortalUrl(newsroom, locale, options) {
5
- var _a = options || {}, email = _a.email, _b = _a.action, action = _b === void 0 ? 'subscribe' : _b;
6
- var url = new URL("/".concat(locale.toUrlSlug(), "/newsroom/").concat(newsroom.uuid, "/").concat(action), 'https://privacy.prezly.com');
1
+ export function getPrivacyPortalUrl(newsroom, locale, options) {
2
+ const { email, action = 'subscribe' } = options || {};
3
+ const url = new URL(`/${locale.toUrlSlug()}/newsroom/${newsroom.uuid}/${action}`, 'https://privacy.prezly.com');
7
4
  if (email) {
8
5
  url.searchParams.append('email', email);
9
6
  }
10
7
  return url.toString();
11
8
  }
12
- exports.getPrivacyPortalUrl = getPrivacyPortalUrl;
13
9
  //# sourceMappingURL=getPrivacyPortalUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPrivacyPortalUrl.js","sourceRoot":"","sources":["../../src/utils/getPrivacyPortalUrl.ts"],"names":[],"mappings":";;;AASA,SAAgB,mBAAmB,CAC/B,QAAkB,EAClB,MAAoB,EACpB,OAAiC;IAE3B,IAAA,KAAkC,OAAO,IAAI,EAAE,EAA7C,KAAK,WAAA,EAAE,cAAoB,EAApB,MAAM,mBAAG,WAAW,KAAkB,CAAC;IAEtD,IAAM,GAAG,GAAG,IAAI,GAAG,CACf,WAAI,MAAM,CAAC,SAAS,EAAE,uBAAa,QAAQ,CAAC,IAAI,cAAI,MAAM,CAAE,EAC5D,4BAA4B,CAC/B,CAAC;IACF,IAAI,KAAK,EAAE;QACP,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAC3C;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC;AAfD,kDAeC"}
1
+ {"version":3,"file":"getPrivacyPortalUrl.js","sourceRoot":"","sources":["../../src/utils/getPrivacyPortalUrl.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,mBAAmB,CAC/B,QAAkB,EAClB,MAAoB,EACpB,OAAiC;IAEjC,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAEtD,MAAM,GAAG,GAAG,IAAI,GAAG,CACf,IAAI,MAAM,CAAC,SAAS,EAAE,aAAa,QAAQ,CAAC,IAAI,IAAI,MAAM,EAAE,EAC5D,4BAA4B,CAC/B,CAAC;IACF,IAAI,KAAK,EAAE;QACP,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAC3C;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC"}
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStoryPublicationDate = void 0;
4
- function getStoryPublicationDate(story) {
5
- var published_at = story.published_at;
1
+ export function getStoryPublicationDate(story) {
2
+ const { published_at } = story;
6
3
  if (!published_at) {
7
4
  return null;
8
5
  }
@@ -10,5 +7,4 @@ function getStoryPublicationDate(story) {
10
7
  ? new Date(published_at)
11
8
  : new Date(published_at * 1000);
12
9
  }
13
- exports.getStoryPublicationDate = getStoryPublicationDate;
14
10
  //# sourceMappingURL=getStoryPublicationDate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getStoryPublicationDate.js","sourceRoot":"","sources":["../../src/utils/getStoryPublicationDate.tsx"],"names":[],"mappings":";;;AAIA,SAAgB,uBAAuB,CAAC,KAA2B;IACvD,IAAA,YAAY,GAAK,KAAK,aAAV,CAAW;IAE/B,IAAI,CAAC,YAAY,EAAE;QACf,OAAO,IAAI,CAAC;KACf;IAED,OAAO,OAAO,YAAY,KAAK,QAAQ;QACnC,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC;QACxB,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;AACxC,CAAC;AAVD,0DAUC"}
1
+ {"version":3,"file":"getStoryPublicationDate.js","sourceRoot":"","sources":["../../src/utils/getStoryPublicationDate.tsx"],"names":[],"mappings":"AAIA,MAAM,UAAU,uBAAuB,CAAC,KAA2B;IAC/D,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE/B,IAAI,CAAC,YAAY,EAAE;QACf,OAAO,IAAI,CAAC;KACf;IAED,OAAO,OAAO,YAAY,KAAK,QAAQ;QACnC,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC;QACxB,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;AACxC,CAAC"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUploadcareGroupUrl = void 0;
4
- var constants_1 = require("./constants");
1
+ import { ASSETS_URL } from './constants';
5
2
  /**
6
3
  * This method constructs a URL to download all images in the Gallery as a single archive.
7
4
  *
@@ -9,8 +6,7 @@ var constants_1 = require("./constants");
9
6
  * @param title Filename for the saved archive. Usually it is the Gallery title.
10
7
  * @returns URL to an archive containing all of the images in the Gallery.
11
8
  */
12
- function getUploadcareGroupUrl(uuid, title) {
13
- return "".concat(constants_1.ASSETS_URL, "/").concat(uuid, "/archive/zip/").concat(encodeURI(title), ".zip");
9
+ export function getUploadcareGroupUrl(uuid, title) {
10
+ return `${ASSETS_URL}/${uuid}/archive/zip/${encodeURI(title)}.zip`;
14
11
  }
15
- exports.getUploadcareGroupUrl = getUploadcareGroupUrl;
16
12
  //# sourceMappingURL=getUploadcareGroupUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUploadcareGroupUrl.js","sourceRoot":"","sources":["../../src/utils/getUploadcareGroupUrl.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AAEzC;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,IAAY,EAAE,KAAa;IAC7D,OAAO,UAAG,sBAAU,cAAI,IAAI,0BAAgB,SAAS,CAAC,KAAK,CAAC,SAAM,CAAC;AACvE,CAAC;AAFD,sDAEC"}
1
+ {"version":3,"file":"getUploadcareGroupUrl.js","sourceRoot":"","sources":["../../src/utils/getUploadcareGroupUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,KAAa;IAC7D,OAAO,GAAG,UAAU,IAAI,IAAI,gBAAgB,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;AACvE,CAAC"}
@@ -1,27 +1,11 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./boilerplate"), exports);
18
- __exportStar(require("./constants"), exports);
19
- __exportStar(require("./getAssetsUrl"), exports);
20
- __exportStar(require("./getDataRequestLink"), exports);
21
- __exportStar(require("./getLocalizedCategoryData"), exports);
22
- __exportStar(require("./getNewsroomLogoUrl"), exports);
23
- __exportStar(require("./getPrivacyPortalUrl"), exports);
24
- __exportStar(require("./getStoryPublicationDate"), exports);
25
- __exportStar(require("./getUploadcareGroupUrl"), exports);
26
- __exportStar(require("./isEmbargoStory"), exports);
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';
27
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,uDAAqC;AACrC,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC"}
@@ -1,8 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEmbargoStory = void 0;
4
- function isEmbargoStory(story) {
1
+ export function isEmbargoStory(story) {
5
2
  return story.is_embargo && Boolean(story.published_at);
6
3
  }
7
- exports.isEmbargoStory = isEmbargoStory;
8
4
  //# sourceMappingURL=isEmbargoStory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isEmbargoStory.js","sourceRoot":"","sources":["../../src/utils/isEmbargoStory.ts"],"names":[],"mappings":";;;AAOA,SAAgB,cAAc,CAAC,KAAY;IACvC,OAAO,KAAK,CAAC,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAC3D,CAAC;AAFD,wCAEC"}
1
+ {"version":3,"file":"isEmbargoStory.js","sourceRoot":"","sources":["../../src/utils/isEmbargoStory.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,cAAc,CAAC,KAAY;IACvC,OAAO,KAAK,CAAC,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAC3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/theme-kit-nextjs",
3
- "version": "1.15.0",
3
+ "version": "1.16.0-1",
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",
@@ -55,6 +55,7 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@prezly/eslint-config": "4.2.0",
58
+ "@sentry/nextjs": "^7.7.0",
58
59
  "@types/jest": "28.1.6",
59
60
  "@types/node": "17.0.14",
60
61
  "@types/parse-data-url": "3.0.0",
@@ -87,7 +87,7 @@ export function getCategoryPageServerSideProps<
87
87
  export function getCategoryPageStaticProps<
88
88
  CustomProps extends Record<string, any>,
89
89
  StoryType extends Story = Story,
90
- >(customProps: CustomProps | PropsFunction<CustomProps>, options?: Options) {
90
+ >(customProps: CustomProps | PropsFunction<CustomProps, GetStaticPropsContext>, options?: Options) {
91
91
  const { pageSize = DEFAULT_PAGE_SIZE, extraStoryFields } = options || {};
92
92
 
93
93
  return async function getStaticProps(
@@ -126,7 +126,10 @@ export function getCategoryPageStaticProps<
126
126
  pageSize,
127
127
  },
128
128
  ...(typeof customProps === 'function'
129
- ? await (customProps as PropsFunction<CustomProps>)(context, staticProps)
129
+ ? await (customProps as PropsFunction<CustomProps, GetStaticPropsContext>)(
130
+ context,
131
+ staticProps,
132
+ )
130
133
  : customProps),
131
134
  });
132
135
  };
@@ -71,7 +71,7 @@ export function getGalleryPageServerSideProps<CustomProps extends Record<string,
71
71
  }
72
72
 
73
73
  export function getGalleryPageStaticProps<CustomProps extends Record<string, any>>(
74
- customProps: CustomProps | PropsFunction<CustomProps>,
74
+ customProps: CustomProps | PropsFunction<CustomProps, GetStaticPropsContext>,
75
75
  options?: Options,
76
76
  ) {
77
77
  const { pageSize = DEFAULT_GALLERY_PAGE_SIZE } = options || {};
@@ -104,7 +104,10 @@ export function getGalleryPageStaticProps<CustomProps extends Record<string, any
104
104
  pageSize,
105
105
  },
106
106
  ...(typeof customProps === 'function'
107
- ? await (customProps as PropsFunction<CustomProps>)(context, staticProps)
107
+ ? await (customProps as PropsFunction<CustomProps, GetStaticPropsContext>)(
108
+ context,
109
+ staticProps,
110
+ )
108
111
  : customProps),
109
112
  });
110
113
  };
@@ -49,7 +49,7 @@ export function getGalleryAlbumPageServerSideProps<CustomProps extends Record<st
49
49
  }
50
50
 
51
51
  export function getGalleryAlbumPageStaticProps<CustomProps extends Record<string, any>>(
52
- customProps: CustomProps | PropsFunction<CustomProps>,
52
+ customProps: CustomProps | PropsFunction<CustomProps, GetStaticPropsContext>,
53
53
  ) {
54
54
  return async function getStaticProps(
55
55
  context: GetStaticPropsContext,
@@ -67,7 +67,10 @@ export function getGalleryAlbumPageStaticProps<CustomProps extends Record<string
67
67
  ...staticProps,
68
68
  gallery,
69
69
  ...(typeof customProps === 'function'
70
- ? await (customProps as PropsFunction<CustomProps>)(context, staticProps)
70
+ ? await (customProps as PropsFunction<CustomProps, GetStaticPropsContext>)(
71
+ context,
72
+ staticProps,
73
+ )
71
74
  : customProps),
72
75
  });
73
76
  };
@@ -74,7 +74,7 @@ export function getHomepageServerSideProps<
74
74
  export function getHomepageStaticProps<
75
75
  CustomProps extends Record<string, any>,
76
76
  StoryType extends Story = Story,
77
- >(customProps: CustomProps | PropsFunction<CustomProps>, options?: Options) {
77
+ >(customProps: CustomProps | PropsFunction<CustomProps, GetStaticPropsContext>, options?: Options) {
78
78
  const { pageSize = DEFAULT_PAGE_SIZE, extraStoryFields } = options || {};
79
79
 
80
80
  return async function getStaticProps(
@@ -103,7 +103,10 @@ export function getHomepageStaticProps<
103
103
  pageSize,
104
104
  },
105
105
  ...(typeof customProps === 'function'
106
- ? await (customProps as PropsFunction<CustomProps>)(context, staticProps)
106
+ ? await (customProps as PropsFunction<CustomProps, GetStaticPropsContext>)(
107
+ context,
108
+ staticProps,
109
+ )
107
110
  : customProps),
108
111
  });
109
112
  };
@@ -2,7 +2,7 @@ import type { GetServerSidePropsContext, GetStaticPropsContext } from 'next';
2
2
 
3
3
  import type { PageProps } from '../../../types';
4
4
 
5
- export type PropsFunction<CustomProps> = (
6
- context: GetServerSidePropsContext | GetStaticPropsContext,
7
- props: PageProps,
8
- ) => CustomProps | Promise<CustomProps>;
5
+ export type PropsFunction<
6
+ CustomProps,
7
+ Context extends GetServerSidePropsContext | GetStaticPropsContext = GetServerSidePropsContext,
8
+ > = (context: Context, props: PageProps) => CustomProps | Promise<CustomProps>;
@@ -1,4 +1,8 @@
1
- import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';
1
+ import type {
2
+ GetServerSidePropsContext,
3
+ GetServerSidePropsResult,
4
+ GetStaticPropsContext,
5
+ } from 'next';
2
6
 
3
7
  import { getNewsroomServerSideProps } from '../getNewsroomServerSideProps';
4
8
  import { getNewsroomStaticProps } from '../getNewsroomStaticProps';
@@ -29,7 +33,7 @@ export function getSearchPageServerSideProps<CustomProps extends Record<string,
29
33
  }
30
34
 
31
35
  export function getSearchPageStaticProps<CustomProps extends Record<string, any>>(
32
- customProps: CustomProps | PropsFunction<CustomProps>,
36
+ customProps: CustomProps | PropsFunction<CustomProps, GetStaticPropsContext>,
33
37
  ) {
34
38
  return async function getStaticProps(
35
39
  context: GetServerSidePropsContext,
@@ -39,7 +43,10 @@ export function getSearchPageStaticProps<CustomProps extends Record<string, any>
39
43
  return processStaticRequest(context, {
40
44
  ...staticProps,
41
45
  ...(typeof customProps === 'function'
42
- ? await (customProps as PropsFunction<CustomProps>)(context, staticProps)
46
+ ? await (customProps as PropsFunction<CustomProps, GetStaticPropsContext>)(
47
+ context,
48
+ staticProps,
49
+ )
43
50
  : customProps),
44
51
  });
45
52
  };
@@ -54,7 +54,7 @@ export function getStoryPageServerSideProps<CustomProps extends Record<string, a
54
54
  }
55
55
 
56
56
  export function getStoryPageStaticProps<CustomProps extends Record<string, any>>(
57
- customProps: CustomProps | PropsFunction<CustomProps>,
57
+ customProps: CustomProps | PropsFunction<CustomProps, GetStaticPropsContext>,
58
58
  ) {
59
59
  return async function getStaticProps(
60
60
  context: GetStaticPropsContext,
@@ -76,7 +76,10 @@ export function getStoryPageStaticProps<CustomProps extends Record<string, any>>
76
76
  currentStory: story,
77
77
  },
78
78
  ...(typeof customProps === 'function'
79
- ? await (customProps as PropsFunction<CustomProps>)(context, staticProps)
79
+ ? await (customProps as PropsFunction<CustomProps, GetStaticPropsContext>)(
80
+ context,
81
+ staticProps,
82
+ )
80
83
  : customProps),
81
84
  });
82
85
  };
@@ -0,0 +1,38 @@
1
+ import Document, { Head, Html, Main, NextScript } from 'next/document';
2
+
3
+ import { DEFAULT_LOCALE, getLocaleDirection, LocaleObject } from '../intl';
4
+ import type { PageProps } from '../types';
5
+
6
+ export class PrezlyThemeDocument extends Document {
7
+ getLocaleCode() {
8
+ const {
9
+ newsroomContextProps,
10
+ // eslint-disable-next-line no-underscore-dangle
11
+ } = this.props.__NEXT_DATA__.props.pageProps as PageProps;
12
+
13
+ // In some cases (like server errors) the newsroom context props will not be loaded.
14
+ // We need to fall back to default locale to keep the app working.
15
+ const { localeCode } = newsroomContextProps ?? { localeCode: DEFAULT_LOCALE };
16
+
17
+ return localeCode;
18
+ }
19
+
20
+ render() {
21
+ const locale = LocaleObject.fromAnyCode(this.getLocaleCode());
22
+ // TODO: The direction can be pulled from the Language object
23
+ const direction = getLocaleDirection(locale);
24
+
25
+ return (
26
+ <Html lang={locale.toHyphenCode()} dir={direction}>
27
+ <Head>
28
+ <meta name="og:locale" content={locale.toHyphenCode()} />
29
+ {/* TODO: Add alternate locales */}
30
+ </Head>
31
+ <body>
32
+ <Main />
33
+ <NextScript />
34
+ </body>
35
+ </Html>
36
+ );
37
+ }
38
+ }
@@ -1,2 +1,3 @@
1
1
  export { PageSeo } from './PageSeo';
2
2
  export { StorySeo } from './StorySeo';
3
+ export { PrezlyThemeDocument } from './document';
package/src/index.ts CHANGED
@@ -4,5 +4,6 @@ export * from './data-fetching';
4
4
  export * from './infinite-loading';
5
5
  export * from './intl';
6
6
  export * from './newsroom-context';
7
+ export * from './sentry';
7
8
  export * from './types';
8
9
  export * from './utils';
@@ -0,0 +1,7 @@
1
+ import type { init } from '@sentry/nextjs';
2
+
3
+ import { getCommonClientOptions } from './common';
4
+
5
+ export function getSentryClientOptions(dsn: string, themeName: string): Parameters<typeof init>[0] {
6
+ return getCommonClientOptions(dsn, themeName);
7
+ }
@@ -0,0 +1,27 @@
1
+ import type { init } from '@sentry/nextjs';
2
+
3
+ export function getCommonClientOptions(dsn: string, themeName: string): Parameters<typeof init>[0] {
4
+ return {
5
+ dsn,
6
+ // Adjust this value in production, or use tracesSampler for greater control
7
+ tracesSampleRate: 0.02,
8
+ // ...
9
+ // Note: if you want to override the automatic release value, do not set a
10
+ // `release` value here - use the environment variable `SENTRY_RELEASE`, so
11
+ // that it will also get attached to your source maps
12
+
13
+ ignoreErrors: [
14
+ // This particular error is coming from Microsoft Outlook SafeLink crawler.
15
+ // It doesn't affect the user experience in any way, but produces a lot of unwanted Sentry events.
16
+ // See https://forum.sentry.io/t/unhandledrejection-non-error-promise-rejection-captured-with-value/14062
17
+ 'Object Not Found Matching Id',
18
+ // This error is caused by `beacon.min.js` polyfill in Cloudflare Insights. From what we see, it doesn't affect the user experience.
19
+ 'Illegal invocation',
20
+ ],
21
+ // Attach theme tag to each event
22
+ initialScope: (scope) => {
23
+ scope.setTags({ prezly_theme: themeName });
24
+ return scope;
25
+ },
26
+ };
27
+ }
@@ -0,0 +1,2 @@
1
+ export { getSentryClientOptions } from './client';
2
+ export { getSentryServerOptions } from './server';
@@ -0,0 +1,7 @@
1
+ import type { init } from '@sentry/nextjs';
2
+
3
+ import { getCommonClientOptions } from './common';
4
+
5
+ export function getSentryServerOptions(dsn: string, themeName: string): Parameters<typeof init>[0] {
6
+ return getCommonClientOptions(dsn, themeName);
7
+ }