@salesforcedevs/dw-components 1.27.17 → 1.27.18-product-fix-alpha1

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,29 @@
1
1
  {
2
- "name": "@salesforcedevs/dw-components",
3
- "version": "1.27.17",
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": "5720fe7f7a9f1361f96d992861b4f114e10561f5"
30
- }
2
+ "name": "@salesforcedevs/dw-components",
3
+ "version": "1.27.18-product-fix-alpha1",
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
+ }
@@ -101,7 +101,7 @@ button:active {
101
101
  }
102
102
 
103
103
  .empty-state-container {
104
- background-image: url("https://developer.salesforce.com/ns-assets/images/no-results-combined.svg");
104
+ background-image: url("https://developer.salesforce.com/ns-assets/no-results-combined.svg");
105
105
  background-repeat: no-repeat;
106
106
  background-position: center;
107
107
  background-size: contain;
@@ -11,7 +11,7 @@
11
11
  <dx-modal-drawer open={modalOpen} onclickclose={toggleModal}>
12
12
  <img
13
13
  if:true={filtersLoading}
14
- src="https://developer.salesforce.com/ns-assets/images/sidebar-loading.svg"
14
+ src="https://developer.salesforce.com/ns-assets/sidebar-loading.svg"
15
15
  alt="loading"
16
16
  class="modal-loading"
17
17
  />
@@ -66,7 +66,7 @@
66
66
  <template if:false={isMobile}>
67
67
  <img
68
68
  if:true={filtersLoading}
69
- src="https://developer.salesforce.com/ns-assets/images/sidebar-loading.svg"
69
+ src="https://developer.salesforce.com/ns-assets/sidebar-loading.svg"
70
70
  alt="loading"
71
71
  />
72
72
  <template if:false={filtersLoading}>
@@ -15,7 +15,7 @@
15
15
  icon-symbol="chevrondown"
16
16
  slot="control"
17
17
  >
18
- Products
18
+ SSG Products
19
19
  </dx-button>
20
20
  <template if:true={showProductFilters}>
21
21
  <dx-checkbox-group
@@ -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;
@@ -178,6 +179,7 @@ export default class DocsGrid extends LightningElement {
178
179
  if (response.ok) {
179
180
  const data = await response.json();
180
181
  this._otherDocs = this.transformOtherDocs(data);
182
+ this.refreshProductFiltersForSsg();
181
183
  } else {
182
184
  console.error(
183
185
  `Failed to fetch sitemetadata: ${response.status}`
@@ -192,6 +194,30 @@ export default class DocsGrid extends LightningElement {
192
194
  }
193
195
  }
194
196
 
197
+ private refreshProductFiltersForSsg(): void {
198
+ if (!this.ssgEnabled || !this._availableServices.length) {
199
+ return;
200
+ }
201
+
202
+ const previousFilterValues = this.productFiltersList.map(
203
+ (filter) => filter.value
204
+ );
205
+ const previouslySelected = this.selectedProductFilters || [];
206
+ const hadAllFiltersSelected =
207
+ !!previousFilterValues.length &&
208
+ previousFilterValues.every((value) =>
209
+ previouslySelected.includes(value)
210
+ );
211
+
212
+ this.productFiltersList = this._availableServices;
213
+
214
+ if (hadAllFiltersSelected) {
215
+ this.selectedProductFilters = this.productFiltersList.map(
216
+ (filter) => filter.value
217
+ );
218
+ }
219
+ }
220
+
195
221
  @api
196
222
  get couchDbDocTileExclusions() {
197
223
  return this._couchDbDocTileExclusions || new Set<any>();
@@ -393,13 +419,16 @@ export default class DocsGrid extends LightningElement {
393
419
  }
394
420
 
395
421
  if (json.available_services) {
396
- this.productFiltersList = json.available_services;
422
+ this._availableServices = json.available_services;
423
+ this.productFiltersList = this._availableServices;
397
424
 
398
425
  if (!this.selectedProductFilters!.length) {
399
426
  this.selectedProductFilters =
400
427
  this.productFiltersList.map(
401
428
  (filter) => filter.value
402
429
  );
430
+ } else {
431
+ this.reconcileSelectedProductFilters();
403
432
  }
404
433
  }
405
434
 
@@ -535,9 +564,14 @@ export default class DocsGrid extends LightningElement {
535
564
  PRODUCT_FILTER_ALL_SERVICES
536
565
  ) ||
537
566
  (typeof contentItem.service === "string" &&
538
- this.selectedProductFilters.includes(
567
+ (this.selectedProductFilters.includes(
539
568
  contentItem.service.toLowerCase()
540
- ));
569
+ ) ||
570
+ this.selectedProductFilters.some((selectedFilter) =>
571
+ contentItem.service
572
+ .toLowerCase()
573
+ .includes(selectedFilter)
574
+ )));
541
575
 
542
576
  return matchesSearchTerm && matchesProductFilters;
543
577
  });
@@ -638,6 +672,35 @@ export default class DocsGrid extends LightningElement {
638
672
  }
639
673
  }
