@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,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
|
-
|
|
521
|
+
const isSupportedLocale = isGivenLanguageSupported(
|
|
522
|
+
this.allLanguages,
|
|
523
|
+
languageFilter
|
|
524
|
+
);
|
|
525
|
+
if (isSupportedLocale) {
|
|
508
526
|
this.selectedLanguageFilter = languageFilter;
|
|
509
527
|
}
|
|
510
528
|
}
|
|
@@ -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.
|
|
181
|
-
(
|
|
180
|
+
const countryOptions = countrySelectElement.options.find(
|
|
181
|
+
(option) => option.value === countrySelectElement.value
|
|
182
182
|
);
|
|
183
183
|
|
|
184
184
|
this.setLegalAndMarketingData(countryOptions);
|