@prezly/theme-kit-nextjs 1.0.3 → 1.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 (85) hide show
  1. package/build/adapter-nextjs/getBasePageProps.js +7 -3
  2. package/build/adapter-nextjs/getBasePageProps.js.map +1 -1
  3. package/build/adapter-nextjs/index.js +14 -2
  4. package/build/adapter-nextjs/index.js.map +1 -1
  5. package/build/adapter-nextjs/processRequest.js +7 -3
  6. package/build/adapter-nextjs/processRequest.js.map +1 -1
  7. package/build/data-fetching/api/PrezlyApi.js +33 -26
  8. package/build/data-fetching/api/PrezlyApi.js.map +1 -1
  9. package/build/data-fetching/api/getPrezlyApi.js +9 -5
  10. package/build/data-fetching/api/getPrezlyApi.js.map +1 -1
  11. package/build/data-fetching/api/index.js +14 -2
  12. package/build/data-fetching/api/index.js.map +1 -1
  13. package/build/data-fetching/api/languages.js +26 -17
  14. package/build/data-fetching/api/languages.js.map +1 -1
  15. package/build/data-fetching/api/queries.js +13 -5
  16. package/build/data-fetching/api/queries.js.map +1 -1
  17. package/build/data-fetching/constants.js +5 -2
  18. package/build/data-fetching/constants.js.map +1 -1
  19. package/build/data-fetching/getAssetsUrl.js +7 -3
  20. package/build/data-fetching/getAssetsUrl.js.map +1 -1
  21. package/build/data-fetching/getLocalizedCategoryData.js +9 -3
  22. package/build/data-fetching/getLocalizedCategoryData.js.map +1 -1
  23. package/build/data-fetching/getNewsroomLogoUrl.js +10 -5
  24. package/build/data-fetching/getNewsroomLogoUrl.js.map +1 -1
  25. package/build/data-fetching/getPrivacyPortalUrl.js +5 -1
  26. package/build/data-fetching/getPrivacyPortalUrl.js.map +1 -1
  27. package/build/data-fetching/getStoryPublicationDate.jsx +5 -1
  28. package/build/data-fetching/getStoryPublicationDate.jsx.map +1 -1
  29. package/build/data-fetching/getUploadcareGroupUrl.js +7 -3
  30. package/build/data-fetching/getUploadcareGroupUrl.js.map +1 -1
  31. package/build/data-fetching/index.js +21 -9
  32. package/build/data-fetching/index.js.map +1 -1
  33. package/build/data-fetching/lib/getAlgoliaSettings.js +7 -3
  34. package/build/data-fetching/lib/getAlgoliaSettings.js.map +1 -1
  35. package/build/data-fetching/lib/getEnvVariables.js +10 -3
  36. package/build/data-fetching/lib/getEnvVariables.js.map +1 -1
  37. package/build/data-fetching/types.js +2 -1
  38. package/build/index.js +17 -5
  39. package/build/index.js.map +1 -1
  40. package/build/intl/index.d.ts +1 -1
  41. package/build/intl/index.js +21 -4
  42. package/build/intl/index.js.map +1 -1
  43. package/build/intl/lang.js +5 -1
  44. package/build/intl/lang.js.map +1 -1
  45. package/build/intl/locale.js +17 -11
  46. package/build/intl/locale.js.map +1 -1
  47. package/build/intl/{localeConfig.d.cts → localeConfig.d.ts} +0 -0
  48. package/build/intl/{localeConfig.cjs → localeConfig.js} +1 -2
  49. package/build/intl/localeConfig.js.map +1 -0
  50. package/build/intl/localeObject.js +10 -3
  51. package/build/intl/localeObject.js.map +1 -1
  52. package/build/newsroom-context/context.jsx +11 -7
  53. package/build/newsroom-context/context.jsx.map +1 -1
  54. package/build/newsroom-context/hooks/index.js +23 -11
  55. package/build/newsroom-context/hooks/index.js.map +1 -1
  56. package/build/newsroom-context/hooks/useAlgoliaSettings.js +7 -3
  57. package/build/newsroom-context/hooks/useAlgoliaSettings.js.map +1 -1
  58. package/build/newsroom-context/hooks/useCategories.js +7 -3
  59. package/build/newsroom-context/hooks/useCategories.js.map +1 -1
  60. package/build/newsroom-context/hooks/useCompanyInformation.js +7 -3
  61. package/build/newsroom-context/hooks/useCompanyInformation.js.map +1 -1
  62. package/build/newsroom-context/hooks/useCurrentLocale.js +7 -3
  63. package/build/newsroom-context/hooks/useCurrentLocale.js.map +1 -1
  64. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js +15 -11
  65. package/build/newsroom-context/hooks/useGetLinkLocaleSlug.js.map +1 -1
  66. package/build/newsroom-context/hooks/useGetTranslationUrl.js +16 -12
  67. package/build/newsroom-context/hooks/useGetTranslationUrl.js.map +1 -1
  68. package/build/newsroom-context/hooks/useLanguages.js +7 -3
  69. package/build/newsroom-context/hooks/useLanguages.js.map +1 -1
  70. package/build/newsroom-context/hooks/useNewsroom.js +7 -3
  71. package/build/newsroom-context/hooks/useNewsroom.js.map +1 -1
  72. package/build/newsroom-context/hooks/useNewsroomContext.js +8 -4
  73. package/build/newsroom-context/hooks/useNewsroomContext.js.map +1 -1
  74. package/build/newsroom-context/hooks/useSelectedCategory.js +7 -3
  75. package/build/newsroom-context/hooks/useSelectedCategory.js.map +1 -1
  76. package/build/newsroom-context/hooks/useSelectedStory.js +7 -3
  77. package/build/newsroom-context/hooks/useSelectedStory.js.map +1 -1
  78. package/build/newsroom-context/index.js +17 -2
  79. package/build/newsroom-context/index.js.map +1 -1
  80. package/build/types.js +2 -1
  81. package/package.json +1 -2
  82. package/src/intl/index.ts +1 -1
  83. package/src/intl/{localeConfig.cjs → localeConfig.js} +0 -1
  84. package/src/intl/localeObject.ts +1 -1
  85. package/build/intl/localeConfig.cjs.map +0 -1
