@prismicio/api-renderer
Advanced tools
Comparing version 3.2.4-alpha.11 to 3.2.4-alpha.12
@@ -8,3 +8,3 @@ import type { AnyLinkContent, DocumentLinkContent, ExternalLinkContent, FileLinkContent, ImageLinkContent, MediaLinkContent, SliceContent, WidgetContent } from "@prismicio/types-internal/lib/content"; | ||
renderV2(definition: D, content: C, fetch?: F | undefined): unknown; | ||
renderDefault(definition: D, content?: C): unknown; | ||
renderDefault(definition: D): unknown; | ||
renderMocks(definition: D, content: C): unknown; | ||
@@ -11,0 +11,0 @@ } |
@@ -36,3 +36,8 @@ "use strict"; | ||
} | ||
return brokenLinkV1(link); | ||
return { | ||
type: "Link.document", | ||
value: { | ||
...(link.text && { text: link.text }), | ||
}, | ||
}; | ||
} | ||
@@ -53,3 +58,3 @@ catch (e) { | ||
link_type: "Document", | ||
...brokenLinkV2(link, def), | ||
...(linkText && { text: linkText }), | ||
}; | ||
@@ -56,0 +61,0 @@ } |
@@ -60,13 +60,11 @@ "use strict"; | ||
else { | ||
return this.renderDefault(def, content); | ||
return this.renderDefault(def); | ||
} | ||
}, | ||
renderDefault(def, content) { | ||
var _a, _b; | ||
const linkText = ((_a = def === null || def === void 0 ? void 0 : def.config) === null || _a === void 0 ? void 0 : _a.allowText) && (content === null || content === void 0 ? void 0 : content.value.text) ? { text: content.value.text } : undefined; | ||
switch ((_b = def.config) === null || _b === void 0 ? void 0 : _b.select) { | ||
renderDefault(def) { | ||
var _a; | ||
switch ((_a = def.config) === null || _a === void 0 ? void 0 : _a.select) { | ||
case "media": | ||
return { | ||
link_type: "Media", | ||
...linkText, | ||
}; | ||
@@ -76,3 +74,2 @@ case "document": | ||
link_type: "Document", | ||
...linkText, | ||
}; | ||
@@ -82,3 +79,2 @@ case "web": | ||
link_type: "Web", | ||
...linkText, | ||
}; | ||
@@ -88,3 +84,2 @@ default: | ||
link_type: "Any", | ||
...linkText, | ||
}; | ||
@@ -113,3 +108,3 @@ } | ||
else { | ||
return this.renderDefault(def, content); | ||
return this.renderDefault(def); | ||
} | ||
@@ -116,0 +111,0 @@ }, |
{ | ||
"name": "@prismicio/api-renderer", | ||
"version": "3.2.4-alpha.11", | ||
"version": "3.2.4-alpha.12", | ||
"description": "Prismic renderers for the content API", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -19,3 +19,3 @@ import type { | ||
renderV2(definition: D, content: C, fetch?: F | undefined): unknown | ||
renderDefault(definition: D, content?: C): unknown | ||
renderDefault(definition: D): unknown | ||
renderMocks(definition: D, content: C): unknown | ||
@@ -22,0 +22,0 @@ } |
@@ -45,3 +45,8 @@ import type { DocumentLinkContent } from "@prismicio/types-internal/lib/content" | ||
return brokenLinkV1(link) | ||
return { | ||
type: "Link.document", | ||
value: { | ||
...(link.text && { text: link.text }), | ||
}, | ||
} | ||
} catch (e) { | ||
@@ -65,3 +70,3 @@ return brokenLinkV1(link) | ||
link_type: "Document", | ||
...brokenLinkV2(link, def), | ||
...(linkText && { text: linkText }), | ||
} | ||
@@ -68,0 +73,0 @@ } catch (e) { |
@@ -47,9 +47,7 @@ import type { LinkContent } from "@prismicio/types-internal/lib/content" | ||
} else { | ||
return this.renderDefault(def, content) | ||
return this.renderDefault(def) | ||
} | ||
}, | ||
renderDefault(def: Link, content?: LinkContent): unknown { | ||
const linkText = def?.config?.allowText && content?.value.text ? { text: content.value.text } : undefined | ||
renderDefault(def: Link): unknown { | ||
switch (def.config?.select) { | ||
@@ -59,3 +57,2 @@ case "media": | ||
link_type: "Media", | ||
...linkText, | ||
} | ||
@@ -65,3 +62,2 @@ case "document": | ||
link_type: "Document", | ||
...linkText, | ||
} | ||
@@ -71,3 +67,2 @@ case "web": | ||
link_type: "Web", | ||
...linkText, | ||
} | ||
@@ -77,3 +72,2 @@ default: | ||
link_type: "Any", | ||
...linkText, | ||
} | ||
@@ -97,3 +91,3 @@ } | ||
} else { | ||
return this.renderDefault(def, content) | ||
return this.renderDefault(def) | ||
} | ||
@@ -100,0 +94,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1057522