@salesforcedevs/dw-components 0.55.0 → 0.56.1

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": "0.55.0",
3
+ "version": "0.56.1",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -23,5 +23,5 @@
23
23
  "@types/lodash.orderby": "^4.6.7",
24
24
  "@types/lodash.uniqby": "^4.7.7"
25
25
  },
26
- "gitHead": "4605730d0e1fbcfb0535d2b97424dc61678cd918"
26
+ "gitHead": "49fdd771cee3f6d50a27cd505ca2a612f1887493"
27
27
  }
@@ -1,9 +1,11 @@
1
1
  import { api, LightningElement } from "lwc";
2
2
  import { toJson } from "dxUtils/normalizers";
3
- import { DocsTile, DropdownItem } 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";
7
+ import { isGivenLanguageSupported } from "dxUtils/language";
8
+ import { DEFAULT_LANGUAGES } from "dxUtils/constants";
7
9
 
8
10
  const DSC_API_URL = {
9
11
  "en-us": "/docs/get_index/en-us/000.0/false/All%20Services/all",
@@ -39,6 +41,7 @@ export default abstract class DocsGrid extends LightningElement {
39
41
  private deviceType: "desktop" | "mobile" | "mobile-small" = "desktop";
40
42
  private _searchTimeout?: number;
41
43
  private _couchDbDocTileExclusions?: Set<any>;
44
+ private _allLanguages: Array<Language> = DEFAULT_LANGUAGES;
42
45
 
43
46
  connectedCallback(): void {
44
47
  this.retrieveDscApis(true);
@@ -201,6 +204,17 @@ export default abstract class DocsGrid extends LightningElement {
201
204
  );
202
205
  }
203
206
 
207
+ @api
208
+ get allLanguages(): Array<Language> {
209
+ return this._allLanguages;
210
+ }
211
+
212
+ set allLanguages(value: string) {
213
+ if (value) {
214
+ this._allLanguages = JSON.parse(value);
215
+ }
216
+ }
217
+
204
218
  get showEmptyState() {
205
219
  return this.dataRetrieved && !this.filteredDocs.length;
206
220
  }
@@ -504,7 +518,11 @@ export default abstract class DocsGrid extends LightningElement {
504
518
  this.selectedProductFilters =
505
519
  productFilters === "" ? [] : productFilters.split(",");
506
520
 
507
- if (languageFilter === "en-us" || languageFilter === "ja-jp") {
521
+ const isSupportedLocale = isGivenLanguageSupported(
522
+ this.allLanguages,
523
+ languageFilter
524
+ );
525
+ if (isSupportedLocale) {
508
526
  this.selectedLanguageFilter = languageFilter;
509
527
  }
510
528
  }