@salesforcedevs/dw-components 1.14.7-alpha1 → 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/dw-components",
3
- "version": "1.14.7-alpha1",
3
+ "version": "1.14.7-alpha6",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -3,7 +3,10 @@ import {
3
3
  fetchSingleWordpressPost,
4
4
  fetchWordpressPosts
5
5
  } from "dxUtils/wordpress";
6
- import { normalizePost } from "dxUtils/normalizers";
6
+ import {
7
+ normalizePost,
8
+ normalizeSinglePostResponse
9
+ } from "dxUtils/normalizers";
7
10
 
8
11
  type BlogPost = {
9
12
  body: string;
@@ -55,7 +58,11 @@ export default class CardBlogPostProvider extends LightningElement {
55
58
  }
56
59
 
57
60
  private filterOutFeaturedPost(posts: BlogPost[]) {
58
- return posts.filter((post) => post.id !== this._featuredPost.id);
61
+ // the featured post + the rest must equal count
62
+ const countMinusOne = parseInt(this.count, 10) - 1;
63
+ return posts
64
+ .filter((post) => post.id !== this._featuredPost.id)
65
+ .slice(0, countMinusOne);
59
66
  }
60
67
 
61
68
  private fetchPosts = async () => {
@@ -72,7 +79,7 @@ export default class CardBlogPostProvider extends LightningElement {
72
79
  this.featuredPost = await fetchSingleWordpressPost(
73
80
  "/blogs/wp-json/wp/v2/posts",
74
81
  FEATURED_BLOG_POST_ID,
75
- normalizePost
82
+ normalizeSinglePostResponse
76
83
  );
77
84
  }
78
85
  };