@salesforcedevs/dw-components 0.54.0 → 0.54.5
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/lwc.config.json +10 -1
- package/package.json +9 -4
- package/src/modules/dw/blogsGrid/blogsGrid.css +80 -0
- package/src/modules/dw/blogsGrid/blogsGrid.html +57 -0
- package/src/modules/dw/blogsGrid/blogsGrid.ts +28 -0
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.ts +2 -2
- package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +2 -2
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.css +171 -0
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.html +133 -0
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.ts +429 -0
- package/src/modules/dw/contentArchive/contentArchive.css +1 -1
- package/src/modules/dw/contentArchive/contentArchive.ts +2 -2
- package/src/modules/dw/deSignupForm/deSignupForm.css +70 -0
- package/src/modules/dw/deSignupForm/deSignupForm.html +99 -0
- package/src/modules/dw/deSignupForm/deSignupForm.ts +268 -0
- package/src/modules/dw/deSignupForm/submitForm.ts +90 -0
- package/src/modules/dw/docsGrid/docsGrid.css +86 -0
- package/src/modules/dw/docsGrid/docsGrid.html +84 -0
- package/src/modules/dw/docsGrid/docsGrid.ts +522 -0
- package/src/modules/dw/eventsList/eventsList.css +109 -0
- package/src/modules/dw/eventsList/eventsList.html +91 -0
- package/src/modules/dw/eventsList/eventsList.ts +180 -0
- package/src/modules/dw/instrumentation/instrumentation.ts +1 -1
- package/src/modules/dw/newsletterForm/newsletterForm.css +2 -2
- package/src/modules/dw/newsletterForm/newsletterForm.ts +1 -1
- package/src/modules/dw/podcastSubscription/podcastSubscription.css +2 -2
- package/src/modules/dw/podcastsGrid/podcastsGrid.css +5 -0
- package/src/modules/dw/podcastsGrid/podcastsGrid.html +29 -0
- package/src/modules/dw/podcastsGrid/podcastsGrid.ts +9 -0
- package/src/modules/dw/podcastsPromo/podcastsPromo.css +32 -0
- package/src/modules/dw/podcastsPromo/podcastsPromo.html +30 -0
- package/src/modules/dw/podcastsPromo/podcastsPromo.ts +3 -0
- package/src/modules/dw/rcgTable/altData.ts +78 -0
- package/src/modules/dw/rcgTable/getTableData.ts +10 -0
- package/src/modules/dw/rcgTable/rcgTable.css +39 -0
- package/src/modules/dw/rcgTable/rcgTable.html +31 -0
- package/src/modules/dw/rcgTable/rcgTable.ts +34 -0
- package/src/modules/dw/searchResults/searchResults.css +1 -1
- package/src/modules/dw/slackCta/slackCta.css +2 -2
- package/src/modules/dw/slackSuccess/slackSuccess.css +65 -0
- package/src/modules/dw/slackSuccess/slackSuccess.html +32 -0
- package/src/modules/dw/slackSuccess/slackSuccess.ts +32 -0
- package/src/modules/dwBaseElements/postsGrid/postsGrid.ts +76 -0
- package/src/modules/dwHelpers/postsGrid/postsGrid.css +9 -0
- package/LICENSE +0 -12
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { api, LightningElement } from "lwc";
|
|
2
|
+
import { DocsTile, DropdownItem, CodeSample } from "typings/custom";
|
|
3
|
+
import qs from "query-string";
|
|
4
|
+
import uniqBy from "lodash.uniqby";
|
|
5
|
+
import orderBy from "lodash.orderby";
|
|
6
|
+
import cloneDeep from "lodash.clonedeep";
|
|
7
|
+
|
|
8
|
+
const PRODUCT_FILTER_ALL_PRODUCTS = "all products";
|
|
9
|
+
const LANGUAGE_FILTER_LABEL = "Type";
|
|
10
|
+
const WAIT_TIME = 500;
|
|
11
|
+
const DEFAULT_BUTTON_TEXT = "Explore on GitHub";
|
|
12
|
+
export default class CodeSamplesGrid extends LightningElement {
|
|
13
|
+
private searchTerm = "";
|
|
14
|
+
private selectedProductFilter: string[] | null = null;
|
|
15
|
+
private selectedTypeFilter: string[] | null = null;
|
|
16
|
+
private selectedSourceFilter: string[] | null = null;
|
|
17
|
+
private page = 1;
|
|
18
|
+
private pageSize = 9;
|
|
19
|
+
private startingRecord = 1;
|
|
20
|
+
private endingRecord = 24;
|
|
21
|
+
private totalRecountCount = 0;
|
|
22
|
+
private totalPages = 1;
|
|
23
|
+
private _featuredCodeSample?: CodeSample = undefined;
|
|
24
|
+
private _samplesList?: CodeSample[] = [];
|
|
25
|
+
private _typesFiltersList?: DropdownItem[] = [];
|
|
26
|
+
private _sourceFiltersList?: DropdownItem[] = [];
|
|
27
|
+
private _productFiltersList?: DropdownItem[] = [];
|
|
28
|
+
private matchDesktop!: MediaQueryList;
|
|
29
|
+
private matchMobile!: MediaQueryList;
|
|
30
|
+
private matchMobileSmall!: MediaQueryList;
|
|
31
|
+
private deviceType: "desktop" | "mobile" | "mobile-small" = "desktop";
|
|
32
|
+
private _searchTimeout?: number;
|
|
33
|
+
private target = "_blank";
|
|
34
|
+
private isDesktop = "(min-width: 1024px)";
|
|
35
|
+
private isMobile = "(min-width: 401px) and (max-width: 1023px)";
|
|
36
|
+
private isMobileSmall = "(max-width: 400px)";
|
|
37
|
+
private showSourcesFilter = false;
|
|
38
|
+
private filtersDefaultValue = {
|
|
39
|
+
selectedSourceFilter: [],
|
|
40
|
+
selectedTypeFilter: [],
|
|
41
|
+
selectedProductFilter: [],
|
|
42
|
+
searchTerm: "",
|
|
43
|
+
page: "1"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
connectedCallback(): void {
|
|
47
|
+
this.matchDesktop = window.matchMedia(this.isDesktop);
|
|
48
|
+
this.matchDesktop.addEventListener("change", this.handleView);
|
|
49
|
+
|
|
50
|
+
this.matchMobile = window.matchMedia(this.isMobile);
|
|
51
|
+
this.matchMobile.addEventListener("change", this.handleView);
|
|
52
|
+
|
|
53
|
+
this.matchMobileSmall = window.matchMedia(this.isMobileSmall);
|
|
54
|
+
this.matchMobileSmall.addEventListener("change", this.handleView);
|
|
55
|
+
window.addEventListener("popstate", this.handleURLStateChange);
|
|
56
|
+
if (this.matchDesktop.matches) {
|
|
57
|
+
this.deviceType = "desktop";
|
|
58
|
+
}
|
|
59
|
+
if (this.matchMobile.matches) {
|
|
60
|
+
this.deviceType = "mobile";
|
|
61
|
+
}
|
|
62
|
+
if (this.matchMobileSmall.matches) {
|
|
63
|
+
this.deviceType = "mobile-small";
|
|
64
|
+
}
|
|
65
|
+
this.evaluateQueryParams(false);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
handleURLStateChange(): void {
|
|
69
|
+
this.evaluateQueryParams(true);
|
|
70
|
+
this.scrollToTop();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
evaluateQueryParams(resetFilters: boolean): void {
|
|
74
|
+
let page = "1";
|
|
75
|
+
if (resetFilters) {
|
|
76
|
+
this.selectedSourceFilter =
|
|
77
|
+
this.filtersDefaultValue.selectedSourceFilter;
|
|
78
|
+
this.selectedTypeFilter =
|
|
79
|
+
this.filtersDefaultValue.selectedTypeFilter;
|
|
80
|
+
this.selectedProductFilter =
|
|
81
|
+
this.filtersDefaultValue.selectedProductFilter;
|
|
82
|
+
}
|
|
83
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
84
|
+
if (urlParams.toString()) {
|
|
85
|
+
if (urlParams.has("source")) {
|
|
86
|
+
this.selectedSourceFilter = urlParams.getAll("source");
|
|
87
|
+
}
|
|
88
|
+
if (urlParams.has("type")) {
|
|
89
|
+
this.selectedTypeFilter = urlParams.getAll("type");
|
|
90
|
+
}
|
|
91
|
+
if (urlParams.get("service")) {
|
|
92
|
+
this.selectedProductFilter = urlParams
|
|
93
|
+
.get("service")
|
|
94
|
+
.split(",");
|
|
95
|
+
}
|
|
96
|
+
if (urlParams.get("filter_text")) {
|
|
97
|
+
this.searchTerm = (
|
|
98
|
+
urlParams.get("filter_text") || ""
|
|
99
|
+
).toLowerCase();
|
|
100
|
+
}
|
|
101
|
+
if (urlParams.has("page")) {
|
|
102
|
+
page = urlParams.get("page");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
this.calculatePagination(page, true);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
disconnectedCallback(): void {
|
|
109
|
+
this.matchDesktop.removeEventListener("change", this.handleView);
|
|
110
|
+
this.matchMobile.removeEventListener("change", this.handleView);
|
|
111
|
+
this.matchMobileSmall.removeEventListener("change", this.handleView);
|
|
112
|
+
window.removeEventListener("popstate", this.handleURLStateChange);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@api
|
|
116
|
+
set featuredCodeSample(value: string) {
|
|
117
|
+
this._featuredCodeSample = JSON.parse(value);
|
|
118
|
+
}
|
|
119
|
+
get featuredCodeSample(): CodeSample {
|
|
120
|
+
return this._featuredCodeSample;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@api
|
|
124
|
+
set samples(value: string) {
|
|
125
|
+
const jsonSamples = JSON.parse(value) || [];
|
|
126
|
+
this._samplesList = jsonSamples.map((sample, i) => ({
|
|
127
|
+
id: i,
|
|
128
|
+
title: sample.title,
|
|
129
|
+
body: sample.body,
|
|
130
|
+
buttonText: DEFAULT_BUTTON_TEXT,
|
|
131
|
+
href: sample.href,
|
|
132
|
+
imgSrc: sample.imgSrc,
|
|
133
|
+
product: sample.product,
|
|
134
|
+
type: sample.type,
|
|
135
|
+
// source: sample.source,
|
|
136
|
+
source: "none",
|
|
137
|
+
target: this.target
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
get samples(): CodeSample[] {
|
|
142
|
+
return this._samplesList;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@api
|
|
146
|
+
set products(value: string) {
|
|
147
|
+
const productsFilters = JSON.parse(value).map((sample: string) => ({
|
|
148
|
+
label: sample,
|
|
149
|
+
value: sample.toLowerCase()
|
|
150
|
+
}));
|
|
151
|
+
|
|
152
|
+
this._productFiltersList = orderBy(
|
|
153
|
+
uniqBy([...productsFilters], "value"),
|
|
154
|
+
["value"],
|
|
155
|
+
["asc"]
|
|
156
|
+
);
|
|
157
|
+
this.selectedProductFilter = this._productFiltersList.map(
|
|
158
|
+
(filter) => filter.value
|
|
159
|
+
);
|
|
160
|
+
this.filtersDefaultValue.selectedProductFilter = cloneDeep(
|
|
161
|
+
this.selectedProductFilter
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
get products(): DropdownItem[] {
|
|
165
|
+
return this._productFiltersList;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@api
|
|
169
|
+
set types(value: string) {
|
|
170
|
+
const typesFilter = JSON.parse(value).map((sample: string) => ({
|
|
171
|
+
label: sample,
|
|
172
|
+
value: sample.toLowerCase()
|
|
173
|
+
}));
|
|
174
|
+
|
|
175
|
+
this._typesFiltersList = orderBy(
|
|
176
|
+
uniqBy([...typesFilter], "value"),
|
|
177
|
+
["value"],
|
|
178
|
+
["asc"]
|
|
179
|
+
);
|
|
180
|
+
this.selectedTypeFilter = this._typesFiltersList.map(
|
|
181
|
+
(filter) => filter.value
|
|
182
|
+
);
|
|
183
|
+
this.filtersDefaultValue.selectedTypeFilter = cloneDeep(
|
|
184
|
+
this.selectedTypeFilter
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
get types(): DropdownItem[] {
|
|
188
|
+
return this._typesFiltersList;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@api
|
|
192
|
+
set sources(value: string) {
|
|
193
|
+
const parsedValues = JSON.parse(value);
|
|
194
|
+
this.showSourcesFilter = parsedValues.length > 0;
|
|
195
|
+
const sourcesFilter = parsedValues.map((sample: string) => ({
|
|
196
|
+
label: sample,
|
|
197
|
+
value: sample.toLowerCase()
|
|
198
|
+
}));
|
|
199
|
+
|
|
200
|
+
this._sourceFiltersList = orderBy(
|
|
201
|
+
uniqBy([...sourcesFilter], "value"),
|
|
202
|
+
["value"],
|
|
203
|
+
["asc"]
|
|
204
|
+
);
|
|
205
|
+
this.selectedSourceFilter = this._sourceFiltersList.map(
|
|
206
|
+
(filter) => filter.value
|
|
207
|
+
);
|
|
208
|
+
this.filtersDefaultValue.selectedSourceFilter = cloneDeep(
|
|
209
|
+
this.selectedSourceFilter
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
get sources(): DropdownItem[] {
|
|
213
|
+
return this._sourceFiltersList;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
get filteredSamples(): CodeSample[] {
|
|
217
|
+
return this.filterSamples([...this.samples]);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
get currentPageSamples(): DocsTile[] {
|
|
221
|
+
return this.filteredSamples.slice(
|
|
222
|
+
this.startingRecord - 1,
|
|
223
|
+
this.endingRecord
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
get typesList(): DropdownItem[] {
|
|
228
|
+
return this._typesFiltersList || [];
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
get productFiltersList(): DropdownItem[] {
|
|
232
|
+
return this._productFiltersList || [];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
get showEmptyState(): boolean {
|
|
236
|
+
return !this.filteredSamples.length;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
get typeFilterLabel(): string {
|
|
240
|
+
const selectedLanguage = this.typesList.find(
|
|
241
|
+
(language) => language.value === this.selectedTypeFilter
|
|
242
|
+
);
|
|
243
|
+
const label = selectedLanguage && selectedLanguage.label;
|
|
244
|
+
return label || LANGUAGE_FILTER_LABEL;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
get tileColumns(): string {
|
|
248
|
+
return this.deviceType === "desktop" ? "three" : "two";
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
get pagesToShow(): number {
|
|
252
|
+
return this.deviceType === "mobile-small" ? 3 : 5;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
get hidePagination(): boolean {
|
|
256
|
+
return this.totalPages < 2;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
get emptyStateSubtitle(): string {
|
|
260
|
+
return (
|
|
261
|
+
"No results" +
|
|
262
|
+
(this.searchTerm !== "" ? ` for "${this.searchTerm}"` : "")
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
handleView = (e: MediaQueryListEvent | MediaQueryList): void => {
|
|
267
|
+
if (e.media === this.isDesktop && e.matches) {
|
|
268
|
+
this.deviceType = "desktop";
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (e.media === this.isMobile && e.matches) {
|
|
273
|
+
this.deviceType = "mobile";
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (e.media === this.isMobileSmall && e.matches) {
|
|
278
|
+
this.deviceType = "mobile-small";
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
goToPage(e: CustomEvent): void {
|
|
283
|
+
const page = e.detail;
|
|
284
|
+
this.displayRecordsPerPage(page);
|
|
285
|
+
this.setSearchParams("page", page ? page.toString() : "1");
|
|
286
|
+
this.scrollToTop();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
displayRecordsPerPage(page: number): void {
|
|
290
|
+
this.page = page;
|
|
291
|
+
this.startingRecord =
|
|
292
|
+
page === 1 ? page : (page - 1) * this.pageSize + 1;
|
|
293
|
+
this.endingRecord = this.pageSize * page;
|
|
294
|
+
this.endingRecord =
|
|
295
|
+
this.endingRecord > this.totalRecountCount
|
|
296
|
+
? this.totalRecountCount
|
|
297
|
+
: this.endingRecord;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
handleSearchChange(event: CustomEvent): void {
|
|
301
|
+
const value = event.detail;
|
|
302
|
+
this.searchTerm = value.toLowerCase();
|
|
303
|
+
window.clearTimeout(this._searchTimeout);
|
|
304
|
+
this._searchTimeout = window.setTimeout(() => {
|
|
305
|
+
this.calculatePagination();
|
|
306
|
+
}, WAIT_TIME);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
handleSourceFilterChange(event: CustomEvent): void {
|
|
310
|
+
this.selectedSourceFilter = event.detail.value;
|
|
311
|
+
this.calculatePagination();
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
handleTypeFilterChange(event: CustomEvent): void {
|
|
315
|
+
this.selectedTypeFilter = event.detail.value;
|
|
316
|
+
this.calculatePagination();
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
handleProductFilterChange(event: CustomEvent): void {
|
|
320
|
+
if (event.detail.checkedValue === PRODUCT_FILTER_ALL_PRODUCTS) {
|
|
321
|
+
if (event.detail.checked) {
|
|
322
|
+
this.selectedProductFilter = this.productFiltersList.map(
|
|
323
|
+
(filter) => filter.value
|
|
324
|
+
);
|
|
325
|
+
} else {
|
|
326
|
+
this.selectedProductFilter = [];
|
|
327
|
+
}
|
|
328
|
+
} else {
|
|
329
|
+
let newList = event.detail.value;
|
|
330
|
+
if (!event.detail.checked) {
|
|
331
|
+
newList = newList.filter(
|
|
332
|
+
(val) => val !== PRODUCT_FILTER_ALL_PRODUCTS
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
this.selectedProductFilter = newList;
|
|
336
|
+
}
|
|
337
|
+
this.calculatePagination();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
handleLanguageFilterChange(event: CustomEvent): void {
|
|
341
|
+
this.selectedTypeFilter = event.detail.value;
|
|
342
|
+
this.setSearchParams("type", this.selectedTypeFilter);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
filterSamples(samples: CodeSample[]): CodeSample[] {
|
|
346
|
+
const filtered = samples
|
|
347
|
+
.filter((contentItem) => {
|
|
348
|
+
const matchesSearchTerm =
|
|
349
|
+
contentItem.body.toLowerCase().includes(this.searchTerm) ||
|
|
350
|
+
contentItem.title.toLowerCase().includes(this.searchTerm);
|
|
351
|
+
const matchesProductFilters =
|
|
352
|
+
!this.selectedProductFilter ||
|
|
353
|
+
!this.selectedProductFilter.length ||
|
|
354
|
+
this.selectedProductFilter.includes(
|
|
355
|
+
PRODUCT_FILTER_ALL_PRODUCTS
|
|
356
|
+
) ||
|
|
357
|
+
(typeof contentItem.product === "string" &&
|
|
358
|
+
this.selectedProductFilter.includes(
|
|
359
|
+
contentItem.product.toLowerCase()
|
|
360
|
+
));
|
|
361
|
+
const matchesTypeFilters =
|
|
362
|
+
!this.selectedTypeFilter ||
|
|
363
|
+
!this.selectedTypeFilter.length ||
|
|
364
|
+
(typeof contentItem.type === "string" &&
|
|
365
|
+
this.selectedTypeFilter.includes(
|
|
366
|
+
contentItem.type.toLowerCase()
|
|
367
|
+
));
|
|
368
|
+
const matchesSourceFilters =
|
|
369
|
+
!this.selectedSourceFilter ||
|
|
370
|
+
!this.selectedSourceFilter.length ||
|
|
371
|
+
(typeof contentItem.source === "string" &&
|
|
372
|
+
this.selectedSourceFilter.includes(
|
|
373
|
+
contentItem.source.toLowerCase()
|
|
374
|
+
));
|
|
375
|
+
|
|
376
|
+
return (
|
|
377
|
+
matchesSearchTerm &&
|
|
378
|
+
matchesProductFilters &&
|
|
379
|
+
matchesTypeFilters &&
|
|
380
|
+
matchesSourceFilters
|
|
381
|
+
);
|
|
382
|
+
})
|
|
383
|
+
.sort((a: CodeSample, b: CodeSample) => {
|
|
384
|
+
return a.title.localeCompare(b.title);
|
|
385
|
+
});
|
|
386
|
+
return filtered;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
calculatePagination(page?: string, skipSetSearchParams = false): void {
|
|
390
|
+
this.page = +parseInt(page, 10) || 1;
|
|
391
|
+
this.totalRecountCount = this.filteredSamples.length;
|
|
392
|
+
this.totalPages = Math.ceil(this.totalRecountCount / this.pageSize);
|
|
393
|
+
this.displayRecordsPerPage(this.page);
|
|
394
|
+
if (!skipSetSearchParams) {
|
|
395
|
+
this.setSearchParams();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
scrollToTop(): void {
|
|
400
|
+
this.template
|
|
401
|
+
.querySelector(".docs-grid-container")
|
|
402
|
+
.scrollIntoView({ behavior: "smooth" });
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
setSearchParams(key?: string, val?: string[]): void {
|
|
406
|
+
const service =
|
|
407
|
+
this.selectedProductFilter.length === this.productFiltersList.length
|
|
408
|
+
? ""
|
|
409
|
+
: this.selectedProductFilter.join(",");
|
|
410
|
+
const params = {
|
|
411
|
+
filter_text: this.searchTerm,
|
|
412
|
+
service,
|
|
413
|
+
type: this.selectedTypeFilter,
|
|
414
|
+
page: this.page.toString(),
|
|
415
|
+
source: this.selectedSourceFilter
|
|
416
|
+
};
|
|
417
|
+
if (key) {
|
|
418
|
+
params[key] = key === "service" ? val.join(",") : val;
|
|
419
|
+
}
|
|
420
|
+
for (const _key in params) {
|
|
421
|
+
if (!params[_key]) {
|
|
422
|
+
delete params[_key];
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
const searchParams = qs.stringify(params);
|
|
426
|
+
const newurl = `${window.location.pathname}?${searchParams}`;
|
|
427
|
+
window.history.pushState({ path: newurl }, "", newurl);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LightningElement } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import { getArchivePosts, getArchiveFilterList } from "./utils";
|
|
4
|
-
import { sortSplittedPostsByMonth } from "
|
|
4
|
+
import { sortSplittedPostsByMonth } from "dxUtils/dates";
|
|
5
5
|
import { Filters } from "./contentArchive.types";
|
|
6
|
-
import { QueryCoordinator } from "
|
|
6
|
+
import { QueryCoordinator } from "dxUtils/queryCoordinator";
|
|
7
7
|
|
|
8
8
|
const MOBILE_MATCH = "767px";
|
|
9
9
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
form {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dx-input {
|
|
11
|
+
--dx-c-input-width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
dx-input,
|
|
15
|
+
dx-select {
|
|
16
|
+
display: block;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 80px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
span {
|
|
22
|
+
font-size: var(--dx-g-text-sm);
|
|
23
|
+
line-height: var(--dx-g-text-lg);
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
dx-checkbox,
|
|
28
|
+
:not(dx-checkbox) > span {
|
|
29
|
+
margin-bottom: var(--dx-g-spacing-lg);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
span a {
|
|
33
|
+
text-decoration: none;
|
|
34
|
+
color: var(--dx-g-blue-vibrant-50);
|
|
35
|
+
transition: var(--dx-g-transition-hue-1x);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
span a:hover {
|
|
39
|
+
color: var(--dx-g-blue-vibrant-30);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
dx-input.username-field {
|
|
43
|
+
height: initial;
|
|
44
|
+
min-height: 105px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
form > .full-name-field {
|
|
48
|
+
width: calc(50% - var(--dx-g-spacing-lg) / 2);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.submit-button {
|
|
52
|
+
width: 100%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.form-submit:hover {
|
|
56
|
+
background-color: var(--dx-g-blue-vibrant-40);
|
|
57
|
+
border-color: var(--dx-g-blue-vibrant-40);
|
|
58
|
+
}
|
|
59
|
+
@media screen and (min-width: 641px) {
|
|
60
|
+
form > .full-name-field:first-of-type {
|
|
61
|
+
margin-right: var(--dx-g-spacing-lg);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media screen and (max-width: 640px) {
|
|
66
|
+
form > dx-input.full-name-field {
|
|
67
|
+
width: 100%;
|
|
68
|
+
margin-right: 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form onkeydown={handleKeyDown}>
|
|
3
|
+
<dx-input
|
|
4
|
+
class="full-name-field"
|
|
5
|
+
label="First Name"
|
|
6
|
+
missing-error-message="Enter your first name"
|
|
7
|
+
name="first_name"
|
|
8
|
+
placeholder="Your first name"
|
|
9
|
+
required
|
|
10
|
+
validity-on-blur
|
|
11
|
+
></dx-input>
|
|
12
|
+
<dx-input
|
|
13
|
+
class="full-name-field"
|
|
14
|
+
label="Last Name"
|
|
15
|
+
missing-error-message="Enter your last name"
|
|
16
|
+
name="last_name"
|
|
17
|
+
placeholder="Your last name"
|
|
18
|
+
required
|
|
19
|
+
validity-on-blur
|
|
20
|
+
></dx-input>
|
|
21
|
+
<dx-input
|
|
22
|
+
label="Email"
|
|
23
|
+
missing-error-message="Enter your email address"
|
|
24
|
+
name="email"
|
|
25
|
+
placeholder="Your email address"
|
|
26
|
+
required
|
|
27
|
+
type="email"
|
|
28
|
+
validity-on-blur
|
|
29
|
+
></dx-input>
|
|
30
|
+
<dx-select
|
|
31
|
+
label="Role"
|
|
32
|
+
message-when-value-missing="Select your job role"
|
|
33
|
+
name="job_role"
|
|
34
|
+
options={roles}
|
|
35
|
+
placeholder="Your job role"
|
|
36
|
+
required
|
|
37
|
+
value=""
|
|
38
|
+
></dx-select>
|
|
39
|
+
<dx-input
|
|
40
|
+
label="Company"
|
|
41
|
+
missing-error-message="Enter your company name"
|
|
42
|
+
name="company"
|
|
43
|
+
placeholder="Company Name"
|
|
44
|
+
required
|
|
45
|
+
validity-on-blur
|
|
46
|
+
></dx-input>
|
|
47
|
+
<dx-select
|
|
48
|
+
label="Country/Region"
|
|
49
|
+
message-when-value-missing="Select your country/region"
|
|
50
|
+
name="country"
|
|
51
|
+
options={countries}
|
|
52
|
+
placeholder="Select Country/Region"
|
|
53
|
+
required
|
|
54
|
+
value=""
|
|
55
|
+
onchange={handleCountryChange}
|
|
56
|
+
></dx-select>
|
|
57
|
+
<dx-input
|
|
58
|
+
label="Postal Code"
|
|
59
|
+
missing-error-message="Enter your postal code"
|
|
60
|
+
name="postal_code"
|
|
61
|
+
placeholder="Your postal code"
|
|
62
|
+
required
|
|
63
|
+
validity-on-blur
|
|
64
|
+
></dx-input>
|
|
65
|
+
<dx-input
|
|
66
|
+
class="username-field"
|
|
67
|
+
missing-error-message="Create a user name"
|
|
68
|
+
error-message={usernameError}
|
|
69
|
+
format-error-message='Enter a unique username. Your username must be in the form of an email address, but does not have to be a real email address. We suggest "name@yourcompany." It must be unique and not associated with another Salesforce login credential.'
|
|
70
|
+
label="Username"
|
|
71
|
+
name="username"
|
|
72
|
+
placeholder="Ex. name@yourcompany.com"
|
|
73
|
+
required
|
|
74
|
+
type="email"
|
|
75
|
+
validity-on-blur={checkUsernameValidity}
|
|
76
|
+
onchange={handleUsernameChange}
|
|
77
|
+
></dx-input>
|
|
78
|
+
<dx-checkbox if:true={showMarketingField} name="opt_in" value="explicit">
|
|
79
|
+
<span lwc:dom="manual" class="marketing-terms"></span>
|
|
80
|
+
</dx-checkbox>
|
|
81
|
+
<dx-checkbox if:true={showLegalCheckbox} required name="eula" value="accepted">
|
|
82
|
+
<span lwc:dom="manual" class="legal-terms"></span>
|
|
83
|
+
<span if:true={learnMore} lwc:dom="manual" class="learn-more"></span>
|
|
84
|
+
</dx-checkbox>
|
|
85
|
+
<template if:false={showLegalCheckbox}>
|
|
86
|
+
<span lwc:dom="manual" class="legal-terms"></span>
|
|
87
|
+
<span if:true={learnMore} lwc:dom="manual" class="learn-more"></span>
|
|
88
|
+
</template>
|
|
89
|
+
<dx-button
|
|
90
|
+
class="submit-button"
|
|
91
|
+
disabled={disableSubmit}
|
|
92
|
+
size="large"
|
|
93
|
+
type="submit"
|
|
94
|
+
onclick={handleSubmit}
|
|
95
|
+
>
|
|
96
|
+
{buttonLabel}
|
|
97
|
+
</dx-button>
|
|
98
|
+
</form>
|
|
99
|
+
</template>
|