@@ -1,21 +1,25 @@
1
- import { useCallback } from 'react';
2
- import { getShortestLocaleCode } from '../../data-fetching';
3
- import { LocaleObject } from '../../intl';
4
- import { useCurrentLocale } from './useCurrentLocale';
5
- import { useLanguages } from './useLanguages';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useGetLinkLocaleSlug = void 0;
4
+ const react_1 = require("react");
5
+ const data_fetching_1 = require("../../data-fetching");
6
+ const intl_1 = require("../../intl");
7
+ const useCurrentLocale_1 = require("./useCurrentLocale");
8
+ const useLanguages_1 = require("./useLanguages");
6
9
  // Determine correct locale slug for the link (trying to shorten the locale code if possible)
7
10
  function getLinkLocaleSlug(languages, locale) {
8
- const shortestLocaleCode = getShortestLocaleCode(languages, locale);
11
+ const shortestLocaleCode = (0, data_fetching_1.getShortestLocaleCode)(languages, locale);
9
12
  // When navigating to default language, we don't append the locale to the URL.
10
13
  if (!shortestLocaleCode) {
11
14
  return shortestLocaleCode;
12
15
  }
13
- return LocaleObject.fromAnyCode(shortestLocaleCode).toUrlSlug();
16
+ return intl_1.LocaleObject.fromAnyCode(shortestLocaleCode).toUrlSlug();
14
17
  }
