@salesforcedevs/dw-components 1.28.2-action-link → 1.28.2-action-link-2

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.28.2-action-link",
3
+ "version": "1.28.2-action-link-2",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -40,37 +40,27 @@
40
40
  ></dx-input>
41
41
  </div>
42
42
  <dx-grid columns={tileColumns} if:false={showEmptyState}>
43
- <dx-card-docs
44
- for:each={currentPageDocs}
45
- for:item="item"
46
- for:index="i"
47
- key={item.id}
48
- header={item.title}
49
- body={item.description}
50
- href={item.guidesHref}
51
- class="docs-card"
52
- target={item.target}
53
- >
54
- <dx-button
55
- variant="inline"
43
+ <template for:each={currentPageDocs} for:item="item" for:index="i">
44
+ <dx-card-docs
45
+ lwc:if={item.isDita}
46
+ key={item.id}
47
+ header={item.title}
48
+ body={item.description}
56
49
  href={item.guidesHref}
57
- onclick={handleReadItClick}
58
- if:false={item.links}
59
- >
60
- Read It
61
- </dx-button>
62
- <template if:true={item.links}>
63
- <dx-button
64
- for:each={item.links}
65
- for:item="link"
66
- key={link.id}
67
- href={link.href}
68
- variant="inline"
69
- >
70
- { link.title }
71
- </dx-button>
72
- </template>
73
- </dx-card-docs>
50
+ class="docs-card"
51
+ target={item.target}
52
+ onclick={handleDitaCardClick}
53
+ ></dx-card-docs>
54
+ <dx-card-docs
55
+ lwc:else
56
+ key={item.id}
57
+ header={item.title}
58
+ body={item.description}
59
+ href={item.guidesHref}
60
+ class="docs-card"
61
+ target={item.target}
62
+ ></dx-card-docs>
63
+ </template>
74
64
  </dx-grid>
75
65
  <div class="pagination-container" if:false={showEmptyState}>
76
66
  <dx-pagination
@@ -1,6 +1,6 @@
1
1
  import { api, LightningElement } from "lwc";
2
2
  import { normalizeBoolean, toJson } from "dxUtils/normalizers";
3
- import { DocsLink, DocsTile, DropdownItem, Language } from "typings/custom";
3
+ import { DocsTile, DropdownItem, Language } from "typings/custom";
4
4
  import qs from "query-string";
5
5
  import uniqBy from "lodash.uniqby";
6
6
  import orderBy from "lodash.orderby";
@@ -16,7 +16,6 @@ const DSC_API_URL = {
16
16
  const PRODUCT_FILTER_ALL_SERVICES = "all services";
17
17
  const LANGUAGE_FILTER_LABEL = "Language";
18
18
  const WAIT_TIME = 500;
19
- const DOCS_CONTENT_TYPE = "docs";
20
19
 
21
20
  type Filter = {
22
21
  label: string;
@@ -30,12 +29,6 @@ type SearchParams = {
30
29
  page?: any;
31
30
  };
32
31
 
33
- function isDocsContentType(project: any): boolean {
34
- return !!project.contentTypes?.some(
35
- (contentType: DocsLink) => contentType.contentType === DOCS_CONTENT_TYPE
36
- );
37
- }
38
-
39
32
  export default class DocsGrid extends LightningElement {
40
33
  searchTerm = "";
41
34
  selectedProductFilters: string[] | null = null;
@@ -189,18 +182,12 @@ export default class DocsGrid extends LightningElement {
189
182
 
190
183
  for (const docs of allDocs) {
191
184
  for (const project of docs.projects) {
192
- const firstLink = project.contentTypes[0].href;
193
- const links = isDocsContentType(project)
194
- ? []
195
- : project.contentTypes;
196
-
197
185
  transformed.push({
198
186
  id: project.id,
199
187
  title: project.title,
200
188
  description: project.description,
201
- links,
202
189
  service: project.meta.brand,
203
- guidesHref: firstLink,
190
+ guidesHref: project.contentTypes[0].href,
204
191
  locale: docs.locale || "en-us"
205
192
  });
206
193
  }
@@ -479,7 +466,8 @@ export default class DocsGrid extends LightningElement {
479
466
  "/" +
480
467
  content.value.default_topic
481
468
  : "",
482
- service: content.value.service
469
+ service: content.value.service,
470
+ isDita: true
483
471
  });
484
472
  }
485
473
  }
@@ -706,7 +694,7 @@ export default class DocsGrid extends LightningElement {
706
694
  }
707
695
  };
708
696
 
709
- handleReadItClick(e: any) {
697
+ handleDitaCardClick(e: any) {
710
698
  this.filteredItemsSelected = true;
711
699
  this.selectedProductFilters?.forEach((filter) => {
712
700
  track(document, "custEv_filterApplied", {