@salesforcedevs/dx-components 1.3.221 → 1.3.222-alpha2

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/lwc.config.json CHANGED
@@ -33,6 +33,7 @@
33
33
  "dx/checkboxGroup",
34
34
  "dx/checkboxNative",
35
35
  "dx/codeBlock",
36
+ "dx/coveoRecommendations",
36
37
  "dx/dropdown",
37
38
  "dx/emptyState",
38
39
  "dx/faq",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.221",
3
+ "version": "1.3.222-alpha2",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -43,6 +43,5 @@
43
43
  },
44
44
  "volta": {
45
45
  "node": "16.19.1"
46
- },
47
- "gitHead": "eca6f0494621686d4b7c408a316e8b230b09b6dc"
46
+ }
48
47
  }
@@ -0,0 +1,4 @@
1
+ .spinner-container {
2
+ position: relative;
3
+ margin-top: 85px;
4
+ }
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <dx-section class="section-reduced-padding">
3
+ <dx-spinner>
4
+ <div class="spinner-container">
5
+ <dx-spinner size="large" variant="brand"></dx-spinner>
6
+ </div>
7
+ </dx-spinner>
8
+ <template for:each={recommendations} for:item="recommendation">
9
+ <dx-card-blog-post
10
+ authors={recommendation.yoast_head_json.author}
11
+ body={recommendation.yoast_head_json.description}
12
+ datetime={recommendation.yoast_head_json.article_published_time}
13
+ href={recommendation.yoast_head_json.canonical}
14
+ img-alt={recommendation.yoast_head_json.title}
15
+ img-src={recommendation.content.featured_image}
16
+ title={recommendation.yoast_head_json.title}
17
+ ></dx-card-blog-post>
18
+ </template>
19
+ </dx-section>
20
+ </template>
@@ -0,0 +1,49 @@
1
+ import { track } from "dxUtils/analytics";
2
+ import { LightningElement, api } from "lwc";
3
+
4
+ export default class CoveoRecommendations extends LightningElement {
5
+ @api coveoAuthToken!: string;
6
+
7
+ recommendations = [];
8
+
9
+ renderedCallback() {
10
+ // const actionsHistory = localStorage.getItem(
11
+ // "__coveo.analytics.history"
12
+ // );
13
+ const url = "https://platform.cloud.coveo.com/rest/search/v2";
14
+ fetch(url, {
15
+ headers: { Authorization: `Bearer ${this.coveoAuthToken}` },
16
+ body: JSON.stringify({
17
+ pipeline: "Recommendations_Developer_Blogs",
18
+ searchHub: "developerWebsiteBlogs",
19
+ numberOfResults: 3,
20
+ actionsHistory: [
21
+ {
22
+ name: "PageView",
23
+ value: "https://developer.salesforce.com/blogs/2024/02/the-developers-guide-to-trailblazerdx-2024",
24
+ time: "2024-02-20T19:47:51.910Z",
25
+ internalTime: 1708458471910
26
+ }
27
+ ]
28
+ })
29
+ }).then(async (response) => {
30
+ const recommendations = (await response.json()).results;
31
+ console.log(recommendations);
32
+ this.recommendations = recommendations;
33
+ const blogPosts = recommendations.slice(0, 3).map(async (rec) => {
34
+ const slug = rec.uri.split("/").pop();
35
+ const blogDataUrl = `${window.location.origin}/blogs/wp-json/wp/v2/posts?slug=${slug}&state=publish&_embed=wp:featuredmedia`;
36
+ const blogData = (await (await fetch(blogDataUrl)).json())[0];
37
+ console.log(blogData);
38
+ return blogData;
39
+ });
40
+ this.recommendations = blogPosts;
41
+ });
42
+ }
43
+
44
+ private trackClick(e: Event) {
45
+ const payload = {};
46
+
47
+ track(e.currentTarget!, "custEv_blogAudioPlay", payload);
48
+ }
49
+ }
@@ -274,18 +274,15 @@ li.coveo-dynamic-facet-breadcrumb-value-list-item {
274
274
  }
275
275
 
276
276
  .dx-result-title {
277
+ /* override the default Coveo style */
278
+ color: var(--dx-g-blue-vibrant-20) !important;
279
+ display: block;
277
280
  font-family: var(--dx-g-font-display);
278
281
  font-size: var(--dx-g-text-lg);
279
282
  margin: 0;
280
283
  margin-bottom: var(--dx-g-spacing-sm);
281
284
  }
282
285
 
283
- .CoveoResultLink,
284
- a.CoveoResultLink,
285
- .CoveoResult a.CoveoResultLink {
286
- color: var(--dx-g-blue-vibrant-20);
287
- }
288
-
289
286
  .dx-result-excerpt {
290
287
  color: var(--dx-g-gray-10);
291
288
  font-size: 14px;
@@ -57,12 +57,15 @@ const resultsTemplatesInnerHtml = `
57
57
  <% } %>
58
58
  <% } %>
59
59
  </div>
60
- <p class="dx-result-title">
61
- <span
62
- class="CoveoResultLink"
63
- data-field="@uri"
64
- ></span>
65
- </p>
60
+ <a
61
+ href="<%= raw.uri %>"
62
+ class="dx-result-title"
63
+ >
64
+ <%= title %>
65
+ <% if (!raw.uri.includes('developer.salesforce.com') && !raw.uri.includes('developer-website-s.herokuapp.com')) { %>
66
+ <svg xmlns="http://www.w3.org/2000/svg" style="display: inline; vertical-align: baseline;" fill="var(--dx-g-blue-vibrant-20)" width="20" height="20" part="svg" aria-hidden="true"><use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#new_window"></use></svg>
67
+ <% } %>
68
+ </a>
66
69
  <p class="dx-result-excerpt CoveoExcerpt"></p>
67
70
  </div>
68
71
  </script>
@@ -84,9 +87,19 @@ const resultsTemplatesInnerHtml = `
84
87
  <% } %>
85
88
  <% } %>
86
89
  </div>
87
- <p class="dx-result-title">
88
- <a class="CoveoResultLink"></a>
89
- </p>
90
+ <a
91
+ href="<%= raw.uri %>"
92
+ class="dx-result-title"
93
+ >
94
+ <% if (title) { %>
95
+ <%= title %>
96
+ <% } else { %>
97
+ <%= uri %>
98
+ <% } %>
99
+ <% if (!raw.uri.includes('developer.salesforce.com') && !raw.uri.includes('developer-website-s.herokuapp.com')) { %>
100
+ <svg xmlns="http://www.w3.org/2000/svg" style="display: inline; vertical-align: baseline;" fill="var(--dx-g-blue-vibrant-20)" width="20" height="20" part="svg" aria-hidden="true"><use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#new_window"></use></svg>
101
+ <% } %>
102
+ </a>
90
103
  <p class="dx-result-excerpt CoveoExcerpt"></p>
91
104
  </div>
92
105
  </script>
package/LICENSE DELETED
@@ -1,12 +0,0 @@
1
- Copyright (c) 2020, Salesforce.com, Inc.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
-
8
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
-
10
- * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.