@salesforcedevs/dx-components 1.14.7-alpha5 → 1.14.7-alpha6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.14.7-alpha5",
3
+ "version": "1.14.7-alpha6",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -1,5 +1,9 @@
1
1
  import get from "lodash.get";
2
- import { WordpressPodcastEpisode, WordpressBlogPost } from "typings/custom";
2
+ import {
3
+ WordpressPodcastEpisode,
4
+ WordpressBlogPost,
5
+ WordpressSingleBlogPostResponse
6
+ } from "typings/custom";
3
7
 
4
8
  export const toJson = (value: string | object | null) =>
5
9
  typeof value === "string" ? JSON.parse(value) : value;
@@ -65,6 +69,24 @@ export const normalizePost = ({
65
69
  title
66
70
  });
67
71
 
72
+ export const normalizeSinglePostResponse = ({
73
+ id,
74
+ authors = [],
75
+ date,
76
+ link,
77
+ featured_image,
78
+ yoast_head_json
79
+ }: WordpressSingleBlogPostResponse) => ({
80
+ body: yoast_head_json?.description,
81
+ datetime: date,
82
+ href: link,
83
+ authors: authors,
84
+ imgAlt: "Blogpost image",
85
+ imgSrc: featured_image,
86
+ id,
87
+ title: yoast_head_json?.title
88
+ });
89
+
68
90
  export const normalizeBoolean = (
69
91
  value: string | boolean | number | undefined
70
92
  ): boolean => (typeof value === "string" ? value === "true" : !!value);