@cntrl-site/sdk-nextjs 0.21.4 → 0.21.7

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.
@@ -35,7 +35,8 @@ const itemsMap = {
35
35
  [sdk_1.ArticleItemType.RichText]: RichTextItem_1.RichTextItem,
36
36
  [sdk_1.ArticleItemType.YoutubeEmbed]: YoutubeEmbed_1.YoutubeEmbedItem,
37
37
  [sdk_1.ArticleItemType.VimeoEmbed]: VimeoEmbed_1.VimeoEmbedItem,
38
- [sdk_1.ArticleItemType.Custom]: CustomItem_1.CustomItem
38
+ [sdk_1.ArticleItemType.Custom]: CustomItem_1.CustomItem,
39
+ [sdk_1.ArticleItemType.Group]: () => null
39
40
  };
40
41
  const RichTextWrapper = ({ isRichText, children }) => {
41
42
  if (!isRichText)
@@ -168,6 +168,7 @@ class RichTextConverter {
168
168
  return styleGroups;
169
169
  }
170
170
  groupEntities(entitiesList, styleGroups) {
171
+ var _a, _b, _c, _d;
171
172
  const entitiesGroups = [];
172
173
  // some entities may have no data, need to filter them out (case with deleting a section/page that was linked to)
173
174
  const entities = entitiesList.filter(e => e.hasOwnProperty('data'));
@@ -185,7 +186,7 @@ class RichTextConverter {
185
186
  const end = dividers[i + 1];
186
187
  const entity = entities.find(e => e.start === start);
187
188
  entitiesGroups.push(Object.assign({ stylesGroup: [], start,
188
- end }, (entity && { link: entity.data.url, target: entity.data.target })));
189
+ end }, (entity && { link: (_b = (_a = entity.data) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : '', target: (_d = (_c = entity.data) === null || _c === void 0 ? void 0 : _c.target) !== null && _d !== void 0 ? _d : '_self' })));
189
190
  }
190
191
  return entitiesGroups;
191
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "0.21.4",
3
+ "version": "0.21.7",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@cntrl-site/color": "^1.0.0",
25
25
  "@cntrl-site/effects": "^1.0.5-1",
26
- "@cntrl-site/sdk": "^1.4.2",
26
+ "@cntrl-site/sdk": "^1.5.5",
27
27
  "@types/vimeo__player": "^2.18.0",
28
28
  "@vimeo/player": "^2.20.1",
29
29
  "html-react-parser": "^3.0.1",
@@ -45,7 +45,8 @@ const itemsMap: Record<ArticleItemType, ComponentType<ItemProps<any>>> = {
45
45
  [ArticleItemType.RichText]: RichTextItem,
46
46
  [ArticleItemType.YoutubeEmbed]: YoutubeEmbedItem,
47
47
  [ArticleItemType.VimeoEmbed]: VimeoEmbedItem,
48
- [ArticleItemType.Custom]: CustomItem
48
+ [ArticleItemType.Custom]: CustomItem,
49
+ [ArticleItemType.Group]: () => null
49
50
  };
50
51
 
51
52
  interface RTWrapperProps {
@@ -219,7 +219,7 @@ export class RichTextConverter {
219
219
  stylesGroup: [],
220
220
  start,
221
221
  end,
222
- ...(entity && { link: entity.data.url, target: entity.data.target })
222
+ ...(entity && { link: entity.data?.url ?? '', target: entity.data?.target ?? '_self' })
223
223
  });
224
224
  }
225
225
  return entitiesGroups;
Binary file