15
- export function useGetLinkLocaleSlug() {
16
- const currentLocale = useCurrentLocale();
17
- const languages = useLanguages();
18
+ function useGetLinkLocaleSlug() {
19
+ const currentLocale = (0, useCurrentLocale_1.useCurrentLocale)();
20
+ const languages = (0, useLanguages_1.useLanguages)();
18
21
  // The `locale` parameter is mainly used for Language Dropdown
19
- return useCallback((locale) => getLinkLocaleSlug(languages, locale || currentLocale), [languages, currentLocale]);
22
+ return (0, react_1.useCallback)((locale) => getLinkLocaleSlug(languages, locale || currentLocale), [languages, currentLocale]);
20
23
  }
24
+ exports.useGetLinkLocaleSlug = useGetLinkLocaleSlug;
21
25
  //# sourceMappingURL=useGetLinkLocaleSlug.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGetLinkLocaleSlug.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetLinkLocaleSlug.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,6FAA6F;AAC7F,SAAS,iBAAiB,CACtB,SAAqC,EACrC,MAAoB;IAEpB,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACpE,8EAA8E;IAC9E,IAAI,CAAC,kBAAkB,EAAE;QACrB,OAAO,kBAAkB,CAAC;KAC7B;IAED,OAAO,YAAY,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,oBAAoB;IAChC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,8DAA8D;IAC9D,OAAO,WAAW,CACd,CAAC,MAAqB,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,IAAI,aAAa,CAAC,EAChF,CAAC,SAAS,EAAE,aAAa,CAAC,CAC7B,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"useGetLinkLocaleSlug.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetLinkLocaleSlug.ts"],"names":[],"mappings":";;;AACA,iCAAoC;AAEpC,uDAA4D;AAC5D,qCAA0C;AAE1C,yDAAsD;AACtD,iDAA8C;AAE9C,6FAA6F;AAC7F,SAAS,iBAAiB,CACtB,SAAqC,EACrC,MAAoB;IAEpB,MAAM,kBAAkB,GAAG,IAAA,qCAAqB,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACpE,8EAA8E;IAC9E,IAAI,CAAC,kBAAkB,EAAE;QACrB,OAAO,kBAAkB,CAAC;KAC7B;IAED,OAAO,mBAAY,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC;AACpE,CAAC;AAED,SAAgB,oBAAoB;IAChC,MAAM,aAAa,GAAG,IAAA,mCAAgB,GAAE,CAAC;IACzC,MAAM,SAAS,GAAG,IAAA,2BAAY,GAAE,CAAC;IAEjC,8DAA8D;IAC9D,OAAO,IAAA,mBAAW,EACd,CAAC,MAAqB,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,IAAI,aAAa,CAAC,EAChF,CAAC,SAAS,EAAE,aAAa,CAAC,CAC7B,CAAC;AACN,CAAC;AATD,oDASC"}
@@ -1,13 +1,16 @@
1
- import { useRouter } from 'next/router';
2
- import { useCallback } from 'react';
3
- import { getCategoryHasTranslation, getCategoryUrl } from '../../data-fetching';
4
- import { useSelectedCategory } from './useSelectedCategory';
5
- import { useSelectedStory } from './useSelectedStory';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useGetTranslationUrl = void 0;
4
+ const router_1 = require("next/router");
5
+ const react_1 = require("react");
6
+ const data_fetching_1 = require("../../data-fetching");
7
+ const useSelectedCategory_1 = require("./useSelectedCategory");
8
+ const useSelectedStory_1 = require("./useSelectedStory");
6
9
  // Determine correct URL for translated stories/categories with a fallback to homepage
7
10
  function getTranslationUrl(locale, path, selectedCategory, selectedStory, noFallback) {
8
11
  if (selectedCategory) {
9
- if (getCategoryHasTranslation(selectedCategory, locale)) {
10
- return getCategoryUrl(selectedCategory, locale);
12
+ if ((0, data_fetching_1.getCategoryHasTranslation)(selectedCategory, locale)) {
13
+ return (0, data_fetching_1.getCategoryUrl)(selectedCategory, locale);
11
14
  }
12
15
  if (noFallback) {
13
16
  return '';
@@ -27,10 +30,11 @@ function getTranslationUrl(locale, path, selectedCategory, selectedStory, noFall
27
30
  }
28
31
  return path;
29
32
  }
30
- export function useGetTranslationUrl() {
31
- const { asPath } = useRouter();
32
- const selectedCategory = useSelectedCategory();
33
- const selectedStory = useSelectedStory();
34
- return useCallback((locale, noFallback) => getTranslationUrl(locale, asPath, selectedCategory, selectedStory, noFallback), [asPath, selectedCategory, selectedStory]);
33
+ function useGetTranslationUrl() {
34
+ const { asPath } = (0, router_1.useRouter)();
35
+ const selectedCategory = (0, useSelectedCategory_1.useSelectedCategory)();
36
+ const selectedStory = (0, useSelectedStory_1.useSelectedStory)();
37
+ return (0, react_1.useCallback)((locale, noFallback) => getTranslationUrl(locale, asPath, selectedCategory, selectedStory, noFallback), [asPath, selectedCategory, selectedStory]);
35
38
  }
39
+ exports.useGetTranslationUrl = useGetTranslationUrl;
36
40
  //# sourceMappingURL=useGetTranslationUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGetTranslationUrl.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetTranslationUrl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,sFAAsF;AACtF,SAAS,iBAAiB,CACtB,MAAoB,EACpB,IAAY,EACZ,gBAA2B,EAC3B,aAAqB,EACrB,UAAoB;IAEpB,IAAI,gBAAgB,EAAE;QAClB,IAAI,yBAAyB,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE;YACrD,OAAO,cAAc,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;SACnD;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,aAAa,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC9D,MAAM,eAAe,GAAG,aAAa,CAAC,YAAY,CAAC,IAAI,CACnD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,CACjD,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,MAAM,UAAU,oBAAoB;IAChC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IAEzC,OAAO,WAAW,CACd,CAAC,MAAoB,EAAE,UAAoB,EAAE,EAAE,CAC3C,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,CAAC,EAClF,CAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAC5C,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"useGetTranslationUrl.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useGetTranslationUrl.ts"],"names":[],"mappings":";;;AACA,wCAAwC;AACxC,iCAAoC;AAEpC,uDAAgF;AAGhF,+DAA4D;AAC5D,yDAAsD;AAEtD,sFAAsF;AACtF,SAAS,iBAAiB,CACtB,MAAoB,EACpB,IAAY,EACZ,gBAA2B,EAC3B,aAAqB,EACrB,UAAoB;IAEpB,IAAI,gBAAgB,EAAE;QAClB,IAAI,IAAA,yCAAyB,EAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE;YACrD,OAAO,IAAA,8BAAc,EAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;SACnD;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,aAAa,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;QAC9D,MAAM,eAAe,GAAG,aAAa,CAAC,YAAY,CAAC,IAAI,CACnD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,CACjD,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,SAAgB,oBAAoB;IAChC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;IAC/B,MAAM,gBAAgB,GAAG,IAAA,yCAAmB,GAAE,CAAC;IAC/C,MAAM,aAAa,GAAG,IAAA,mCAAgB,GAAE,CAAC;IAEzC,OAAO,IAAA,mBAAW,EACd,CAAC,MAAoB,EAAE,UAAoB,EAAE,EAAE,CAC3C,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,CAAC,EAClF,CAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAC5C,CAAC;AACN,CAAC;AAVD,oDAUC"}
@@ -1,6 +1,10 @@
1
- import { useNewsroomContext } from './useNewsroomContext';
2
- export const useLanguages = () => {
3
- const context = useNewsroomContext();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLanguages = void 0;
4
+ const useNewsroomContext_1 = require("./useNewsroomContext");
5
+ const useLanguages = () => {
6
+ const context = (0, useNewsroomContext_1.useNewsroomContext)();
4
7
  return context.languages;
5
8
  };
9
+ exports.useLanguages = useLanguages;
6
10
  //# sourceMappingURL=useLanguages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLanguages.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useLanguages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC7B,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IAErC,OAAO,OAAO,CAAC,SAAS,CAAC;AAC7B,CAAC,CAAC"}
1
+ {"version":3,"file":"useLanguages.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useLanguages.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAEnD,MAAM,YAAY,GAAG,GAAG,EAAE;IAC7B,MAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,SAAS,CAAC;AAC7B,CAAC,CAAC;AAJW,QAAA,YAAY,gBAIvB"}
@@ -1,6 +1,10 @@
1
- import { useNewsroomContext } from './useNewsroomContext';
2
- export const useNewsroom = () => {
3
- const context = useNewsroomContext();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useNewsroom = void 0;
4
+ const useNewsroomContext_1 = require("./useNewsroomContext");
5
+ const useNewsroom = () => {
6
+ const context = (0, useNewsroomContext_1.useNewsroomContext)();
4
7
  return context.newsroom;
5
8
  };
9
+ exports.useNewsroom = useNewsroom;
6
10
  //# sourceMappingURL=useNewsroom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNewsroom.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IAErC,OAAO,OAAO,CAAC,QAAQ,CAAC;AAC5B,CAAC,CAAC"}
1
+ {"version":3,"file":"useNewsroom.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroom.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAEnD,MAAM,WAAW,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,QAAQ,CAAC;AAC5B,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB"}
@@ -1,12 +1,16 @@
1
- import { useContext } from 'react';
2
- import { NewsroomContext } from '../context';
3
- export const useNewsroomContext = () => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useNewsroomContext = void 0;
4
+ const react_1 = require("react");
5
+ const context_1 = require("../context");
6
+ const useNewsroomContext = () => {
4
7
  // TS Compiler is having a hard time figuring this type implicitly, so we have to set it explicitly
5
8
  // See https://github.com/microsoft/TypeScript/issues/5711#issuecomment-340283439
6
- const newsroomContext = useContext(NewsroomContext);
9
+ const newsroomContext = (0, react_1.useContext)(context_1.NewsroomContext);
7
10
  if (!newsroomContext) {
8
11
  throw new Error('No `NewsroomContextProvider` found when calling `useNewsroomContext`');
9
12
  }
10
13
  return newsroomContext;
11
14
  };
15
+ exports.useNewsroomContext = useNewsroomContext;
12
16
  //# sourceMappingURL=useNewsroomContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNewsroomContext.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroomContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAoB,eAAe,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACnC,mGAAmG;IACnG,iFAAiF;IACjF,MAAM,eAAe,GAAiC,UAAU,CAAC,eAAe,CAAC,CAAC;IAClF,IAAI,CAAC,eAAe,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;KAC3F;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAC"}
1
+ {"version":3,"file":"useNewsroomContext.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useNewsroomContext.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC,wCAA+D;AAExD,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACnC,mGAAmG;IACnG,iFAAiF;IACjF,MAAM,eAAe,GAAiC,IAAA,kBAAU,EAAC,yBAAe,CAAC,CAAC;IAClF,IAAI,CAAC,eAAe,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;KAC3F;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
@@ -1,6 +1,10 @@
1
- import { useNewsroomContext } from './useNewsroomContext';
2
- export const useSelectedCategory = () => {
3
- const context = useNewsroomContext();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSelectedCategory = void 0;
4
+ const useNewsroomContext_1 = require("./useNewsroomContext");
5
+ const useSelectedCategory = () => {
6
+ const context = (0, useNewsroomContext_1.useNewsroomContext)();
4
7
  return context.selectedCategory;
5
8
  };
9
+ exports.useSelectedCategory = useSelectedCategory;
6
10
  //# sourceMappingURL=useSelectedCategory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSelectedCategory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSelectedCategory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACpC,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IAErC,OAAO,OAAO,CAAC,gBAAgB,CAAC;AACpC,CAAC,CAAC"}
1
+ {"version":3,"file":"useSelectedCategory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSelectedCategory.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAEnD,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACpC,MAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,gBAAgB,CAAC;AACpC,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B"}
@@ -1,6 +1,10 @@
1
- import { useNewsroomContext } from './useNewsroomContext';
2
- export const useSelectedStory = () => {
3
- const context = useNewsroomContext();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSelectedStory = void 0;
4
+ const useNewsroomContext_1 = require("./useNewsroomContext");
5
+ const useSelectedStory = () => {
6
+ const context = (0, useNewsroomContext_1.useNewsroomContext)();
4
7
  return context.selectedStory;
5
8
  };
9
+ exports.useSelectedStory = useSelectedStory;
6
10
  //# sourceMappingURL=useSelectedStory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSelectedStory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSelectedStory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACjC,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IAErC,OAAO,OAAO,CAAC,aAAa,CAAC;AACjC,CAAC,CAAC"}
1
+ {"version":3,"file":"useSelectedStory.js","sourceRoot":"","sources":["../../../src/newsroom-context/hooks/useSelectedStory.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAEnD,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACjC,MAAM,OAAO,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAErC,OAAO,OAAO,CAAC,aAAa,CAAC;AACjC,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B"}
@@ -1,3 +1,18 @@
1
- export { NewsroomContext, NewsroomContextProvider } from './context';
2
- export * from './hooks';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.NewsroomContextProvider = exports.NewsroomContext = void 0;
14
+ var context_1 = require("./context");
15
+ Object.defineProperty(exports, "NewsroomContext", { enumerable: true, get: function () { return context_1.NewsroomContext; } });
16
+ Object.defineProperty(exports, "NewsroomContextProvider", { enumerable: true, get: function () { return context_1.NewsroomContextProvider; } });
17
+ __exportStar(require("./hooks"), exports);
3
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/newsroom-context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACrE,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/newsroom-context/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAqE;AAA5D,0GAAA,eAAe,OAAA;AAAE,kHAAA,uBAAuB,OAAA;AACjD,0CAAwB"}
package/build/types.js CHANGED
@@ -1,2 +1,3 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@prezly/theme-kit-nextjs",
3
- "version": "1.0.3",
3
+ "version": "1.1.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",
7
- "type": "module",
8
7
  "files": [
9
8
  "build",
10
9
  "src"
package/src/intl/index.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './lang';
2
2
  export * from './locale';
3
- export { default as localeConfig } from './localeConfig.cjs';
3
+ export { default as localeConfig } from './localeConfig';
4
4
  export * from './localeObject';
@@ -1,5 +1,4 @@
1
1
  // This list is pulled from the main Prezly application. The underscores are replaced with dashes.
2
- // The files is in CommonJS format in order to allow requiring it `next.config.js`
3
2
  const supportedLocales = [
4
3
  'af-ZA',
5
4
  'ar',
@@ -1,4 +1,4 @@
1
- import localeConfig from './localeConfig.cjs';
1
+ import localeConfig from './localeConfig';
2
2
 
3
3
  export class LocaleObject {
4
4
  /**
@@ -1 +0,0 @@
1
- {"version":3,"file":"localeConfig.cjs","sourceRoot":"","sources":["../../src/intl/localeConfig.cjs"],"names":[],"mappings":";AAAA,kGAAkG;AAClG,kFAAkF;AAClF,MAAM,gBAAgB,GAAG;IACrB,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,KAAK;IACL,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;CACV,CAAC;AAEF,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAEtE,kGAAkG;AAClG,MAAM,0BAA0B,GAAG,KAAK,CAAC,IAAI,CACzC,IAAI,GAAG,CAAC;IACJ,GAAG,gBAAgB;IACnB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;CACxE,CAAC,CACL,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,CAAC,OAAO,GAAG,0BAA0B,CAAC"}