@salesforcedevs/dw-components 0.54.5 → 0.54.7-dw-locales2

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.54.5",
3
+ "version": "0.54.7-dw-locales2",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -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
  }
@@ -47,7 +47,7 @@
47
47
  onchange={handleChange}
48
48
  placeholder="Select your Country/Region"
49
49
  message-when-value-missing="Select your country/region"
50
- json-options={countries}
50
+ options={countries}
51
51
  value={country}
52
52
  required="true"
53
53
  ></dx-select>
@@ -177,8 +177,8 @@ export default class Form extends LightningElement {
177
177
 
178
178
  handleConsent(countrySelectElement: any) {
179
179
  if (this.checkboxTextSet) {
180
- const countryOptions = countrySelectElement.jsonOptions.find(
181
- (jsonOption) => jsonOption.value === countrySelectElement.value
180
+ const countryOptions = countrySelectElement.options.find(
181
+ (option) => option.value === countrySelectElement.value
182
182
  );
183
183
 
184
184
  this.setLegalAndMarketingData(countryOptions);