640
674
 
675
+ reconcileSelectedProductFilters() {
676
+ if (!this.selectedProductFilters || !this.selectedProductFilters.length) {
677
+ return;
678
+ }
679
+
680
+ const availableFilterValues = this.productFiltersList.map(
681
+ (filter) => filter.value
682
+ );
683
+ const reconciledFilters = this.selectedProductFilters
684
+ .map((selectedFilter) => selectedFilter.toLowerCase())
685
+ .map((selectedFilter) => {
686
+ if (availableFilterValues.includes(selectedFilter)) {
687
+ return selectedFilter;
688
+ }
689
+
690
+ return availableFilterValues.find(
691
+ (availableFilter) =>
692
+ availableFilter.includes(selectedFilter) ||
693
+ selectedFilter.includes(availableFilter)
694
+ );
695
+ })
696
+ .filter((filter): filter is string => !!filter);
697
+
698
+ this.selectedProductFilters = uniqBy(
699
+ reconciledFilters.map((filter) => ({ value: filter })),
700
+ "value"
701
+ ).map(({ value }) => value);
702
+ }
703
+
641
704
  handleURLStateChange = () => {
642
705
  const urlParams = this.getSearchParams();
643
706
 
@@ -23,7 +23,7 @@ dx-section.events-action-bar::part(container) {
23
23
 
24
24
  dx-section.upcoming-events::part(container)::before {
25
25
  content: "";
26
- background-image: url("https://developer.salesforce.com/ns-assets/images/events-cloud1.svg");
26
+ background-image: url("https://developer.salesforce.com/ns-assets/events-cloud1.svg");
27
27
  width: 146px;
28
28
  height: 106px;
29
29
  position: absolute;
@@ -34,7 +34,7 @@ dx-section.upcoming-events::part(container)::before {
34
34
 
35
35
  dx-section.upcoming-events::part(container)::after {
36
36
  content: "";
37
- background-image: url("https://developer.salesforce.com/ns-assets/images/events-cloud2.svg");
37
+ background-image: url("https://developer.salesforce.com/ns-assets/events-cloud2.svg");
38
38
  width: 152px;
39
39
  height: 111px;
40
40
  position: absolute;
@@ -45,7 +45,7 @@ dx-section.upcoming-events::part(container)::after {
45
45
 
46
46
  dx-section.past-events::part(container)::before {
47
47
  content: "";
48
- background-image: url("https://developer.salesforce.com/ns-assets/images/events-gradient-elipse.svg");
48
+ background-image: url("https://developer.salesforce.com/ns-assets/events-gradient-elipse.svg");
49
49
  width: 2991px;
50
50
  height: 839px;
51
51
  position: absolute;
@@ -56,7 +56,7 @@ dx-section.past-events::part(container)::before {
56
56
 
57
57
  dx-section:not(:nth-child(2)).past-events::part(container)::after {
58
58
  content: "";
59
- background-image: url("https://developer.salesforce.com/ns-assets/images/events-cloud3.svg");
59
+ background-image: url("https://developer.salesforce.com/ns-assets/events-cloud3.svg");
60
60
  width: 655px;
61
61
  height: 270px;
62
62
  position: absolute;
@@ -13,7 +13,7 @@
13
13
 
14
14
  @media screen and (max-width: 768px) {
15
15
  .container {
16
- background-image: url("https://developer.salesforce.com/ns-assets/images/podcast-subscription-clouds-small.svg");
16
+ background-image: url("https://developer.salesforce.com/ns-assets/podcast-subscription-clouds-small.svg");
17
17
  background-size: auto 200px;
18
18
  }
19
19
 
@@ -47,7 +47,7 @@
47
47
 
48
48
  @media screen and (min-width: 768px) {
49
49
  .container {
50
- background-image: url("https://developer.salesforce.com/ns-assets/images/podcast-subscription-clouds.svg");
50
+ background-image: url("https://developer.salesforce.com/ns-assets/podcast-subscription-clouds.svg");
51
51
  min-height: 230px;
52
52
  }
53
53
 
@@ -5,15 +5,15 @@ export default class PodcastSubscription extends LightningElement {
5
5
  {
6
6
  href: "https://podcasts.apple.com/us/podcast/salesforce-developer-podcast/id1482325260",
7
7
  imgAlt: "Listen on Apple Podcasts",
8
- imgSrc: "https://developer.salesforce.com/ns-assets/images/podcasts-subscription-apple.svg"
8
+ imgSrc: "https://developer.salesforce.com/ns-assets/podcasts-subscription-apple.svg"
9
9
  },
10
10
  {
11
11
  href: "https://www.google.com/podcasts?feed=aHR0cHM6Ly9zYWxlc2ZvcmNlZGV2cG9kY2FzdC5saWJzeW4uY29tL3Jzcw%3D%3D",
12
12
  imgAlt: "Listen on Google Podcasts",
13
- imgSrc: "https://developer.salesforce.com/ns-assets/images/podcasts-subscription-google.svg"
13
+ imgSrc: "https://developer.salesforce.com/ns-assets/podcasts-subscription-google.svg"
14
14
  },
15
15
  {
16
- imgSrc: "https://developer.salesforce.com/ns-assets/images/podcasts-subscription-spotify.svg",
16
+ imgSrc: "https://developer.salesforce.com/ns-assets/podcasts-subscription-spotify.svg",
17
17
  imgAlt: "Listen on Spotify",
18
18
  href: "https://open.spotify.com/show/75y378cB3FM6RQ8MGUDJ5M"
19
19
  }
@@ -14,7 +14,7 @@
14
14
  <div class="info-container">
15
15
  <a href="/podcast" class="info-link">
16
16
  <img
17
- src="https://developer.salesforce.com/ns-assets/images/podcast-bear-background.png"
17
+ src="https://developer.salesforce.com/ns-assets/podcast-bear-background.png"
18
18
  loading="lazy"
19
19
  alt="Developer Podcast"
20
20
  style="width: 100%"
@@ -10,7 +10,7 @@
10
10
  <div if:true={isLoggedIn}>
11
11
  <div class="login-container logged-in">
12
12
  <img
13
- src="https://developer.salesforce.com/ns-assets/images/login-widget-bg.png"
13
+ src="https://developer.salesforce.com/ns-assets/login-widget-bg.png"
14
14
  class="header-img"
15
15
  alt="Light blue background image showing line-drawn hills and trees"
16
16
  />
@@ -114,7 +114,7 @@
114
114
  </span>
115
115
  <img
116
116
  class="login-link-img"
117
- src="https://developer.salesforce.com/ns-assets/images/salesforce-cloud.svg"
117
+ src="https://developer.salesforce.com/ns-assets/salesforce-cloud.svg"
118
118
  alt="Salesforce logo"
119
119
  />
120
120
  <dx-icon
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.