@prismicio/types-internal 2.2.0-alpha.20 → 2.2.0-alpha.21

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.
@@ -16,12 +16,19 @@ exports.textBlockConverter = textBlockConverter;
16
16
  function spansConverter(spans, assets) {
17
17
  return spans.map(span => {
18
18
  var _a;
19
+ if (span.type === 'hyperlink') {
20
+ const { __TYPE__, ...data } = ((_a = (0, Link_1.linkConverter)(span.data, assets)) === null || _a === void 0 ? void 0 : _a.value) || {};
21
+ return {
22
+ type: span.type,
23
+ start: span.start,
24
+ end: span.end,
25
+ data: data
26
+ };
27
+ }
19
28
  return {
20
29
  type: span.type,
21
30
  start: span.start,
22
- end: span.end,
23
- // Text blocks in Content format have for data the Link type and not the whole LinkContent object
24
- ...span.type === "hyperlink" ? { data: (_a = (0, Link_1.linkConverter)(span.data, assets)) === null || _a === void 0 ? void 0 : _a.value } : {}
31
+ end: span.end
25
32
  };
26
33
  });
27
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/types-internal",
3
- "version": "2.2.0-alpha.20",
3
+ "version": "2.2.0-alpha.21",
4
4
  "description": "Prismic types for Custom Types and Prismic Data",
5
5
  "keywords": [
6
6
  "typescript",
@@ -16,12 +16,20 @@ export function textBlockConverter(block: ImportTextBlock, assets: Record<Asset[
16
16
 
17
17
  function spansConverter(spans: NonNullable<ImportTextBlock['spans']>, assets: Record<Asset["id"], Asset | undefined>): TextBlock['content']['spans'] {
18
18
  return spans.map(span => {
19
+ if (span.type === 'hyperlink') {
20
+ const { __TYPE__, ...data } = linkConverter(span.data, assets)?.value || {}
21
+ return {
22
+ type: span.type,
23
+ start: span.start,
24
+ end: span.end,
25
+ data: data
26
+ }
27
+ }
28
+
19
29
  return {
20
30
  type: span.type,
21
31
  start: span.start,
22
- end: span.end,
23
- // Text blocks in Content format have for data the Link type and not the whole LinkContent object
24
- ...span.type === "hyperlink" ? { data: linkConverter(span.data, assets)?.value } : {}
32
+ end: span.end
25
33
  }
26
34
  })
27
35
  }