@salesforcedevs/dx-components 1.3.222-alpha10 → 1.3.222-alpha12

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.3.222-alpha10",
3
+ "version": "1.3.222-alpha12",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <dx-section class="section-reduced-padding">
3
- <dx-spinner if:true={recommendationsLoaded}>
3
+ <dx-spinner if:false={recommendationsLoaded}>
4
4
  <div class="spinner-container">
5
5
  <dx-spinner size="large" variant="brand"></dx-spinner>
6
6
  </div>
@@ -4,7 +4,12 @@ import { LightningElement, api } from "lwc";
4
4
  export default class CoveoRecommendations extends LightningElement {
5
5
  @api coveoAuthToken!: string;
6
6
 
7
- recommendations = [];
7
+ _recommendations = [] as any[];
8
+
9
+ private get recommendations(): any[] {
10
+ return this._recommendations || [];
11
+ }
12
+
8
13
  recommendationsLoaded = false;
9
14
 
10
15
  connectedCallback() {
@@ -33,14 +38,13 @@ export default class CoveoRecommendations extends LightningElement {
33
38
  })
34
39
  }).then(async (response) => {
35
40
  const recommendations = (await response.json()).results;
36
- const blogPosts = recommendations.slice(0, 3).map(async (rec) => {
41
+ recommendations.slice(0, 3).forEach(async (rec: any) => {
37
42
  const slug = rec.uri.split("/").pop();
38
43
  const blogDataUrl = `https://developer.salesforce.com/blogs/wp-json/wp/v2/posts?slug=${slug}&state=publish&_embed=wp:featuredmedia`;
39
44
  const blogData = (await (await fetch(blogDataUrl)).json())[0];
40
45
  console.log(blogData);
41
- return blogData;
46
+ this._recommendations.push(blogData);
42
47
  });
43
- this.recommendations = blogPosts;
44
48
  this.recommendationsLoaded = true;
45
49
  });
46
50
  }