@salesforcedevs/dw-components 1.3.162 → 1.3.170

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