@salesforcedevs/dw-components 1.3.276 → 1.3.287
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 +2 -2
- package/src/modules/dw/blogsGrid/blogsGrid.css +0 -5
- package/src/modules/dw/blogsGrid/blogsGrid.html +6 -8
- package/src/modules/dw/blogsGrid/blogsGrid.ts +9 -0
- package/src/modules/dw/contentArchive/contentArchive.html +12 -0
- package/src/modules/dw/contentArchive/contentArchive.ts +24 -3
- package/src/modules/dw/contentArchive/contentArchive.types.ts +6 -1
- package/src/modules/dw/contentArchive/utils.ts +9 -3
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.ts +2 -3
- package/src/modules/dw/j2sForm/j2sForm.ts +3 -16
- package/src/modules/dw/languageSelector/languageSelector.html +1 -0
- package/src/modules/dw/languageSelector/languageSelector.ts +16 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dw-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.287",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"@types/setimmediate": "^1.0.2",
|
|
27
27
|
"setimmediate": "^1.0.5"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "7846795e360372acdc10ed88d1f3a8aa99a90aa7"
|
|
30
30
|
}
|
|
@@ -24,10 +24,6 @@ dx-section.section-reduced-padding {
|
|
|
24
24
|
line-height: 32px;
|
|
25
25
|
width: 500px;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
.box {
|
|
29
|
-
height: 162px;
|
|
30
|
-
}
|
|
31
27
|
}
|
|
32
28
|
|
|
33
29
|
@media only screen and (max-width: 640px) {
|
|
@@ -40,7 +36,6 @@ dx-section.section-reduced-padding {
|
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
.box {
|
|
43
|
-
height: 162px;
|
|
44
39
|
background-position: 0% 25%, 90% 75%;
|
|
45
40
|
}
|
|
46
41
|
}
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
<div class="subscription-box">
|
|
6
6
|
<div class="box">
|
|
7
7
|
<div class="content">
|
|
8
|
-
<h2 class="title">
|
|
9
|
-
|
|
10
|
-
podcast episodes via Slack or RSS.
|
|
11
|
-
</h2>
|
|
8
|
+
<h2 class="title">{rssTitle}</h2>
|
|
9
|
+
<p lwc:if={rssBody}>{rssBody}</p>
|
|
12
10
|
<div class="cta-container">
|
|
13
11
|
<dx-button
|
|
14
12
|
size="small"
|
|
@@ -19,7 +17,7 @@
|
|
|
19
17
|
href="/slack/install"
|
|
20
18
|
class="button"
|
|
21
19
|
>
|
|
22
|
-
|
|
20
|
+
{rssBtnOneLabel}
|
|
23
21
|
</dx-button>
|
|
24
22
|
<dx-button
|
|
25
23
|
size="small"
|
|
@@ -31,7 +29,7 @@
|
|
|
31
29
|
class="button"
|
|
32
30
|
onclick={rssOnClick}
|
|
33
31
|
>
|
|
34
|
-
|
|
32
|
+
{rssBtnTwoLabel}
|
|
35
33
|
</dx-button>
|
|
36
34
|
</div>
|
|
37
35
|
</div>
|
|
@@ -65,14 +63,14 @@
|
|
|
65
63
|
if:true={showLoadMore}
|
|
66
64
|
onclick={onClick}
|
|
67
65
|
variant="load-more"
|
|
68
|
-
text=
|
|
66
|
+
text={showMoreLabel}
|
|
69
67
|
></dx-hr>
|
|
70
68
|
<dx-hr
|
|
71
69
|
if:true={showArchives}
|
|
72
70
|
onclick={onClick}
|
|
73
71
|
variant="link"
|
|
74
72
|
href="/content-archive?content-type=Blogs"
|
|
75
|
-
text=
|
|
73
|
+
text={viewArchivesLabel}
|
|
76
74
|
></dx-hr>
|
|
77
75
|
</div>
|
|
78
76
|
</template>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { api } from "lwc";
|
|
1
2
|
import { normalizePost } from "dxUtils/normalizers";
|
|
2
3
|
import { track } from "dxUtils/analytics";
|
|
3
4
|
import { WordpressBlogPost, NormalizedPost } from "typings/custom";
|
|
@@ -13,6 +14,14 @@ const ANALYTICS_INFO = {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export default class BlogsGrid extends PostsGrid {
|
|
17
|
+
@api showMoreLabel = "SHOW MORE";
|
|
18
|
+
@api viewArchivesLabel = "VIEW ARCHIVES";
|
|
19
|
+
@api rssTitle =
|
|
20
|
+
"Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.";
|
|
21
|
+
@api rssBody?: string;
|
|
22
|
+
@api rssBtnOneLabel = "Add to Slack";
|
|
23
|
+
@api rssBtnTwoLabel = "Subscribe to RSS";
|
|
24
|
+
|
|
16
25
|
_loadMoreAmount = 21;
|
|
17
26
|
|
|
18
27
|
normalizePost(post: WordpressBlogPost): NormalizedPost {
|
|
@@ -39,6 +39,12 @@
|
|
|
39
39
|
filters-dates-loading={filtersDatesLoading}
|
|
40
40
|
onchange={handleFiltersEvent}
|
|
41
41
|
></dx-filter-menu>
|
|
42
|
+
<dx-filter-menu
|
|
43
|
+
name="languages"
|
|
44
|
+
title={languageTitle}
|
|
45
|
+
options={languagesList}
|
|
46
|
+
onchange={handleFiltersEvent}
|
|
47
|
+
></dx-filter-menu>
|
|
42
48
|
<template if:false={hideBlogFilters}>
|
|
43
49
|
<dx-filter-menu
|
|
44
50
|
name="authors"
|
|
@@ -87,6 +93,12 @@
|
|
|
87
93
|
variant="nested"
|
|
88
94
|
onchange={handleFiltersEvent}
|
|
89
95
|
></dx-filter-menu>
|
|
96
|
+
<dx-filter-menu
|
|
97
|
+
name="languages"
|
|
98
|
+
title={languageTitle}
|
|
99
|
+
options={languagesList}
|
|
100
|
+
onchange={handleFiltersEvent}
|
|
101
|
+
></dx-filter-menu>
|
|
90
102
|
<template if:false={hideBlogFilters}>
|
|
91
103
|
<dx-filter-menu
|
|
92
104
|
name="authors"
|
|
@@ -15,6 +15,7 @@ const MOBILE_MATCH = "767px";
|
|
|
15
15
|
enum FilterNames {
|
|
16
16
|
QUERY_CONTENT_FILTER = "contentType",
|
|
17
17
|
QUERY_AUTHOR_FILTER = "authors",
|
|
18
|
+
QUERY_LANGUAGE_FILTER = "language",
|
|
18
19
|
QUERY_DATES_FILTER = "dates",
|
|
19
20
|
QUERY_CATEGORIES_FILTER = "categories"
|
|
20
21
|
}
|
|
@@ -38,6 +39,7 @@ export default class ContentArchive extends LightningElement {
|
|
|
38
39
|
private postsByDate: {} = {};
|
|
39
40
|
private dateList: any[] = [];
|
|
40
41
|
private authorList: any[] = [];
|
|
42
|
+
private languagesList: any[] = [];
|
|
41
43
|
private categoryList: any[] = [];
|
|
42
44
|
|
|
43
45
|
private isMobile: boolean = false;
|
|
@@ -47,7 +49,8 @@ export default class ContentArchive extends LightningElement {
|
|
|
47
49
|
contentType: [],
|
|
48
50
|
dates: [],
|
|
49
51
|
authors: [],
|
|
50
|
-
categories: []
|
|
52
|
+
categories: [],
|
|
53
|
+
languages: []
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
private posts: any[] = [];
|
|
@@ -147,6 +150,15 @@ export default class ContentArchive extends LightningElement {
|
|
|
147
150
|
: ""
|
|
148
151
|
}`;
|
|
149
152
|
}
|
|
153
|
+
|
|
154
|
+
get languageTitle() {
|
|
155
|
+
return `Language ${
|
|
156
|
+
this.selectedFilterMenuData.languages.length > 0
|
|
157
|
+
? `(${this.selectedFilterMenuData.languages.length})`
|
|
158
|
+
: ""
|
|
159
|
+
}`;
|
|
160
|
+
}
|
|
161
|
+
|
|
150
162
|
get categoryTitle() {
|
|
151
163
|
return `Topic ${
|
|
152
164
|
this.selectedFilterMenuData.categories.length > 0
|
|
@@ -244,7 +256,8 @@ export default class ContentArchive extends LightningElement {
|
|
|
244
256
|
contentType: [...copy.contentType],
|
|
245
257
|
categories: [...copy.categories],
|
|
246
258
|
dates: [...copy.dates],
|
|
247
|
-
authors: []
|
|
259
|
+
authors: [],
|
|
260
|
+
languages: []
|
|
248
261
|
};
|
|
249
262
|
}
|
|
250
263
|
|
|
@@ -255,7 +268,8 @@ export default class ContentArchive extends LightningElement {
|
|
|
255
268
|
contentType: [{ id: 1, name: "Blogs" }],
|
|
256
269
|
categories: [...copy.categories],
|
|
257
270
|
dates: [...copy.dates],
|
|
258
|
-
authors: [...copy.authors]
|
|
271
|
+
authors: [...copy.authors],
|
|
272
|
+
languages: [...copy.languages]
|
|
259
273
|
};
|
|
260
274
|
}
|
|
261
275
|
|
|
@@ -331,6 +345,7 @@ export default class ContentArchive extends LightningElement {
|
|
|
331
345
|
contentType: [],
|
|
332
346
|
dates: [],
|
|
333
347
|
authors: [],
|
|
348
|
+
languages: [],
|
|
334
349
|
categories: []
|
|
335
350
|
};
|
|
336
351
|
|
|
@@ -340,6 +355,7 @@ export default class ContentArchive extends LightningElement {
|
|
|
340
355
|
setUrlParamValue({
|
|
341
356
|
[FilterNames.QUERY_CONTENT_FILTER]: [],
|
|
342
357
|
[FilterNames.QUERY_AUTHOR_FILTER]: [],
|
|
358
|
+
[FilterNames.QUERY_LANGUAGE_FILTER]: [],
|
|
343
359
|
[FilterNames.QUERY_CATEGORIES_FILTER]: [],
|
|
344
360
|
[FilterNames.QUERY_DATES_FILTER]: []
|
|
345
361
|
});
|
|
@@ -374,6 +390,10 @@ export default class ContentArchive extends LightningElement {
|
|
|
374
390
|
this.authorList = authors;
|
|
375
391
|
this.categoryList = categories;
|
|
376
392
|
this.filtersLoading = false;
|
|
393
|
+
this.languagesList = [
|
|
394
|
+
{ id: "english", name: "English" },
|
|
395
|
+
{ id: "japanese", name: "日本語" }
|
|
396
|
+
];
|
|
377
397
|
|
|
378
398
|
// note... this is super hacky... but necessary in order to both
|
|
379
399
|
// 1. actually filter the content
|
|
@@ -506,6 +526,7 @@ export default class ContentArchive extends LightningElement {
|
|
|
506
526
|
private updateAllFiltersFromUrl() {
|
|
507
527
|
const filters: FilterMenuData = {
|
|
508
528
|
[FilterNames.QUERY_AUTHOR_FILTER]: this.authorList,
|
|
529
|
+
[FilterNames.QUERY_LANGUAGE_FILTER]: this.languagesList,
|
|
509
530
|
[FilterNames.QUERY_DATES_FILTER]: this.dateList,
|
|
510
531
|
[FilterNames.QUERY_CATEGORIES_FILTER]: this.categoryList,
|
|
511
532
|
[FilterNames.QUERY_CONTENT_FILTER]: this.contentTypeList
|
|
@@ -13,6 +13,9 @@ export type ArchivePost = {
|
|
|
13
13
|
title: {
|
|
14
14
|
rendered: string;
|
|
15
15
|
};
|
|
16
|
+
acf: {
|
|
17
|
+
language: string;
|
|
18
|
+
};
|
|
16
19
|
type: string;
|
|
17
20
|
link: string;
|
|
18
21
|
excerpt: string;
|
|
@@ -69,7 +72,8 @@ export type FilterMenuNames =
|
|
|
69
72
|
| "contentType"
|
|
70
73
|
| "dates"
|
|
71
74
|
| "authors"
|
|
72
|
-
| "categories"
|
|
75
|
+
| "categories"
|
|
76
|
+
| "language";
|
|
73
77
|
|
|
74
78
|
export type Filters = {
|
|
75
79
|
[key in FilterMenuNames]: any[];
|
|
@@ -94,4 +98,5 @@ export type FilterMenuData = {
|
|
|
94
98
|
dates: Array<FilterMenuItem>;
|
|
95
99
|
categories: Array<FilterMenuItem>;
|
|
96
100
|
authors: Array<FilterMenuItem>;
|
|
101
|
+
language: Array<FilterMenuItem>;
|
|
97
102
|
};
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
FilterMenuItem
|
|
7
7
|
} from "./contentArchive.types";
|
|
8
8
|
import altData from "./altData.js";
|
|
9
|
+
import { normalizePostLink } from "../languageSelector/languageSelector";
|
|
9
10
|
|
|
10
11
|
let postsController: AbortController | null = null;
|
|
11
12
|
let filtersController: AbortController | null = null;
|
|
@@ -61,7 +62,7 @@ function normalizePosts(posts: Array<ArchivePost>, contentType: string) {
|
|
|
61
62
|
title: post.title.rendered,
|
|
62
63
|
date: post.date,
|
|
63
64
|
contentType: post.sitename.toLowerCase(),
|
|
64
|
-
href: post
|
|
65
|
+
href: normalizePostLink(post),
|
|
65
66
|
...(contentType === "expanded" && {
|
|
66
67
|
excerpt: post.excerpt,
|
|
67
68
|
duration: getAudioDuration(post.podcast_audio.duration),
|
|
@@ -83,7 +84,8 @@ export async function getArchivePosts({
|
|
|
83
84
|
contentType: [],
|
|
84
85
|
dates: [],
|
|
85
86
|
authors: [],
|
|
86
|
-
categories: []
|
|
87
|
+
categories: [],
|
|
88
|
+
language: []
|
|
87
89
|
}
|
|
88
90
|
}: {
|
|
89
91
|
count: number;
|
|
@@ -103,6 +105,9 @@ export async function getArchivePosts({
|
|
|
103
105
|
),
|
|
104
106
|
category: filterMenuData.categories.map(
|
|
105
107
|
(category: FilterMenuItem) => category.id
|
|
108
|
+
),
|
|
109
|
+
language: filterMenuData.language.map(
|
|
110
|
+
(language: FilterMenuItem) => language.id
|
|
106
111
|
)
|
|
107
112
|
};
|
|
108
113
|
|
|
@@ -112,6 +117,7 @@ export async function getArchivePosts({
|
|
|
112
117
|
"date",
|
|
113
118
|
"sitename",
|
|
114
119
|
"link",
|
|
120
|
+
"acf",
|
|
115
121
|
"podcast_audio",
|
|
116
122
|
"authors"
|
|
117
123
|
];
|
|
@@ -124,7 +130,7 @@ export async function getArchivePosts({
|
|
|
124
130
|
|
|
125
131
|
const query: any = {
|
|
126
132
|
...filterQuery,
|
|
127
|
-
_fields: ["id", "title", "date", "sitename", "link"],
|
|
133
|
+
_fields: ["id", "title", "date", "sitename", "link", "acf"],
|
|
128
134
|
per_page: count,
|
|
129
135
|
page
|
|
130
136
|
};
|
|
@@ -3,7 +3,6 @@ import StepSequence from "dx/stepSequence";
|
|
|
3
3
|
import { getListWithUuids } from "dxUtils/list";
|
|
4
4
|
import { toJson } from "dxUtils/normalizers";
|
|
5
5
|
import J2sCardSequenceStep from "dw/j2sCardSequenceStep";
|
|
6
|
-
import { AlertInfo } from "typings/custom";
|
|
7
6
|
|
|
8
7
|
const DRM_SUCCESS_STRING = "success";
|
|
9
8
|
|
|
@@ -19,8 +18,8 @@ export type StepDatum = {
|
|
|
19
18
|
formId?: string;
|
|
20
19
|
j2sTerms?: string;
|
|
21
20
|
notAvailableAlertInfo?: {
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
title: string;
|
|
22
|
+
body: string;
|
|
24
23
|
};
|
|
25
24
|
participatingCountryCodes?: string[];
|
|
26
25
|
salesforceEmployeeAlertInfo?: {
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { toJson } from "dxUtils/normalizers";
|
|
2
2
|
import { stateMap } from "dwUtils/forms";
|
|
3
|
-
import { DateTime } from "luxon";
|
|
4
3
|
import { api } from "lwc";
|
|
5
4
|
import debounce from "debounce";
|
|
6
5
|
import { LightningElementWithState } from "dxBaseElements/lightningElementWithState";
|
|
7
6
|
import { DrmFormData } from "dw/j2sCardSequence";
|
|
8
7
|
|
|
9
|
-
const closingTimeUSCanada = DateTime.fromISO("2024-05-09", {
|
|
10
|
-
zone: "America/Los_Angeles"
|
|
11
|
-
});
|
|
12
|
-
|
|
13
8
|
// Hard-coding for now because we can't get information about an endpoint for this
|
|
14
9
|
const tbidValidRoles = [
|
|
15
10
|
"Developer",
|
|
@@ -101,17 +96,11 @@ export default class J2sForm extends LightningElementWithState<J2sFormState> {
|
|
|
101
96
|
}
|
|
102
97
|
}
|
|
103
98
|
|
|
104
|
-
private
|
|
99
|
+
private participatingCountryCodes = ["US", "CA", "IN"];
|
|
100
|
+
private countriesWithReferralInput = ["US", "CA", "IN"];
|
|
105
101
|
private requiredFormFields: HTMLElement[] = [];
|
|
106
102
|
private showSubmitFailureAlert = false;
|
|
107
103
|
|
|
108
|
-
get participatingCountryCodes() {
|
|
109
|
-
if (DateTime.local() >= closingTimeUSCanada) {
|
|
110
|
-
return ["IN"];
|
|
111
|
-
}
|
|
112
|
-
return ["US", "CA", "IN"];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
104
|
get isNotParticipatingCountry() {
|
|
116
105
|
return !this.isParticipatingCountry(this.state.MailingCountry);
|
|
117
106
|
}
|
|
@@ -135,9 +124,7 @@ export default class J2sForm extends LightningElementWithState<J2sFormState> {
|
|
|
135
124
|
}
|
|
136
125
|
|
|
137
126
|
get notAvailableAlertInfo() {
|
|
138
|
-
return this.formMetadata.notAvailableAlertInfo
|
|
139
|
-
this.state.MailingCountry || "default"
|
|
140
|
-
];
|
|
127
|
+
return this.formMetadata.notAvailableAlertInfo;
|
|
141
128
|
}
|
|
142
129
|
|
|
143
130
|
get salesforceEmployeeAlertInfo() {
|
|
@@ -9,7 +9,19 @@ const ANALYTICS_INFO = {
|
|
|
9
9
|
|
|
10
10
|
const language_local_names_map: any = {
|
|
11
11
|
japanese: "日本語",
|
|
12
|
-
english: "
|
|
12
|
+
english: "English"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const normalizePostLink = (post: {
|
|
16
|
+
acf: { language: string };
|
|
17
|
+
link: string;
|
|
18
|
+
}) => {
|
|
19
|
+
switch (post.acf.language) {
|
|
20
|
+
case "japanese":
|
|
21
|
+
return post.link.replace("/blogs/", "/jpblogs/");
|
|
22
|
+
default:
|
|
23
|
+
return post.link;
|
|
24
|
+
}
|
|
13
25
|
};
|
|
14
26
|
|
|
15
27
|
export default class LanguageSelector extends LightningElement {
|
|
@@ -39,7 +51,8 @@ export default class LanguageSelector extends LightningElement {
|
|
|
39
51
|
const localLanguageName =
|
|
40
52
|
language_local_names_map[post.acf.language] ||
|
|
41
53
|
language_local_names_map.english;
|
|
42
|
-
this._languageMap[localLanguageName] =
|
|
54
|
+
this._languageMap[localLanguageName] =
|
|
55
|
+
normalizePostLink(post);
|
|
43
56
|
}
|
|
44
57
|
);
|
|
45
58
|
|
|
@@ -81,6 +94,6 @@ export default class LanguageSelector extends LightningElement {
|
|
|
81
94
|
}
|
|
82
95
|
|
|
83
96
|
get noTranslationsAvailable() {
|
|
84
|
-
return this.languages.length
|
|
97
|
+
return this.languages.length <= 1;
|
|
85
98
|
}
|
|
86
99
|
}
|