@salesforcedevs/dw-components 0.70.3 → 0.71.0

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.70.3",
3
+ "version": "0.71.0",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -22,5 +22,5 @@
22
22
  "@types/lodash.orderby": "^4.6.7",
23
23
  "@types/lodash.uniqby": "^4.7.7"
24
24
  },
25
- "gitHead": "8cbd21884325d53e907dc217b26187489ce5eec0"
25
+ "gitHead": "4a5210f6d819521bdad4cd5a21ffc38051c7bd75"
26
26
  }
@@ -36,6 +36,7 @@
36
36
  title={dateTitle}
37
37
  options={dateList}
38
38
  variant="nested"
39
+ filters-dates-loading={filtersDatesLoading}
39
40
  onchange={handleFiltersEvent}
40
41
  ></dx-filter-menu>
41
42
  <template if:false={hideBlogFilters}>
@@ -82,6 +83,7 @@
82
83
  name="dates"
83
84
  title={dateTitle}
84
85
  options={dateList}
86
+ filters-dates-loading={filtersDatesLoading}
85
87
  variant="nested"
86
88
  onchange={handleFiltersEvent}
87
89
  ></dx-filter-menu>
@@ -20,6 +20,7 @@ export default class ContentArchive extends LightningElement {
20
20
  private totalPages: number = 1;
21
21
  private loading: boolean = true;
22
22
  private filtersLoading: boolean = true;
23
+ private filtersDatesLoading: boolean = false;
23
24
  private modalOpen: boolean = false;
24
25
  private cardType: string = "expanded";
25
26
 
@@ -130,6 +131,12 @@ export default class ContentArchive extends LightningElement {
130
131
  }`;
131
132
  }
132
133
 
134
+ get selectedPostType() {
135
+ return this.selectedFilterMenuData.site.length === 1
136
+ ? this.selectedFilterMenuData.site[0].name.toLowerCase()
137
+ : "all";
138
+ }
139
+
133
140
  private filterSelectedDates(
134
141
  currentDateList: Array<{ name: string }>,
135
142
  selectedDate: string,
@@ -166,6 +173,7 @@ export default class ContentArchive extends LightningElement {
166
173
  setUrlParamValue(QUERY_SITE_FILTER, selectedFilters);
167
174
 
168
175
  this.updateSelectedFilters(value, name, checked);
176
+ this.fetchArchiveFilterDateList();
169
177
  }
170
178
 
171
179
  private handleFiltersEvent(e: CustomEvent) {
@@ -325,7 +333,10 @@ export default class ContentArchive extends LightningElement {
325
333
  private async fetchArchiveFilterList() {
326
334
  if (!this.dateList.length) {
327
335
  this.filtersLoading = true;
328
- const { dates, authors, categories } = await getArchiveFilterList();
336
+
337
+ const { dates, authors, categories } = await getArchiveFilterList(
338
+ this.selectedPostType
339
+ );
329
340
 
330
341
  this.dateList = this.splitOptionsByDate(dates);
331
342
  this.authorList = authors;
@@ -334,6 +345,16 @@ export default class ContentArchive extends LightningElement {
334
345
  }
335
346
  }
336
347
 
348
+ private async fetchArchiveFilterDateList() {
349
+ this.filtersDatesLoading = true;
350
+
351
+ const { dates } = await getArchiveFilterList(this.selectedPostType);
352
+
353
+ this.dateList = this.splitOptionsByDate(dates);
354
+
355
+ this.filtersDatesLoading = false;
356
+ }
357
+
337
358
  private async fetchPosts(numberOfPosts: number) {
338
359
  this.loading = true;
339
360
 
@@ -151,8 +151,12 @@ export async function getArchivePosts(
151
151
  };
152
152
  }
153
153
 
154
- export async function getArchiveFilterList() {
155
- const response = await fetch(ARCHIVE_FILTER_LIST_URL);
154
+ export async function getArchiveFilterList(postType: string = "all") {
155
+ const response = await fetch(
156
+ `${ARCHIVE_FILTER_LIST_URL}${
157
+ postType !== "all" ? `&post-type=${postType}` : ""
158
+ }`
159
+ );
156
160
 
157
161
  if (response.ok) {
158
162
  return response.json();