@salesforcedevs/dw-components 1.28.1-banner-3 → 1.28.2-action-link

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,30 +1,30 @@
1
1
  {
2
- "name": "@salesforcedevs/dw-components",
3
- "version": "1.28.1-banner-3",
4
- "description": "Lightning web components for https://developer.salesforce.com",
5
- "license": "MIT",
6
- "engines": {
7
- "node": "20.x"
8
- },
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "dependencies": {
13
- "@types/youtube-player": "5.5.11",
14
- "classnames": "2.5.1",
15
- "lodash.clonedeep": "4.5.0",
16
- "lodash.orderby": "4.6.0",
17
- "lodash.uniqby": "4.7.0",
18
- "query-string": "7.1.3",
19
- "youtube-player": "5.6.0"
20
- },
21
- "devDependencies": {
22
- "@types/classnames": "2.3.1",
23
- "@types/lodash.clonedeep": "4.5.9",
24
- "@types/lodash.orderby": "4.6.9",
25
- "@types/lodash.uniqby": "4.7.9",
26
- "@types/setimmediate": "1.0.4",
27
- "setimmediate": "1.0.5"
28
- },
29
- "gitHead": "26a6b8de7d0fde3193ad24c909921175c8ab0e1e"
30
- }
2
+ "name": "@salesforcedevs/dw-components",
3
+ "version": "1.28.2-action-link",
4
+ "description": "Lightning web components for https://developer.salesforce.com",
5
+ "license": "MIT",
6
+ "engines": {
7
+ "node": "22.x"
8
+ },
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "dependencies": {
13
+ "@types/youtube-player": "5.5.11",
14
+ "classnames": "2.5.1",
15
+ "lodash.clonedeep": "4.5.0",
16
+ "lodash.orderby": "4.6.0",
17
+ "lodash.uniqby": "4.7.0",
18
+ "query-string": "7.1.3",
19
+ "youtube-player": "5.6.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/classnames": "2.3.1",
23
+ "@types/lodash.clonedeep": "4.5.9",
24
+ "@types/lodash.orderby": "4.6.9",
25
+ "@types/lodash.uniqby": "4.7.9",
26
+ "@types/setimmediate": "1.0.4",
27
+ "setimmediate": "1.0.5"
28
+ },
29
+ "stableVersion": "1.28.2"
30
+ }
@@ -32,6 +32,7 @@
32
32
  {featuredCodeSample.ctaOne.text}
33
33
  </dx-button>
34
34
  <dx-button
35
+ lwc:if={featuredCodeSample.ctaTwo}
35
36
  target={target}
36
37
  variant="secondary"
37
38
  size="large"
@@ -84,6 +85,7 @@
84
85
  {item.ctaOne.text}
85
86
  </dx-button>
86
87
  <dx-button
88
+ lwc:if={item.ctaTwo}
87
89
  target={target}
88
90
  variant="secondary"
89
91
  size="large"
@@ -1,6 +1,6 @@
1
1
  import { api, LightningElement } from "lwc";
2
2
  import { normalizeBoolean, toJson } from "dxUtils/normalizers";
3
- import { DocsTile, DropdownItem, Language } from "typings/custom";
3
+ import { DocsLink, 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,6 +16,7 @@ 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";
19
20
 
20
21
  type Filter = {
21
22
  label: string;
@@ -29,6 +30,12 @@ type SearchParams = {
29
30
  page?: any;
30
31
  };
31
32
 
33
+ function isDocsContentType(project: any): boolean {
34
+ return !!project.contentTypes?.some(
35
+ (contentType: DocsLink) => contentType.contentType === DOCS_CONTENT_TYPE
36
+ );
37
+ }
38
+
32
39
  export default class DocsGrid extends LightningElement {
33
40
  searchTerm = "";
34
41
  selectedProductFilters: string[] | null = null;
@@ -49,6 +56,7 @@ export default class DocsGrid extends LightningElement {
49
56
  private _apiDocs?: any[] = [];
50
57
  private _languageList?: any[] = [];
51
58
  private _productFiltersList?: any[] = [];
59
+ private _availableServices: any[] = [];
52
60
  private matchDesktop!: MediaQueryList;
53
61
  private matchMobile!: MediaQueryList;
54
62
  private matchMobileSmall!: MediaQueryList;
@@ -140,7 +148,39 @@ export default class DocsGrid extends LightningElement {
140
148
  }
141
149
 
142
150
  set otherDocs(value: any) {
151
+ this.applyOtherDocs(value);
152
+ }
153
+
154
+ private applyOtherDocs(value: any): void {
155
+ const previousFilterValues = this.productFiltersList.map(
156
+ (filter) => filter.value
157
+ );
158
+ const previouslySelected = this.selectedProductFilters || [];
159
+ const previouslySelectedSet = new Set(previouslySelected);
160
+ const hadAllFiltersSelected =
161
+ !!previousFilterValues.length &&
162
+ previousFilterValues.every((filterValue) =>
163
+ previouslySelectedSet.has(filterValue)
164
+ );
165
+
143
166
  this._otherDocs = this.transformOtherDocs(value);
167
+
168
+ // Rebuild product filters after other docs updates so SSG and
169
+ // non-SSG flows use the same setter-based filter refresh path.
170
+ if (this._availableServices.length) {
171
+ this.productFiltersList = this._availableServices;
172
+
173
+ if (hadAllFiltersSelected) {
174
+ this.selectedProductFilters = this.productFiltersList.map(
175
+ (filter) => filter.value
176
+ );
177
+ }
178
+ }
179
+
180
+ // Recompute visible cards/counts once transformed other docs are merged.
181
+ if (this.dataRetrieved) {
182
+ this.calculatePagination(this.page.toString(), true);
183
+ }
144
184
  }
145
185
 
146
186
  private transformOtherDocs(value: any): any[] {
@@ -150,12 +190,15 @@ export default class DocsGrid extends LightningElement {
150
190
  for (const docs of allDocs) {
151
191
  for (const project of docs.projects) {
152
192
  const firstLink = project.contentTypes[0].href;
193
+ const links = isDocsContentType(project)
194
+ ? []
195
+ : project.contentTypes;
153
196
 
154
197
  transformed.push({
155
198
  id: project.id,
156
199
  title: project.title,
157
200
  description: project.description,
158
- links: project.contentTypes,
201
+ links,
159
202
  service: project.meta.brand,
160
203
  guidesHref: firstLink,
161
204
  locale: docs.locale || "en-us"
@@ -177,16 +220,16 @@ export default class DocsGrid extends LightningElement {
177
220
 
178
221
  if (response.ok) {
179
222
  const data = await response.json();
180
- this._otherDocs = this.transformOtherDocs(data);
223
+ this.applyOtherDocs(data);
181
224
  } else {
182
225
  console.error(
183
226
  `Failed to fetch sitemetadata: ${response.status}`
184
227
  );
185
- this._otherDocs = [];
228
+ this.applyOtherDocs([]);
186
229
  }
187
230
  } catch (error) {
188
231
  console.error("Error fetching sitemetadata:", error);
189
- this._otherDocs = [];
232
+ this.applyOtherDocs([]);
190
233
  } finally {
191
234
  this._isFetchingOtherDocs = false;
192
235
  }
@@ -393,7 +436,8 @@ export default class DocsGrid extends LightningElement {
393
436
  }
394
437
 
395
438
  if (json.available_services) {
396
- this.productFiltersList = json.available_services;
439
+ this._availableServices = json.available_services;
440
+ this.productFiltersList = this._availableServices;
397
441
 
398
442
  if (!this.selectedProductFilters!.length) {
399
443
  this.selectedProductFilters =
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.