@prezly/theme-kit-nextjs 9.6.0 → 9.6.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.
@@ -17,7 +17,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
17
17
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
18
18
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
19
19
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
20
- function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
20
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } /* eslint-disable @typescript-eslint/no-use-before-define */
21
21
  function generateMediaGalleryPageMetadata(_x) {
22
22
  return _generateMediaGalleryPageMetadata.apply(this, arguments);
23
23
  }
@@ -34,19 +34,7 @@ function _generateMediaGalleryPageMetadata() {
34
34
  var [_generateUrl, gallery] = yield _themeKitCore.AsyncResolvable.resolve(resolvableUrlGenerator, resolveGallery);
35
35
  var dictionary = yield (0, _themeKitIntl.importDictionary)(locale);
36
36
  var title = "".concat((0, _themeKitIntl.formatMessageString)(locale, _themeKitIntl.translations.mediaGallery.titleSingular, dictionary), ": ").concat(gallery.name);
37
- var {
38
- description
39
- } = gallery;
40
- if (gallery.type === _sdk.NewsroomGallery.Type.IMAGE) {
41
- description = "".concat((0, _themeKitIntl.formatMessageString)(locale, _themeKitIntl.translations.mediaGallery.imagesCount, dictionary, {
42
- imagesCount: gallery.images_number
43
- }), " - ").concat(gallery.description);
44
- }
45
- if (gallery.type === _sdk.NewsroomGallery.Type.VIDEO) {
46
- description = "".concat((0, _themeKitIntl.formatMessageString)(locale, _themeKitIntl.translations.mediaGallery.videosCount, dictionary, {
47
- videosCount: gallery.videos_number
48
- }), " - ").concat(gallery.description);
49
- }
37
+ var description = generateDescription(locale, dictionary, gallery);
50
38
  var thumbnail = _themeKitCore.Galleries.getCoverImage(gallery);
51
39
  var imageUrl = thumbnail ? _themeKitCore.Uploads.getCdnUrl(thumbnail.uuid) : undefined;
52
40
  for (var _len = arguments.length, metadata = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -62,4 +50,21 @@ function _generateMediaGalleryPageMetadata() {
62
50
  }), ...metadata);
63
51
  });
64
52
  return _generateMediaGalleryPageMetadata.apply(this, arguments);
53
+ }
54
+ function generateDescription(locale, dictionary, gallery) {
55
+ var _gallery$description$, _gallery$description;
56
+ var description = (_gallery$description$ = (_gallery$description = gallery.description) === null || _gallery$description === void 0 ? void 0 : _gallery$description.trim()) !== null && _gallery$description$ !== void 0 ? _gallery$description$ : '';
57
+ if (gallery.type === _sdk.NewsroomGallery.Type.IMAGE) {
58
+ var imagesCount = (0, _themeKitIntl.formatMessageString)(locale, _themeKitIntl.translations.mediaGallery.imagesCount, dictionary, {
59
+ imagesCount: gallery.images_number
60
+ });
61
+ return [imagesCount, description].filter(Boolean).join(' - ');
62
+ }
63
+ if (gallery.type === _sdk.NewsroomGallery.Type.VIDEO) {
64
+ var videosCount = (0, _themeKitIntl.formatMessageString)(locale, _themeKitIntl.translations.mediaGallery.videosCount, dictionary, {
65
+ videosCount: gallery.videos_number
66
+ });
67
+ return [videosCount, description].filter(Boolean).join(' - ');
68
+ }
69
+ return description;
65
70
  }
@@ -8,6 +8,7 @@ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i
8
8
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
9
9
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
10
10
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
11
+ /* eslint-disable @typescript-eslint/no-use-before-define */
11
12
  import { NewsroomGallery } from '@prezly/sdk';
12
13
  import { AsyncResolvable, Galleries, Uploads } from '@prezly/theme-kit-core';
13
14
  import { formatMessageString, importDictionary, translations } from '@prezly/theme-kit-intl';
@@ -28,19 +29,7 @@ function _generateMediaGalleryPageMetadata() {
28
29
  var [_generateUrl, gallery] = yield AsyncResolvable.resolve(resolvableUrlGenerator, resolveGallery);
29
30
  var dictionary = yield importDictionary(locale);
30
31
  var title = "".concat(formatMessageString(locale, translations.mediaGallery.titleSingular, dictionary), ": ").concat(gallery.name);
31
- var {
32
- description
33
- } = gallery;
34
- if (gallery.type === NewsroomGallery.Type.IMAGE) {
35
- description = "".concat(formatMessageString(locale, translations.mediaGallery.imagesCount, dictionary, {
36
- imagesCount: gallery.images_number
37
- }), " - ").concat(gallery.description);
38
- }
39
- if (gallery.type === NewsroomGallery.Type.VIDEO) {
40
- description = "".concat(formatMessageString(locale, translations.mediaGallery.videosCount, dictionary, {
41
- videosCount: gallery.videos_number
42
- }), " - ").concat(gallery.description);
43
- }
32
+ var description = generateDescription(locale, dictionary, gallery);
44
33
  var thumbnail = Galleries.getCoverImage(gallery);
45
34
  var imageUrl = thumbnail ? Uploads.getCdnUrl(thumbnail.uuid) : undefined;
46
35
  for (var _len = arguments.length, metadata = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -56,4 +45,21 @@ function _generateMediaGalleryPageMetadata() {
56
45
  }), ...metadata);
57
46
  });
58
47
  return _generateMediaGalleryPageMetadata.apply(this, arguments);
48
+ }
49
+ function generateDescription(locale, dictionary, gallery) {
50
+ var _gallery$description$, _gallery$description;
51
+ var description = (_gallery$description$ = (_gallery$description = gallery.description) === null || _gallery$description === void 0 ? void 0 : _gallery$description.trim()) !== null && _gallery$description$ !== void 0 ? _gallery$description$ : '';
52
+ if (gallery.type === NewsroomGallery.Type.IMAGE) {
53
+ var imagesCount = formatMessageString(locale, translations.mediaGallery.imagesCount, dictionary, {
54
+ imagesCount: gallery.images_number
55
+ });
56
+ return [imagesCount, description].filter(Boolean).join(' - ');
57
+ }
58
+ if (gallery.type === NewsroomGallery.Type.VIDEO) {
59
+ var videosCount = formatMessageString(locale, translations.mediaGallery.videosCount, dictionary, {
60
+ videosCount: gallery.videos_number
61
+ });
62
+ return [videosCount, description].filter(Boolean).join(' - ');
63
+ }
64
+ return description;
59
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/theme-kit-nextjs",
3
- "version": "9.6.0",
3
+ "version": "9.6.1",
4
4
  "description": "Data layer and utility library for developing Prezly themes with NextJS",
5
5
  "type": "module",
6
6
  "main": "build/index.mjs",
@@ -102,11 +102,11 @@
102
102
  "url-pattern": "^1.0.3"
103
103
  },
104
104
  "devDependencies": {
105
- "@sentry/nextjs": "7.116.0"
105
+ "@sentry/nextjs": "7.118.0"
106
106
  },
107
107
  "publishConfig": {
108
108
  "access": "public"
109
109
  },
110
110
  "sideEffects": false,
111
- "gitHead": "762e56a87cc778a2fa691bc219e2881daa2345d5"
111
+ "gitHead": "9b887b8512be616d37b2c17092474774d5f41aba"
112
112
  }