@salesforcedevs/dx-components 1.3.286 → 1.3.288

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.286",
3
+ "version": "1.3.288",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -46,5 +46,5 @@
46
46
  "volta": {
47
47
  "node": "16.19.1"
48
48
  },
49
- "gitHead": "ca4c10296cb4eb249ae281bb9e96b2dbc149094b"
49
+ "gitHead": "8794b0c64fd080947b55f62aee5f28386d75b57e"
50
50
  }
@@ -1,9 +1,5 @@
1
1
  <template>
2
- <dx-hr
3
- lwc:if={showRecommendations}
4
- spacing="2xl"
5
- text="Recommended Articles"
6
- ></dx-hr>
2
+ <dx-hr lwc:if={showRecommendations} spacing="2xl" text={label}></dx-hr>
7
3
 
8
4
  <dx-section lwc:if={showRecommendations} class="section-reduced-padding">
9
5
  <dx-spinner lwc:if={recommendationsLoading}>
@@ -23,6 +23,7 @@ const language_to_locale_map = {
23
23
  export default class CoveoRecommendations extends LightningElement {
24
24
  @api coveoAuthToken!: string;
25
25
  @api coveoOrganizationId!: string;
26
+ @api label? = "Readers Also Viewed";
26
27
  @api postAcf: string = "{}";
27
28
 
28
29
  _recommendations = [] as Recommendation[];
@@ -34,11 +35,15 @@ export default class CoveoRecommendations extends LightningElement {
34
35
  showRecommendations = true;
35
36
  recommendationsLoading = true;
36
37
 
37
- getLocale() {
38
+ getLanguage() {
38
39
  const acf = JSON.parse(this.postAcf);
39
- return language_to_locale_map[
40
+ return (
40
41
  (acf?.language as keyof typeof language_to_locale_map) || "english"
41
- ];
42
+ );
43
+ }
44
+
45
+ getLocale() {
46
+ return language_to_locale_map[this.getLanguage()];
42
47
  }
43
48
 
44
49
  connectedCallback() {
@@ -90,13 +95,18 @@ export default class CoveoRecommendations extends LightningElement {
90
95
  this._recommendations = await Promise.all(
91
96
  blogDataLoadTasks
92
97
  );
93
- if (this._recommendations.length === 0) {
98
+ if (this._recommendations.length !== 3) {
94
99
  this.showRecommendations = false;
95
100
  }
96
101
  } catch (ex) {
97
102
  this.showRecommendations = false;
98
103
  } finally {
99
- this.recommendationsLoading = false;
104
+ if (this.recommendations.length === 3) {
105
+ this.recommendationsLoading = false;
106
+ } else {
107
+ this.recommendationsLoading = false;
108
+ this.showRecommendations = false;
109
+ }
100
110
  }
101
111
  },
102
112
  () => {