@salesforcedevs/dw-components 1.28.1-banner-3 → 1.28.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,10 +1,10 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dw-components",
3
- "version": "1.28.1-banner-3",
3
+ "version": "1.28.2",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
7
- "node": "20.x"
7
+ "node": "22.x"
8
8
  },
9
9
  "publishConfig": {
10
10
  "access": "public"
@@ -26,5 +26,5 @@
26
26
  "@types/setimmediate": "1.0.4",
27
27
  "setimmediate": "1.0.5"
28
28
  },
29
- "gitHead": "26a6b8de7d0fde3193ad24c909921175c8ab0e1e"
29
+ "gitHead": "100b05d78eeebe4c0e1d76afdfaa630a0fecd4c9"
30
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"
@@ -49,6 +49,7 @@ export default class DocsGrid extends LightningElement {
49
49
  private _apiDocs?: any[] = [];
50
50
  private _languageList?: any[] = [];
51
51
  private _productFiltersList?: any[] = [];
52
+ private _availableServices: any[] = [];
52
53
  private matchDesktop!: MediaQueryList;
53
54
  private matchMobile!: MediaQueryList;
54
55
  private matchMobileSmall!: MediaQueryList;
@@ -140,7 +141,39 @@ export default class DocsGrid extends LightningElement {
140
141
  }
141
142
 
142
143
  set otherDocs(value: any) {
144
+ this.applyOtherDocs(value);
145
+ }
146
+
147
+ private applyOtherDocs(value: any): void {
148
+ const previousFilterValues = this.productFiltersList.map(
149
+ (filter) => filter.value
150
+ );
151
+ const previouslySelected = this.selectedProductFilters || [];
152
+ const previouslySelectedSet = new Set(previouslySelected);
153
+ const hadAllFiltersSelected =
154
+ !!previousFilterValues.length &&
155
+ previousFilterValues.every((filterValue) =>
156
+ previouslySelectedSet.has(filterValue)
157
+ );
158
+
143
159
  this._otherDocs = this.transformOtherDocs(value);
160
+
161
+ // Rebuild product filters after other docs updates so SSG and
162
+ // non-SSG flows use the same setter-based filter refresh path.
163
+ if (this._availableServices.length) {
164
+ this.productFiltersList = this._availableServices;
165
+
166
+ if (hadAllFiltersSelected) {
167
+ this.selectedProductFilters = this.productFiltersList.map(
168
+ (filter) => filter.value
169
+ );
170
+ }
171
+ }
172
+
173
+ // Recompute visible cards/counts once transformed other docs are merged.
174
+ if (this.dataRetrieved) {
175
+ this.calculatePagination(this.page.toString(), true);
176
+ }
144
177
  }
145
178
 
146
179
  private transformOtherDocs(value: any): any[] {
@@ -177,16 +210,16 @@ export default class DocsGrid extends LightningElement {
177
210
 
178
211
  if (response.ok) {
179
212
  const data = await response.json();
180
- this._otherDocs = this.transformOtherDocs(data);
213
+ this.applyOtherDocs(data);
181
214
  } else {
182
215
  console.error(
183
216
  `Failed to fetch sitemetadata: ${response.status}`
184
217
  );
185
- this._otherDocs = [];
218
+ this.applyOtherDocs([]);
186
219
  }
187
220
  } catch (error) {
188
221
  console.error("Error fetching sitemetadata:", error);
189
- this._otherDocs = [];
222
+ this.applyOtherDocs([]);
190
223
  } finally {
191
224
  this._isFetchingOtherDocs = false;
192
225
  }
@@ -393,7 +426,8 @@ export default class DocsGrid extends LightningElement {
393
426
  }
394
427
 
395
428
  if (json.available_services) {
396
- this.productFiltersList = json.available_services;
429
+ this._availableServices = json.available_services;
430
+ this.productFiltersList = this._availableServices;
397
431
 
398
432
  if (!this.selectedProductFilters!.length) {
399
433
  this.selectedProductFilters =