@salesforcedevs/dw-components 1.3.171-alpha.0 → 1.3.171
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/LICENSE +12 -0
- package/package.json +3 -2
- package/src/modules/dw/blogsGrid/blogsGrid.ts +1 -1
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.ts +36 -31
- package/src/modules/dw/contentArchive/contentArchive.types.ts +0 -1
- package/src/modules/dw/contentArchive/utils.ts +1 -1
- package/src/modules/dw/deSignupForm/deSignupForm.ts +8 -9
- package/src/modules/dw/docsGrid/docsGrid.ts +36 -59
- package/src/modules/dw/eventsList/eventsList.ts +10 -11
- package/src/modules/dw/newsletterForm/newsletterForm.ts +3 -3
- package/src/modules/dw/podcastsGrid/podcastsGrid.ts +3 -3
- package/src/modules/dw/rcgTable/getTableData.ts +1 -1
- package/src/modules/dw/rcgTable/rcgTable.ts +3 -3
- package/src/modules/{dwUtils → dwBaseElements}/postsGrid/postsGrid.ts +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dw-components",
|
|
3
|
-
"version": "1.3.171
|
|
3
|
+
"version": "1.3.171",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -23,5 +23,6 @@
|
|
|
23
23
|
"@types/lodash.uniqby": "^4.7.7",
|
|
24
24
|
"@types/setimmediate": "^1.0.2",
|
|
25
25
|
"setimmediate": "^1.0.5"
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
|
+
"gitHead": "949dbf90a356a61047657e2e15dd723f04063759"
|
|
27
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizePost } from "dxUtils/normalizers";
|
|
2
2
|
import { track } from "dxUtils/analytics";
|
|
3
3
|
import { WordpressBlogPost, NormalizedPost } from "typings/custom";
|
|
4
|
-
import { PostsGrid } from "
|
|
4
|
+
import { PostsGrid } from "dwBaseElements/postsGrid";
|
|
5
5
|
|
|
6
6
|
const BLOG_SUBSCRIBE_HREF = "https://developer.salesforce.com/blogs/feed";
|
|
7
7
|
|
|
@@ -3,11 +3,12 @@ import qs from "query-string";
|
|
|
3
3
|
import uniqBy from "lodash.uniqby";
|
|
4
4
|
import orderBy from "lodash.orderby";
|
|
5
5
|
import cloneDeep from "lodash.clonedeep";
|
|
6
|
-
import { DropdownItem, CodeSample } from "typings/custom";
|
|
6
|
+
import { DocsTile, DropdownItem, CodeSample } from "typings/custom";
|
|
7
7
|
import { toJson } from "dxUtils/normalizers";
|
|
8
8
|
import { track } from "dxUtils/analytics";
|
|
9
9
|
|
|
10
10
|
const PRODUCT_FILTER_ALL_PRODUCTS = "all products";
|
|
11
|
+
const LANGUAGE_FILTER_LABEL = "Type";
|
|
11
12
|
const WAIT_TIME = 500;
|
|
12
13
|
const DEFAULT_BUTTON_TEXT = "Explore on GitHub";
|
|
13
14
|
export default class CodeSamplesGrid extends LightningElement {
|
|
@@ -22,10 +23,10 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
22
23
|
private totalRecountCount = 0;
|
|
23
24
|
private totalPages = 1;
|
|
24
25
|
private _featuredCodeSample?: CodeSample = undefined;
|
|
25
|
-
private _samplesList
|
|
26
|
-
private _typesFiltersList
|
|
27
|
-
private _sourceFiltersList
|
|
28
|
-
private _productFiltersList
|
|
26
|
+
private _samplesList?: CodeSample[] = [];
|
|
27
|
+
private _typesFiltersList?: DropdownItem[] = [];
|
|
28
|
+
private _sourceFiltersList?: DropdownItem[] = [];
|
|
29
|
+
private _productFiltersList?: DropdownItem[] = [];
|
|
29
30
|
private matchDesktop!: MediaQueryList;
|
|
30
31
|
private matchMobile!: MediaQueryList;
|
|
31
32
|
private matchMobileSmall!: MediaQueryList;
|
|
@@ -38,9 +39,9 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
38
39
|
private showSourcesFilter = false;
|
|
39
40
|
private filteredItemsSelected: boolean = false;
|
|
40
41
|
private filtersDefaultValue = {
|
|
41
|
-
selectedSourceFilter: []
|
|
42
|
-
selectedTypeFilter: []
|
|
43
|
-
selectedProductFilter: []
|
|
42
|
+
selectedSourceFilter: [],
|
|
43
|
+
selectedTypeFilter: [],
|
|
44
|
+
selectedProductFilter: [],
|
|
44
45
|
searchTerm: "",
|
|
45
46
|
page: "1"
|
|
46
47
|
};
|
|
@@ -92,7 +93,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
92
93
|
}
|
|
93
94
|
if (urlParams.get("service")) {
|
|
94
95
|
this.selectedProductFilter = urlParams
|
|
95
|
-
.get("service")
|
|
96
|
+
.get("service")
|
|
96
97
|
.split(",");
|
|
97
98
|
}
|
|
98
99
|
if (urlParams.get("filter_text")) {
|
|
@@ -101,7 +102,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
101
102
|
).toLowerCase();
|
|
102
103
|
}
|
|
103
104
|
if (urlParams.has("page")) {
|
|
104
|
-
page = urlParams.get("page")
|
|
105
|
+
page = urlParams.get("page");
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
this.calculatePagination(page, true);
|
|
@@ -129,14 +130,14 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
129
130
|
set featuredCodeSample(value: string) {
|
|
130
131
|
this._featuredCodeSample = toJson(value);
|
|
131
132
|
}
|
|
132
|
-
get featuredCodeSample(): CodeSample
|
|
133
|
+
get featuredCodeSample(): CodeSample {
|
|
133
134
|
return this._featuredCodeSample;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
@api
|
|
137
138
|
set samples(value: string) {
|
|
138
139
|
const jsonSamples = toJson(value) || [];
|
|
139
|
-
this._samplesList = jsonSamples.map((sample
|
|
140
|
+
this._samplesList = jsonSamples.map((sample, i) => ({
|
|
140
141
|
id: i,
|
|
141
142
|
title: sample.title,
|
|
142
143
|
body: sample.body,
|
|
@@ -163,10 +164,10 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
163
164
|
}));
|
|
164
165
|
|
|
165
166
|
this._productFiltersList = orderBy(
|
|
166
|
-
uniqBy([...productsFilters]
|
|
167
|
+
uniqBy([...productsFilters], "value"),
|
|
167
168
|
["value"],
|
|
168
169
|
["asc"]
|
|
169
|
-
)
|
|
170
|
+
);
|
|
170
171
|
this.selectedProductFilter = this._productFiltersList.map(
|
|
171
172
|
(filter) => filter.value
|
|
172
173
|
);
|
|
@@ -186,10 +187,10 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
186
187
|
}));
|
|
187
188
|
|
|
188
189
|
this._typesFiltersList = orderBy(
|
|
189
|
-
uniqBy([...typesFilter]
|
|
190
|
+
uniqBy([...typesFilter], "value"),
|
|
190
191
|
["value"],
|
|
191
192
|
["asc"]
|
|
192
|
-
)
|
|
193
|
+
);
|
|
193
194
|
this.selectedTypeFilter = this._typesFiltersList.map(
|
|
194
195
|
(filter) => filter.value
|
|
195
196
|
);
|
|
@@ -211,10 +212,10 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
211
212
|
}));
|
|
212
213
|
|
|
213
214
|
this._sourceFiltersList = orderBy(
|
|
214
|
-
uniqBy([...sourcesFilter]
|
|
215
|
+
uniqBy([...sourcesFilter], "value"),
|
|
215
216
|
["value"],
|
|
216
217
|
["asc"]
|
|
217
|
-
)
|
|
218
|
+
);
|
|
218
219
|
this.selectedSourceFilter = this._sourceFiltersList.map(
|
|
219
220
|
(filter) => filter.value
|
|
220
221
|
);
|
|
@@ -230,7 +231,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
230
231
|
return this.filterSamples([...this.samples]);
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
get currentPageSamples():
|
|
234
|
+
get currentPageSamples(): DocsTile[] {
|
|
234
235
|
return this.filteredSamples.slice(
|
|
235
236
|
this.startingRecord - 1,
|
|
236
237
|
this.endingRecord
|
|
@@ -249,6 +250,14 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
249
250
|
return !this.filteredSamples.length;
|
|
250
251
|
}
|
|
251
252
|
|
|
253
|
+
get typeFilterLabel(): string {
|
|
254
|
+
const selectedLanguage = this.typesList.find(
|
|
255
|
+
(language) => language.value === this.selectedTypeFilter
|
|
256
|
+
);
|
|
257
|
+
const label = selectedLanguage && selectedLanguage.label;
|
|
258
|
+
return label || LANGUAGE_FILTER_LABEL;
|
|
259
|
+
}
|
|
260
|
+
|
|
252
261
|
get tileColumns(): string {
|
|
253
262
|
return this.deviceType === "desktop" ? "three" : "two";
|
|
254
263
|
}
|
|
@@ -334,8 +343,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
334
343
|
let newList = event.detail.value;
|
|
335
344
|
if (!event.detail.checked) {
|
|
336
345
|
newList = newList.filter(
|
|
337
|
-
(val
|
|
338
|
-
val !== PRODUCT_FILTER_ALL_PRODUCTS
|
|
346
|
+
(val) => val !== PRODUCT_FILTER_ALL_PRODUCTS
|
|
339
347
|
);
|
|
340
348
|
}
|
|
341
349
|
this.selectedProductFilter = newList;
|
|
@@ -394,9 +402,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
394
402
|
}
|
|
395
403
|
|
|
396
404
|
calculatePagination(page?: string, skipSetSearchParams = false): void {
|
|
397
|
-
|
|
398
|
-
this.page = parseInt(page, 10) || 1;
|
|
399
|
-
}
|
|
405
|
+
this.page = +parseInt(page, 10) || 1;
|
|
400
406
|
this.totalRecountCount = this.filteredSamples.length;
|
|
401
407
|
this.totalPages = Math.ceil(this.totalRecountCount / this.pageSize);
|
|
402
408
|
this.displayRecordsPerPage(this.page);
|
|
@@ -407,17 +413,16 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
407
413
|
|
|
408
414
|
scrollToTop(): void {
|
|
409
415
|
this.template
|
|
410
|
-
.querySelector(".docs-grid-container")
|
|
416
|
+
.querySelector(".docs-grid-container")
|
|
411
417
|
.scrollIntoView({ behavior: "smooth" });
|
|
412
418
|
}
|
|
413
419
|
|
|
414
|
-
setSearchParams(key?: string
|
|
420
|
+
setSearchParams(key?: string, val?: string[]): void {
|
|
415
421
|
const service =
|
|
416
|
-
this.selectedProductFilter
|
|
417
|
-
this.productFiltersList.length
|
|
422
|
+
this.selectedProductFilter.length === this.productFiltersList.length
|
|
418
423
|
? ""
|
|
419
|
-
: this.selectedProductFilter
|
|
420
|
-
const params
|
|
424
|
+
: this.selectedProductFilter.join(",");
|
|
425
|
+
const params = {
|
|
421
426
|
filter_text: this.searchTerm,
|
|
422
427
|
service,
|
|
423
428
|
type: this.selectedTypeFilter,
|
|
@@ -425,7 +430,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
425
430
|
source: this.selectedSourceFilter
|
|
426
431
|
};
|
|
427
432
|
if (key) {
|
|
428
|
-
params[key] = key === "service" ? val
|
|
433
|
+
params[key] = key === "service" ? val.join(",") : val;
|
|
429
434
|
}
|
|
430
435
|
for (const _key in params) {
|
|
431
436
|
if (!params[_key]) {
|
|
@@ -21,7 +21,6 @@ export type ArchivePost = {
|
|
|
21
21
|
audio_url: string;
|
|
22
22
|
duration: string;
|
|
23
23
|
};
|
|
24
|
-
authors: any; // I'm not sure if this field actually exists, but we're trying to use it so let's include it in the type
|
|
25
24
|
_embedded: {
|
|
26
25
|
author: Array<ArchivePostAuthor>;
|
|
27
26
|
["wp:term"]: Array<
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LightningElement, api, track } from "lwc";
|
|
2
2
|
import { toJson } from "dxUtils/normalizers";
|
|
3
3
|
import { track as trackGtm } from "dxUtils/analytics";
|
|
4
|
+
import { stateMap } from "dwUtils/forms";
|
|
4
5
|
import { submitForm, ErrorCode, SignupForm, UserData } from "./submitForm";
|
|
5
6
|
import { CountryOptions } from "typings/custom";
|
|
6
|
-
import { stateMap } from "dwUtils/forms";
|
|
7
7
|
|
|
8
8
|
type SelectOption = { value: string; label: string };
|
|
9
9
|
type Country = SelectOption & {
|
|
@@ -24,7 +24,7 @@ export default class DeSignupForm extends LightningElement {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
set roles(value) {
|
|
27
|
-
this._roles = toJson(value
|
|
27
|
+
this._roles = toJson(value);
|
|
28
28
|
}
|
|
29
29
|
@api
|
|
30
30
|
get countries() {
|
|
@@ -36,18 +36,18 @@ export default class DeSignupForm extends LightningElement {
|
|
|
36
36
|
@api drmDomain: string = "";
|
|
37
37
|
@api legalText: string = "";
|
|
38
38
|
|
|
39
|
-
private country: Country
|
|
39
|
+
private country: Country = null;
|
|
40
40
|
private _countries: string = "";
|
|
41
41
|
private disableSubmit = false;
|
|
42
42
|
private username = "";
|
|
43
|
-
private _roles: Array<SelectOption
|
|
43
|
+
private _roles: Array<SelectOption>;
|
|
44
44
|
private showMarketingCheckbox: boolean = false;
|
|
45
45
|
private marketingCheckbox: boolean = false;
|
|
46
46
|
private marketingText: string = "";
|
|
47
47
|
private showLegalCheckbox: boolean = false;
|
|
48
48
|
private privacyText: string = "";
|
|
49
49
|
|
|
50
|
-
@track knownDuplicateUsers
|
|
50
|
+
@track knownDuplicateUsers = [];
|
|
51
51
|
|
|
52
52
|
get usernameError(): string {
|
|
53
53
|
return this.knownDuplicateUsers.includes(this.username)
|
|
@@ -64,11 +64,10 @@ export default class DeSignupForm extends LightningElement {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
get showStateSelect(): boolean {
|
|
67
|
-
return !!(this.country &&
|
|
67
|
+
return !!(this.country && this.country in stateMap);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
get states(): string[] {
|
|
71
|
-
// @ts-ignore we're doing something dumb here where we use an entire object as the key of the stateMap
|
|
72
71
|
return stateMap[this.country] || [];
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -160,7 +159,7 @@ export default class DeSignupForm extends LightningElement {
|
|
|
160
159
|
return null;
|
|
161
160
|
}
|
|
162
161
|
|
|
163
|
-
const userData
|
|
162
|
+
const userData = {};
|
|
164
163
|
fields.forEach((field) => {
|
|
165
164
|
userData[field.name] = field.value;
|
|
166
165
|
});
|
|
@@ -256,7 +255,7 @@ export default class DeSignupForm extends LightningElement {
|
|
|
256
255
|
html: string,
|
|
257
256
|
shouldUpdate = true
|
|
258
257
|
): boolean {
|
|
259
|
-
let element: HTMLElement
|
|
258
|
+
let element: HTMLElement;
|
|
260
259
|
if (shouldUpdate) {
|
|
261
260
|
element = this.template.querySelector(selector);
|
|
262
261
|
if (element) {
|
|
@@ -15,19 +15,7 @@ const PRODUCT_FILTER_ALL_SERVICES = "all services";
|
|
|
15
15
|
const LANGUAGE_FILTER_LABEL = "Language";
|
|
16
16
|
const WAIT_TIME = 500;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
label: string;
|
|
20
|
-
value: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
type SearchParams = {
|
|
24
|
-
searchTerm: any;
|
|
25
|
-
productFilters?: any;
|
|
26
|
-
languageFilter?: any;
|
|
27
|
-
page?: any;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default class DocsGrid extends LightningElement {
|
|
18
|
+
export default abstract class DocsGrid extends LightningElement {
|
|
31
19
|
searchTerm = "";
|
|
32
20
|
selectedProductFilters: string[] | null = null;
|
|
33
21
|
selectedLanguageFilter = "en-us";
|
|
@@ -102,16 +90,14 @@ export default class DocsGrid extends LightningElement {
|
|
|
102
90
|
}
|
|
103
91
|
|
|
104
92
|
set externalMicrosites(value: any[]) {
|
|
105
|
-
this._externalMicrosites = toJson(value).map(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
);
|
|
93
|
+
this._externalMicrosites = toJson(value).map((site, index) => {
|
|
94
|
+
return {
|
|
95
|
+
...site,
|
|
96
|
+
service: site.brand,
|
|
97
|
+
id: `external-site-${index}`,
|
|
98
|
+
target: "_blank"
|
|
99
|
+
};
|
|
100
|
+
});
|
|
115
101
|
}
|
|
116
102
|
|
|
117
103
|
@api
|
|
@@ -148,7 +134,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
148
134
|
set couchDbDocTileExclusions(value: any) {
|
|
149
135
|
const exclusions = toJson(value);
|
|
150
136
|
this._couchDbDocTileExclusions = new Set(
|
|
151
|
-
exclusions.map((content
|
|
137
|
+
exclusions.map((content) => content.toLowerCase())
|
|
152
138
|
);
|
|
153
139
|
}
|
|
154
140
|
|
|
@@ -156,7 +142,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
156
142
|
if (this.selectedLanguageFilter !== "en-us") {
|
|
157
143
|
const sortedDocs = orderBy(
|
|
158
144
|
[
|
|
159
|
-
...this._apiDocs
|
|
145
|
+
...this._apiDocs,
|
|
160
146
|
...this.getOtherDocsForSelectedLocale(),
|
|
161
147
|
...this.externalMicrosites
|
|
162
148
|
],
|
|
@@ -168,7 +154,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
168
154
|
[
|
|
169
155
|
...this.getOtherDocsForSelectedLocale(),
|
|
170
156
|
...this.externalMicrosites,
|
|
171
|
-
...this._apiDocs
|
|
157
|
+
...this._apiDocs
|
|
172
158
|
],
|
|
173
159
|
"title"
|
|
174
160
|
);
|
|
@@ -201,14 +187,13 @@ export default class DocsGrid extends LightningElement {
|
|
|
201
187
|
set productFiltersList(value) {
|
|
202
188
|
const externalMicrositesFilters = this.externalMicrosites.map(
|
|
203
189
|
({ brand }) => this.normalizeProductFilter(brand)
|
|
204
|
-
)
|
|
205
|
-
const otherDocsFilters = this.otherDocs.map(({ service }
|
|
190
|
+
);
|
|
191
|
+
const otherDocsFilters = this.otherDocs.map(({ service }) =>
|
|
206
192
|
this.normalizeProductFilter(service)
|
|
207
|
-
)
|
|
208
|
-
const apiDocsFilters = value.map(({ name }
|
|
193
|
+
);
|
|
194
|
+
const apiDocsFilters = value.map(({ name }) =>
|
|
209
195
|
this.normalizeProductFilter(name)
|
|
210
|
-
)
|
|
211
|
-
|
|
196
|
+
);
|
|
212
197
|
const filters = [
|
|
213
198
|
...externalMicrositesFilters,
|
|
214
199
|
...otherDocsFilters,
|
|
@@ -216,7 +201,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
216
201
|
].filter((filter) => filter.value);
|
|
217
202
|
|
|
218
203
|
this._productFiltersList = orderBy(
|
|
219
|
-
uniqBy(filters
|
|
204
|
+
uniqBy(filters, "value"),
|
|
220
205
|
["value"],
|
|
221
206
|
["asc"]
|
|
222
207
|
);
|
|
@@ -265,7 +250,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
265
250
|
}
|
|
266
251
|
|
|
267
252
|
getOtherDocsForSelectedLocale() {
|
|
268
|
-
const docsForLocale = this._otherDocs
|
|
253
|
+
const docsForLocale = this._otherDocs.filter(
|
|
269
254
|
(doc) => doc.locale === this.selectedLanguageFilter
|
|
270
255
|
);
|
|
271
256
|
return docsForLocale || [];
|
|
@@ -289,16 +274,13 @@ export default class DocsGrid extends LightningElement {
|
|
|
289
274
|
}
|
|
290
275
|
};
|
|
291
276
|
|
|
292
|
-
async retrieveDscApis(initialCall
|
|
277
|
+
async retrieveDscApis(initialCall): Promise<void> {
|
|
293
278
|
const urlParams = this.getSearchParams();
|
|
294
279
|
this.setFilters(urlParams);
|
|
295
280
|
|
|
296
281
|
try {
|
|
297
282
|
const response = await fetch(
|
|
298
|
-
this.apiDomain +
|
|
299
|
-
DSC_API_URL[
|
|
300
|
-
this.selectedLanguageFilter as keyof typeof DSC_API_URL
|
|
301
|
-
]
|
|
283
|
+
this.apiDomain + DSC_API_URL[this.selectedLanguageFilter]
|
|
302
284
|
);
|
|
303
285
|
|
|
304
286
|
if (response.ok) {
|
|
@@ -314,7 +296,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
314
296
|
if (json.available_services) {
|
|
315
297
|
this.productFiltersList = json.available_services;
|
|
316
298
|
|
|
317
|
-
if (!this.selectedProductFilters
|
|
299
|
+
if (!this.selectedProductFilters.length) {
|
|
318
300
|
this.selectedProductFilters =
|
|
319
301
|
this.productFiltersList.map(
|
|
320
302
|
(filter) => filter.value
|
|
@@ -367,7 +349,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
367
349
|
);
|
|
368
350
|
}
|
|
369
351
|
|
|
370
|
-
normalizeProductFilter(val
|
|
352
|
+
normalizeProductFilter(val) {
|
|
371
353
|
return {
|
|
372
354
|
label: val,
|
|
373
355
|
value: val && val.toLowerCase()
|
|
@@ -393,7 +375,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
393
375
|
: this.endingRecord;
|
|
394
376
|
};
|
|
395
377
|
|
|
396
|
-
handleSearchChange(event
|
|
378
|
+
handleSearchChange(event): void {
|
|
397
379
|
const value = event.detail;
|
|
398
380
|
this.searchTerm = value.toLowerCase();
|
|
399
381
|
|
|
@@ -404,7 +386,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
404
386
|
}, WAIT_TIME);
|
|
405
387
|
}
|
|
406
388
|
|
|
407
|
-
handleProductFilterChange(event
|
|
389
|
+
handleProductFilterChange(event): void {
|
|
408
390
|
if (event.detail.checkedValue === PRODUCT_FILTER_ALL_SERVICES) {
|
|
409
391
|
if (event.detail.checked) {
|
|
410
392
|
this.selectedProductFilters = this.productFiltersList.map(
|
|
@@ -414,7 +396,7 @@ export default class DocsGrid extends LightningElement {
|
|
|
414
396
|
this.selectedProductFilters = [];
|
|
415
397
|
}
|
|
416
398
|
} else {
|
|
417
|
-
let newList = event.detail.value
|
|
399
|
+
let newList = event.detail.value;
|
|
418
400
|
|
|
419
401
|
if (!event.detail.checked) {
|
|
420
402
|
newList = newList.filter(
|
|
@@ -428,14 +410,14 @@ export default class DocsGrid extends LightningElement {
|
|
|
428
410
|
this.filteredItemsSelected = false;
|
|
429
411
|
}
|
|
430
412
|
|
|
431
|
-
handleLanguageFilterChange(event
|
|
413
|
+
handleLanguageFilterChange(event): void {
|
|
432
414
|
this.selectedLanguageFilter = event.detail.value;
|
|
433
415
|
this.dataRetrieved = false;
|
|
434
416
|
this.setSearchParams("lang", this.selectedLanguageFilter);
|
|
435
417
|
this.retrieveDscApis(false);
|
|
436
418
|
}
|
|
437
419
|
|
|
438
|
-
filterDocs(docs
|
|
420
|
+
filterDocs(docs) {
|
|
439
421
|
const filtered = docs.filter((contentItem) => {
|
|
440
422
|
const matchesSearchTerm =
|
|
441
423
|
this.findWithRegex(
|
|
@@ -468,10 +450,8 @@ export default class DocsGrid extends LightningElement {
|
|
|
468
450
|
return !!baseString.match(regex);
|
|
469
451
|
}
|
|
470
452
|
|
|
471
|
-
calculatePagination(page?: string, skipSetSearchParams
|
|
472
|
-
|
|
473
|
-
this.page = parseInt(page, 10) || 1;
|
|
474
|
-
}
|
|
453
|
+
calculatePagination(page?: string, skipSetSearchParams?) {
|
|
454
|
+
this.page = parseInt(page, 10) || 1;
|
|
475
455
|
this.totalRecountCount = this.filteredDocs.length;
|
|
476
456
|
this.totalPages = Math.ceil(this.totalRecountCount / this.pageSize);
|
|
477
457
|
|
|
@@ -484,11 +464,11 @@ export default class DocsGrid extends LightningElement {
|
|
|
484
464
|
|
|
485
465
|
scrollToTop() {
|
|
486
466
|
this.template
|
|
487
|
-
.querySelector(".docs-grid-container")
|
|
467
|
+
.querySelector(".docs-grid-container")
|
|
488
468
|
.scrollIntoView({ behavior: "smooth" });
|
|
489
469
|
}
|
|
490
470
|
|
|
491
|
-
getSearchParams()
|
|
471
|
+
getSearchParams() {
|
|
492
472
|
const { filter_text, service, lang, page } = qs.parse(
|
|
493
473
|
window.location.search
|
|
494
474
|
);
|
|
@@ -501,12 +481,12 @@ export default class DocsGrid extends LightningElement {
|
|
|
501
481
|
return params;
|
|
502
482
|
}
|
|
503
483
|
|
|
504
|
-
setSearchParams(key?: string, val
|
|
484
|
+
setSearchParams(key?: string, val?) {
|
|
505
485
|
const service =
|
|
506
|
-
this.selectedProductFilters
|
|
486
|
+
this.selectedProductFilters.length ===
|
|
507
487
|
this.productFiltersList.length
|
|
508
488
|
? ""
|
|
509
|
-
: this.selectedProductFilters
|
|
489
|
+
: this.selectedProductFilters.join(",");
|
|
510
490
|
|
|
511
491
|
const params = {
|
|
512
492
|
filter_text: this.searchTerm,
|
|
@@ -516,14 +496,11 @@ export default class DocsGrid extends LightningElement {
|
|
|
516
496
|
};
|
|
517
497
|
|
|
518
498
|
if (key) {
|
|
519
|
-
params[key
|
|
520
|
-
key === "service" ? val.join(",") : val;
|
|
499
|
+
params[key] = key === "service" ? val.join(",") : val;
|
|
521
500
|
}
|
|
522
501
|
|
|
523
502
|
for (const _key in params) {
|
|
524
|
-
// @ts-ignore Dark Magic (TM)
|
|
525
503
|
if (!params[_key] || params[_key] === "") {
|
|
526
|
-
// @ts-ignore Dark Magic (TM)
|
|
527
504
|
delete params[_key];
|
|
528
505
|
}
|
|
529
506
|
}
|
|
@@ -86,9 +86,9 @@ export default abstract class EventsList extends LightningElement {
|
|
|
86
86
|
connectedCallback(): void {
|
|
87
87
|
const { months = "", types = "" } = qs.parse(window.location.search);
|
|
88
88
|
this.selectedMonths =
|
|
89
|
-
months === "" ? this.selectedMonths :
|
|
89
|
+
months === "" ? this.selectedMonths : months.split(",");
|
|
90
90
|
this.selectedEventTypes =
|
|
91
|
-
types === "" ? this.selectedEventTypes :
|
|
91
|
+
types === "" ? this.selectedEventTypes : types.split(",");
|
|
92
92
|
window.addEventListener("popstate", this.handleURLStateChange);
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -122,13 +122,13 @@ export default abstract class EventsList extends LightningElement {
|
|
|
122
122
|
|
|
123
123
|
createFilters() {
|
|
124
124
|
this.monthsList = orderBy(
|
|
125
|
-
uniqBy(this.createMonthsList()
|
|
125
|
+
uniqBy(this.createMonthsList(), "value"),
|
|
126
126
|
["rawDate"],
|
|
127
127
|
["desc"]
|
|
128
128
|
);
|
|
129
129
|
this.selectedMonths = this.monthsList.map((month) => month.value);
|
|
130
130
|
|
|
131
|
-
this.eventTypeList = uniqBy(this.createEventTypeList()
|
|
131
|
+
this.eventTypeList = uniqBy(this.createEventTypeList(), "value");
|
|
132
132
|
this.selectedEventTypes = this.eventTypeList.map(
|
|
133
133
|
(eventType) => eventType.value
|
|
134
134
|
);
|
|
@@ -136,12 +136,12 @@ export default abstract class EventsList extends LightningElement {
|
|
|
136
136
|
this.showFilters = true;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
handleDateFilterChange(e
|
|
139
|
+
handleDateFilterChange(e) {
|
|
140
140
|
this.selectedMonths = e.detail.value;
|
|
141
141
|
this.setSearchParams();
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
handleEventTypeFilterChange(e
|
|
144
|
+
handleEventTypeFilterChange(e) {
|
|
145
145
|
this.selectedEventTypes = e.detail.value;
|
|
146
146
|
this.setSearchParams();
|
|
147
147
|
}
|
|
@@ -151,11 +151,11 @@ export default abstract class EventsList extends LightningElement {
|
|
|
151
151
|
this.selectedMonths =
|
|
152
152
|
months === ""
|
|
153
153
|
? this.monthsList.map((month) => month.value)
|
|
154
|
-
:
|
|
154
|
+
: months.split(",");
|
|
155
155
|
this.selectedEventTypes =
|
|
156
156
|
types === ""
|
|
157
157
|
? this.eventTypeList.map((type) => type.value)
|
|
158
|
-
:
|
|
158
|
+
: types.split(",");
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
setSearchParams() {
|
|
@@ -169,8 +169,7 @@ export default abstract class EventsList extends LightningElement {
|
|
|
169
169
|
);
|
|
170
170
|
const params = { months, types };
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
for (key in params) {
|
|
172
|
+
for (const key in params) {
|
|
174
173
|
if (!params[key] || params[key] === "") {
|
|
175
174
|
delete params[key];
|
|
176
175
|
}
|
|
@@ -183,7 +182,7 @@ export default abstract class EventsList extends LightningElement {
|
|
|
183
182
|
window.history.pushState({ path: newurl }, "", newurl);
|
|
184
183
|
}
|
|
185
184
|
|
|
186
|
-
normalizeParamList(selectedList
|
|
185
|
+
normalizeParamList(selectedList, totalList) {
|
|
187
186
|
return selectedList.length === totalList.length
|
|
188
187
|
? ""
|
|
189
188
|
: selectedList.join(",");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import { track } from "dxUtils/analytics";
|
|
3
|
-
import { CountryOptions } from "typings/custom";
|
|
4
3
|
import { stateMap } from "dwUtils/forms";
|
|
4
|
+
import { CountryOptions } from "typings/custom";
|
|
5
5
|
|
|
6
6
|
const LOCAL_STORAGE_KEY = "subscriberEmail";
|
|
7
7
|
|
|
@@ -29,7 +29,7 @@ export default class Form extends LightningElement {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
get states(): string[] {
|
|
32
|
-
return
|
|
32
|
+
return stateMap[this.country] || [];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
connectedCallback() {
|
|
@@ -194,7 +194,7 @@ export default class Form extends LightningElement {
|
|
|
194
194
|
converting_page: "SFDC:us:newsletter:success",
|
|
195
195
|
converting_page_url:
|
|
196
196
|
"https://developer.salesforce.com/newsletter/success",
|
|
197
|
-
form_country: formData?.
|
|
197
|
+
form_country: formData?.Country,
|
|
198
198
|
form_name: "Newsletter Signup",
|
|
199
199
|
form_primary_product_interest: "Newsletter",
|
|
200
200
|
offer_type: "Newsletter"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PostsGrid } from "dwUtils/postsGrid";
|
|
2
1
|
import { normalizeEpisode } from "dxUtils/normalizers";
|
|
3
|
-
import { NormalizedPost,
|
|
2
|
+
import { NormalizedPost, WordpressPost } from "typings/custom";
|
|
3
|
+
import { PostsGrid } from "dwBaseElements/postsGrid";
|
|
4
4
|
|
|
5
5
|
export default class PodcastsGrid extends PostsGrid {
|
|
6
|
-
normalizePost(post:
|
|
6
|
+
normalizePost(post: WordpressPost): NormalizedPost {
|
|
7
7
|
return normalizeEpisode(post);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -3,15 +3,15 @@ import { getTableData, RCG_URL } from "./getTableData";
|
|
|
3
3
|
import altData from "./altData";
|
|
4
4
|
|
|
5
5
|
export default class RCGTable extends LightningElement {
|
|
6
|
-
private columnData
|
|
7
|
-
private rowData
|
|
6
|
+
private columnData = null;
|
|
7
|
+
private rowData = null;
|
|
8
8
|
private rcgUrl = RCG_URL;
|
|
9
9
|
|
|
10
10
|
connectedCallback() {
|
|
11
11
|
this.renderTableData();
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
prependLinksWithUrl(data
|
|
14
|
+
prependLinksWithUrl(data) {
|
|
15
15
|
return data.map((el) => {
|
|
16
16
|
return {
|
|
17
17
|
...el,
|
|
@@ -36,7 +36,7 @@ export abstract class PostsGrid extends LightningElement {
|
|
|
36
36
|
return this._posts.slice(0, this.count);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
onClick(e:
|
|
39
|
+
onClick(e: Event): void {
|
|
40
40
|
if (!this._morePostsViewed) {
|
|
41
41
|
this._count += this._loadMoreAmount;
|
|
42
42
|
this._morePostsViewed = true;
|