@salesforcedevs/dw-components 0.79.3 → 1.0.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/lwc.config.json +10 -1
- package/package.json +16 -12
- package/src/modules/dw/blogsGrid/blogsGrid.css +14 -7
- package/src/modules/dw/blogsGrid/blogsGrid.html +15 -12
- package/src/modules/dw/blogsGrid/blogsGrid.ts +23 -9
- package/src/modules/dw/browseTrials/browseTrials.css +35 -0
- package/src/modules/dw/browseTrials/browseTrials.html +86 -0
- package/src/modules/dw/browseTrials/browseTrials.ts +116 -0
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.css +2 -0
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.html +3 -3
- package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.css +2 -0
- package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.html +2 -1
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.css +85 -4
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.html +72 -110
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.ts +14 -375
- package/src/modules/dw/contentArchive/contentArchive.css +5 -4
- package/src/modules/dw/contentArchive/contentArchive.html +58 -24
- package/src/modules/dw/contentArchive/contentArchive.ts +46 -8
- package/src/modules/dw/contentArchive/contentArchive.types.ts +8 -4
- package/src/modules/dw/contentArchive/utils.ts +29 -13
- package/src/modules/dw/deSignupForm/deSignupForm.css +11 -10
- package/src/modules/dw/deSignupForm/deSignupForm.html +39 -25
- package/src/modules/dw/deSignupForm/deSignupForm.ts +205 -133
- package/src/modules/dw/deSignupForm/submitForm.ts +7 -3
- package/src/modules/dw/docsGrid/docsGrid.css +0 -1
- package/src/modules/dw/docsGrid/docsGrid.html +6 -2
- package/src/modules/dw/docsGrid/docsGrid.ts +103 -38
- package/src/modules/dw/eventsList/eventsList.css +4 -4
- package/src/modules/dw/eventsList/eventsList.html +5 -5
- package/src/modules/dw/eventsList/eventsList.ts +47 -48
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.css +14 -0
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.html +41 -0
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.ts +487 -0
- package/src/modules/dw/j2sCardSequenceStep/j2sCardSequenceStep.css +76 -0
- package/src/modules/dw/j2sCardSequenceStep/j2sCardSequenceStep.html +64 -0
- package/src/modules/dw/j2sCardSequenceStep/j2sCardSequenceStep.ts +157 -0
- package/src/modules/dw/j2sForm/j2sForm.css +65 -0
- package/src/modules/dw/j2sForm/j2sForm.html +217 -0
- package/src/modules/dw/j2sForm/j2sForm.ts +371 -0
- package/src/modules/dw/j2sForm/mockProps.ts +3102 -0
- package/src/modules/dw/languageSelector/languageSelector.css +86 -0
- package/src/modules/dw/languageSelector/languageSelector.html +36 -0
- package/src/modules/dw/languageSelector/languageSelector.ts +119 -0
- package/src/modules/dw/newsletterForm/newsletterForm.css +2 -2
- package/src/modules/dw/newsletterForm/newsletterForm.html +35 -10
- package/src/modules/dw/newsletterForm/newsletterForm.ts +107 -78
- package/src/modules/dw/podcastSubscription/podcastSubscription.css +8 -8
- package/src/modules/dw/podcastSubscription/podcastSubscription.html +2 -2
- package/src/modules/dw/podcastSubscription/podcastSubscription.ts +3 -3
- package/src/modules/dw/podcastsGrid/podcastsGrid.css +7 -0
- package/src/modules/dw/podcastsGrid/podcastsGrid.html +6 -1
- package/src/modules/dw/podcastsGrid/podcastsGrid.ts +3 -3
- package/src/modules/dw/podcastsPromo/podcastsPromo.css +14 -0
- package/src/modules/dw/podcastsPromo/podcastsPromo.html +16 -8
- package/src/modules/dw/podcastsPromo/podcastsPromo.ts +11 -2
- package/src/modules/dw/rcgTable/altData.ts +72 -9
- package/src/modules/dw/rcgTable/getTableData.ts +1 -1
- package/src/modules/dw/rcgTable/rcgTable.ts +3 -3
- package/src/modules/dw/slackCta/slackCta.css +5 -6
- package/src/modules/dw/slackCta/slackCta.html +1 -1
- package/src/modules/dw/slackSuccess/slackSuccess.css +1 -1
- package/src/modules/dw/slackSuccess/slackSuccess.html +2 -2
- package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.css +119 -0
- package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.html +192 -0
- package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.ts +148 -0
- package/src/modules/dw/videoGrid/types.ts +12 -0
- package/src/modules/dw/videoGrid/videoGrid.css +24 -0
- package/src/modules/dw/videoGrid/videoGrid.html +41 -0
- package/src/modules/dw/videoGrid/videoGrid.ts +41 -0
- package/src/modules/dw/youtubeVideoGrid/types.ts +8 -0
- package/src/modules/dw/youtubeVideoGrid/youtubeVideoGrid.css +18 -0
- package/src/modules/dw/youtubeVideoGrid/youtubeVideoGrid.html +40 -0
- package/src/modules/dw/youtubeVideoGrid/youtubeVideoGrid.ts +66 -0
- package/src/modules/dwHelpers/mobileDividers/mobileDividers.css +19 -0
- package/src/modules/dwUtils/forms/forms.ts +514 -0
- package/src/modules/{dwBaseElements → dwUtils}/postsGrid/postsGrid.ts +10 -13
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.language-selector {
|
|
2
|
+
height: 42px;
|
|
3
|
+
width: 108px;
|
|
4
|
+
margin-right: 20px;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
border: 1px solid var(--dx-g-language-picker-font-color);
|
|
7
|
+
padding-left: 16px;
|
|
8
|
+
padding-right: 16px;
|
|
9
|
+
background-color: var(--dx-g-language-picker-background-color);
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
align-items: center;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@media screen and (max-width: 480px) {
|
|
17
|
+
.language-selector {
|
|
18
|
+
width: 70px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.language-selector > span {
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
line-height: 24px;
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
color: var(--dx-g-language-picker-font-color);
|
|
27
|
+
user-select: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
dx-icon {
|
|
31
|
+
--dx-c-icon-color: var(--dx-g-language-picker-font-color);
|
|
32
|
+
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dropdown-options {
|
|
37
|
+
color: var(--dx-g-language-picker-font-color);
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
height: 140px;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
border-radius: 6px;
|
|
43
|
+
border: 1px solid var(--dx-g-language-picker-font-color);
|
|
44
|
+
background-color: var(--dx-g-language-picker-background-color);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.dropdown-options > div:first-child {
|
|
48
|
+
padding-top: 16px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.dropdown-options > div {
|
|
52
|
+
padding-left: 16px;
|
|
53
|
+
height: 41px;
|
|
54
|
+
padding-top: 8px;
|
|
55
|
+
padding-bottom: 8px;
|
|
56
|
+
font-size: 16px;
|
|
57
|
+
line-height: 24px;
|
|
58
|
+
font-weight: 400;
|
|
59
|
+
user-select: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.option {
|
|
63
|
+
color: var(--dx-g-language-picker-option-color);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.option:not(.selected) {
|
|
67
|
+
padding-left: 40px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.option:not(.selected):hover {
|
|
71
|
+
background-color: var(--dx-g-language-picker-option-hover-color);
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.selected {
|
|
76
|
+
font-weight: 700;
|
|
77
|
+
display: flex;
|
|
78
|
+
padding-left: 16px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.selected dx-icon {
|
|
82
|
+
--dx-c-icon-color: var(--dx-g-language-picker-checkmark-color);
|
|
83
|
+
|
|
84
|
+
padding-top: 5px;
|
|
85
|
+
padding-right: 5px;
|
|
86
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<dx-popover lwc:if={visible} width="140px">
|
|
3
|
+
<div class="language-selector" slot="control">
|
|
4
|
+
<span>{selectedLanguage}</span>
|
|
5
|
+
<dx-icon
|
|
6
|
+
sprite="general"
|
|
7
|
+
symbol="chevron-down"
|
|
8
|
+
size="medium"
|
|
9
|
+
></dx-icon>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="dropdown-options" slot="content">
|
|
12
|
+
<div>{placeholder}</div>
|
|
13
|
+
<template for:each={languages} for:item="option">
|
|
14
|
+
<template lwc:if={option.isSelected}>
|
|
15
|
+
<div class="option selected" key={option.value}>
|
|
16
|
+
<dx-icon
|
|
17
|
+
sprite="action"
|
|
18
|
+
symbol="approval"
|
|
19
|
+
size="medium"
|
|
20
|
+
></dx-icon>
|
|
21
|
+
<span>{option.label}</span>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
<template lwc:else>
|
|
25
|
+
<div
|
|
26
|
+
class="option"
|
|
27
|
+
key={option.value}
|
|
28
|
+
onclick={handleLanguageChange}
|
|
29
|
+
>
|
|
30
|
+
{option.label}
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
</template>
|
|
34
|
+
</div>
|
|
35
|
+
</dx-popover>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { track as trackClick } from "dxUtils/analytics";
|
|
2
|
+
import { api, LightningElement, track } from "lwc";
|
|
3
|
+
import { Option } from "typings/custom";
|
|
4
|
+
|
|
5
|
+
const ANALYTICS_INFO = {
|
|
6
|
+
element_title: "Select Language",
|
|
7
|
+
content_category: "cta"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const language_local_names_map: any = {
|
|
11
|
+
japanese: "日本語",
|
|
12
|
+
english: "English"
|
|
13
|
+
};
|
|
14
|
+
const DEFAULT = language_local_names_map.english;
|
|
15
|
+
|
|
16
|
+
interface ACF {
|
|
17
|
+
language: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface Post {
|
|
21
|
+
acf: ACF;
|
|
22
|
+
link?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const normalizePostLink = (post: Post) => {
|
|
26
|
+
switch (post.acf.language) {
|
|
27
|
+
case "japanese":
|
|
28
|
+
return post.link?.replace("/blogs/", "/jpblogs/");
|
|
29
|
+
default:
|
|
30
|
+
return post.link;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default class LanguageSelector extends LightningElement {
|
|
35
|
+
@track languages: Option[] = [];
|
|
36
|
+
selectedLanguage?: string;
|
|
37
|
+
loading = true;
|
|
38
|
+
@api postAcf!: string;
|
|
39
|
+
@api postId?: string;
|
|
40
|
+
|
|
41
|
+
_languageMap = {} as any;
|
|
42
|
+
|
|
43
|
+
generateTranslationOptions = async () => {
|
|
44
|
+
const acf = JSON.parse(this.postAcf);
|
|
45
|
+
this.selectedLanguage = this.getLanguageOrDefaultIfInvalid({ acf });
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const canonicalId = acf?.canonicalid;
|
|
49
|
+
|
|
50
|
+
const alternatePosts: any[] = await (
|
|
51
|
+
await fetch(
|
|
52
|
+
`https://developer.salesforce.com/blogs/wp-json/wp/v2/post-translations/${
|
|
53
|
+
canonicalId || this.postId
|
|
54
|
+
}`
|
|
55
|
+
)
|
|
56
|
+
).json();
|
|
57
|
+
|
|
58
|
+
Object.values(alternatePosts).forEach((post: Post) => {
|
|
59
|
+
const localLanguageName =
|
|
60
|
+
this.getLanguageOrDefaultIfInvalid(post);
|
|
61
|
+
this._languageMap[localLanguageName] = normalizePostLink(post);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
this.languages = Object.values(alternatePosts).map((post) => {
|
|
65
|
+
const language = this.getLanguageOrDefaultIfInvalid(post);
|
|
66
|
+
return {
|
|
67
|
+
id: language,
|
|
68
|
+
label: language,
|
|
69
|
+
isSelected: language === this.selectedLanguage
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
} catch (e) {
|
|
73
|
+
console.error(e);
|
|
74
|
+
} finally {
|
|
75
|
+
this.loading = false;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
private getLanguageOrDefaultIfInvalid(post: Post) {
|
|
80
|
+
return language_local_names_map[post.acf.language] || DEFAULT;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
connectedCallback() {
|
|
84
|
+
this.generateTranslationOptions();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
get visible() {
|
|
88
|
+
return !this.loading && !this.noTranslationsAvailable;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get placeholder() {
|
|
92
|
+
return this.selectedLanguage === language_local_names_map.english
|
|
93
|
+
? "Language"
|
|
94
|
+
: "言語";
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
handleLanguageChange(evt: Event): void {
|
|
98
|
+
const selectedLanguage = evt.target!.innerHTML;
|
|
99
|
+
const url = this._languageMap[selectedLanguage];
|
|
100
|
+
if (!url) {
|
|
101
|
+
console.error(
|
|
102
|
+
`URL for language picker option ${selectedLanguage} is not defined.`
|
|
103
|
+
);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
trackClick(evt.target!, "custEv_ctaButtonClick", {
|
|
107
|
+
...ANALYTICS_INFO,
|
|
108
|
+
element_type: "button",
|
|
109
|
+
click_text: selectedLanguage,
|
|
110
|
+
click_url: url
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
window.location.href = url;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
get noTranslationsAvailable() {
|
|
117
|
+
return this.languages.length <= 1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
h4 {
|
|
13
13
|
font-size: 20px;
|
|
14
|
-
margin: 0 0 28px
|
|
14
|
+
margin: 0 0 28px;
|
|
15
15
|
text-align: center;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -55,7 +55,7 @@ dx-checkbox:last-of-type {
|
|
|
55
55
|
.marketing-text,
|
|
56
56
|
.legal-text {
|
|
57
57
|
font-size: 14px;
|
|
58
|
-
margin: 0 0 16px
|
|
58
|
+
margin: 0 0 16px;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
@media screen and (max-width: 360px) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
onkeydown={handleKeyDown}
|
|
6
6
|
>
|
|
7
7
|
<slot name="form-heading">
|
|
8
|
-
<h4 class="newsletter-form-heading dx-text-
|
|
8
|
+
<h4 class="newsletter-form-heading dx-text-display-8">
|
|
9
9
|
Sign up now to receive developer updates.
|
|
10
10
|
</h4>
|
|
11
11
|
</slot>
|
|
@@ -51,16 +51,41 @@
|
|
|
51
51
|
value={country}
|
|
52
52
|
required="true"
|
|
53
53
|
></dx-select>
|
|
54
|
-
<
|
|
54
|
+
<dx-select
|
|
55
|
+
if:true={showStateSelect}
|
|
56
|
+
label="State/Province"
|
|
57
|
+
onchange={handleChange}
|
|
58
|
+
message-when-value-missing="Select your state/province"
|
|
59
|
+
name="state"
|
|
60
|
+
options={states}
|
|
61
|
+
placeholder="Select State/Province"
|
|
62
|
+
required
|
|
63
|
+
value={state}
|
|
64
|
+
></dx-select>
|
|
65
|
+
|
|
66
|
+
<template if:false={showMarketingText}>
|
|
55
67
|
<p class="marketing-text">{marketingText}</p>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
</template>
|
|
69
|
+
<template if:true={showMarketingText}>
|
|
70
|
+
<dx-checkbox
|
|
71
|
+
name="marketingCheckbox"
|
|
72
|
+
class="marketing-checkbox"
|
|
73
|
+
value="false"
|
|
74
|
+
onchange={handleChange}
|
|
75
|
+
>
|
|
76
|
+
<span>{marketingText}</span>
|
|
77
|
+
</dx-checkbox>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<template if:false={showLegalCheckbox}>
|
|
81
|
+
<p lwc:dom="manual" class="legal-checkbox legal-text"></p>
|
|
82
|
+
</template>
|
|
83
|
+
<template if:true={showLegalCheckbox}>
|
|
84
|
+
<dx-checkbox
|
|
85
|
+
class="legal-checkbox"
|
|
86
|
+
value={legalCheckbox}
|
|
87
|
+
required="true"
|
|
88
|
+
></dx-checkbox>
|
|
64
89
|
</template>
|
|
65
90
|
<button class="form-submit" type="submit">Subscribe Now</button>
|
|
66
91
|
</form>
|
|
@@ -1,51 +1,54 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import { track } from "dxUtils/analytics";
|
|
3
|
-
import { CountryOptions
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
formName: "newsletter",
|
|
8
|
-
formType: "newsletter",
|
|
9
|
-
method: "email",
|
|
10
|
-
destinationType: "internal",
|
|
11
|
-
clickText: "Subscribe Now",
|
|
12
|
-
clickUrl: "/newsletter/success",
|
|
13
|
-
elementType: "button",
|
|
14
|
-
ctaClick: true
|
|
15
|
-
};
|
|
3
|
+
import { CountryOptions } from "typings/custom";
|
|
4
|
+
import { stateMap } from "dwUtils/forms";
|
|
5
|
+
|
|
6
|
+
const LOCAL_STORAGE_KEY = "subscriberEmail";
|
|
16
7
|
|
|
17
8
|
export default class Form extends LightningElement {
|
|
18
9
|
@api checkboxTextSet: string = "";
|
|
19
10
|
@api countries: string = "";
|
|
11
|
+
@api drmDomain: string = "https://drm.my.salesforce-sites.com";
|
|
20
12
|
|
|
21
13
|
private firstName: string = "";
|
|
22
14
|
private lastName: string = "";
|
|
23
15
|
private email: string = "";
|
|
24
16
|
private country: string = "";
|
|
17
|
+
private state?: string;
|
|
18
|
+
private marketingCheckbox: string = "";
|
|
25
19
|
|
|
26
|
-
private showLegalText: boolean = false;
|
|
20
|
+
private showLegalText: boolean = false; // This should be always true
|
|
21
|
+
private showMarketingText: boolean = false;
|
|
27
22
|
private showLegalCheckbox: boolean = false;
|
|
28
23
|
private legalText: string = "";
|
|
29
24
|
private marketingText: string | null = null;
|
|
30
25
|
private hasRendered: boolean = false;
|
|
31
26
|
|
|
27
|
+
get showStateSelect(): boolean {
|
|
28
|
+
return !!(this.country && this.country in stateMap);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get states(): string[] {
|
|
32
|
+
return (stateMap[this.country as keyof typeof stateMap] as any) || [];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
connectedCallback() {
|
|
36
|
+
this.getCountryList();
|
|
37
|
+
}
|
|
38
|
+
|
|
32
39
|
renderedCallback() {
|
|
33
40
|
if (!this.hasRendered) {
|
|
34
41
|
// Focus the first input in the form
|
|
35
42
|
this.template.querySelector("dx-input")?.focus();
|
|
36
|
-
|
|
37
43
|
this.setInitialEmail();
|
|
38
44
|
this.hasRendered = true;
|
|
39
|
-
} else if (this.hasRendered
|
|
45
|
+
} else if (this.hasRendered) {
|
|
40
46
|
// Grab the legal checkbox and append the legal text as innerHTML (text has anchor links in it)
|
|
41
|
-
const legalCheckboxElement =
|
|
42
|
-
"
|
|
43
|
-
);
|
|
44
|
-
const legalCheckboxSpan = document.createElement("span");
|
|
45
|
-
this.setInnerHtml(legalCheckboxSpan, this.legalText);
|
|
47
|
+
const legalCheckboxElement =
|
|
48
|
+
this.template.querySelector(".legal-checkbox");
|
|
46
49
|
|
|
47
50
|
if (legalCheckboxElement) {
|
|
48
|
-
legalCheckboxElement.
|
|
51
|
+
this.setInnerHtml(legalCheckboxElement, this.legalText);
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
}
|
|
@@ -71,6 +74,12 @@ export default class Form extends LightningElement {
|
|
|
71
74
|
this.country = e.target.value;
|
|
72
75
|
this.handleConsent(e.target);
|
|
73
76
|
break;
|
|
77
|
+
case "state":
|
|
78
|
+
this.state = e.target.value;
|
|
79
|
+
break;
|
|
80
|
+
case "marketingCheckbox":
|
|
81
|
+
this.marketingCheckbox = e.target.checked;
|
|
82
|
+
break;
|
|
74
83
|
default:
|
|
75
84
|
break;
|
|
76
85
|
}
|
|
@@ -102,32 +111,52 @@ export default class Form extends LightningElement {
|
|
|
102
111
|
this.sendFormData();
|
|
103
112
|
}
|
|
104
113
|
}
|
|
114
|
+
async getCountryList() {
|
|
115
|
+
const errorMsg = "Error while getting county list";
|
|
105
116
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
try {
|
|
118
|
+
const res = await fetch(
|
|
119
|
+
`${this.drmDomain}/utilities/services/apexrest/countries`
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
if (!res.ok) {
|
|
123
|
+
throw new Error(errorMsg);
|
|
124
|
+
}
|
|
110
125
|
|
|
111
|
-
|
|
126
|
+
const data = await res.json();
|
|
127
|
+
// eslint-disable-next-line @lwc/lwc/no-api-reassignments
|
|
128
|
+
this.countries = JSON.stringify(data);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.error(error);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
112
133
|
|
|
134
|
+
setInitialEmail() {
|
|
135
|
+
// Set email if provided in the local storage
|
|
136
|
+
const subscriberEmail = window.localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
113
137
|
if (subscriberEmail) {
|
|
114
138
|
this.email = subscriberEmail;
|
|
139
|
+
window.localStorage.removeItem(LOCAL_STORAGE_KEY);
|
|
115
140
|
}
|
|
116
141
|
}
|
|
117
142
|
|
|
118
143
|
getFormData() {
|
|
119
144
|
const date = new Date().toISOString();
|
|
120
|
-
|
|
145
|
+
const stateData = this.state ? { MailingState: this.state } : {};
|
|
121
146
|
return {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"
|
|
130
|
-
|
|
147
|
+
InfoEmail__c:
|
|
148
|
+
(this.showMarketingText && this.marketingCheckbox) ||
|
|
149
|
+
!this.showMarketingText
|
|
150
|
+
? "True"
|
|
151
|
+
: "False", // True if the user checks the checkbox or the country is opted-out
|
|
152
|
+
FirstName: this.firstName,
|
|
153
|
+
LastName: this.lastName,
|
|
154
|
+
Consent__c: this.showMarketingText ? "Explicit" : "Implied", //Implied if the country is opted-out, Explicit if the country is opted-in
|
|
155
|
+
Email_Status_Update__c: date,
|
|
156
|
+
Email: this.email,
|
|
157
|
+
MailingCountry: this.country,
|
|
158
|
+
handlerName: "news_letter_form_handler",
|
|
159
|
+
...stateData
|
|
131
160
|
};
|
|
132
161
|
}
|
|
133
162
|
|
|
@@ -142,13 +171,13 @@ export default class Form extends LightningElement {
|
|
|
142
171
|
submitButtonEl.textContent = "...Processing request";
|
|
143
172
|
|
|
144
173
|
try {
|
|
145
|
-
const res = await fetch(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
174
|
+
const res = await fetch(
|
|
175
|
+
`${this.drmDomain}/handler/services/apexrest/handler`,
|
|
176
|
+
{
|
|
177
|
+
method: "POST",
|
|
178
|
+
body: JSON.stringify(formData)
|
|
179
|
+
}
|
|
180
|
+
);
|
|
152
181
|
|
|
153
182
|
if (!res.ok) {
|
|
154
183
|
throw new Error(errorMsg);
|
|
@@ -156,13 +185,30 @@ export default class Form extends LightningElement {
|
|
|
156
185
|
|
|
157
186
|
const data = await res.json();
|
|
158
187
|
|
|
159
|
-
if (
|
|
188
|
+
if (data.status !== "success") {
|
|
160
189
|
throw new Error(errorMsg);
|
|
161
190
|
}
|
|
162
191
|
|
|
163
192
|
// GTM event
|
|
164
|
-
track(submitButtonEl, "custEv_formCompletion",
|
|
165
|
-
|
|
193
|
+
track(submitButtonEl, "custEv_formCompletion", {
|
|
194
|
+
converting_page: "SFDC:us:newsletter:success",
|
|
195
|
+
converting_page_url:
|
|
196
|
+
"https://developer.salesforce.com/newsletter/success",
|
|
197
|
+
form_country: formData?.MailingCountry,
|
|
198
|
+
form_name: "Newsletter Signup",
|
|
199
|
+
form_primary_product_interest: "Newsletter",
|
|
200
|
+
offer_type: "Newsletter"
|
|
201
|
+
});
|
|
202
|
+
track(submitButtonEl, "custEv_linkClick", {
|
|
203
|
+
click_text: "Subscribe Now",
|
|
204
|
+
element_title: "Subscribe Now",
|
|
205
|
+
click_url: `${window.location.origin}/newsletter/success`,
|
|
206
|
+
element_type: "button",
|
|
207
|
+
content_category: "cta"
|
|
208
|
+
});
|
|
209
|
+
track(submitButtonEl, "custEv_subscribe", {
|
|
210
|
+
subscription_type: "newsletter"
|
|
211
|
+
});
|
|
166
212
|
window.location.assign("/newsletter/success");
|
|
167
213
|
} catch (error) {
|
|
168
214
|
if (submitButtonEl) {
|
|
@@ -174,54 +220,37 @@ export default class Form extends LightningElement {
|
|
|
174
220
|
}
|
|
175
221
|
|
|
176
222
|
handleConsent(countrySelectElement: any) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
223
|
+
const countryOptions = countrySelectElement.options.find(
|
|
224
|
+
(option: any) => option.value === countrySelectElement.value
|
|
225
|
+
);
|
|
181
226
|
|
|
182
|
-
|
|
183
|
-
}
|
|
227
|
+
this.setLegalAndMarketingData(countryOptions);
|
|
184
228
|
}
|
|
185
229
|
|
|
186
230
|
setLegalAndMarketingData(countryOptions: CountryOptions) {
|
|
187
|
-
// Parse the text sets for the checkbox info
|
|
188
|
-
const parsedCheckboxTextSet = JSON.parse(this.checkboxTextSet);
|
|
189
|
-
|
|
190
|
-
// Check for alternate text set or set to default
|
|
191
|
-
const checkboxTextSet = countryOptions.checkboxTextSet
|
|
192
|
-
? parsedCheckboxTextSet[countryOptions.checkboxTextSet]
|
|
193
|
-
: parsedCheckboxTextSet.default;
|
|
194
|
-
|
|
195
231
|
// Set the checkbox text
|
|
196
|
-
this.setCheckboxTextSet(
|
|
232
|
+
this.setCheckboxTextSet(
|
|
233
|
+
countryOptions.marketingText,
|
|
234
|
+
countryOptions.legalText
|
|
235
|
+
);
|
|
197
236
|
|
|
198
237
|
// Toggle visibility of legal/marketing data
|
|
199
238
|
this.toggleLegalAndMarketingVisibility(
|
|
200
|
-
countryOptions.
|
|
239
|
+
countryOptions.showMarketingText,
|
|
201
240
|
countryOptions.showLegalCheckbox
|
|
202
241
|
);
|
|
203
|
-
|
|
204
|
-
// Grab the legal text paragraph element and set inner html (this is due to text having html elements in the string)
|
|
205
|
-
const legalTextElement = this.template.querySelector(".legal-text");
|
|
206
|
-
|
|
207
|
-
if (legalTextElement && this.showLegalText) {
|
|
208
|
-
this.setInnerHtml(legalTextElement, this.legalText);
|
|
209
|
-
} else if (legalTextElement && !this.showLegalText) {
|
|
210
|
-
// Clear legal text
|
|
211
|
-
this.setInnerHtml(legalTextElement, "");
|
|
212
|
-
}
|
|
213
242
|
}
|
|
214
243
|
|
|
215
|
-
setCheckboxTextSet(
|
|
216
|
-
this.legalText =
|
|
217
|
-
this.marketingText =
|
|
244
|
+
setCheckboxTextSet(marketingText: string, legalText: string) {
|
|
245
|
+
this.legalText = legalText;
|
|
246
|
+
this.marketingText = marketingText;
|
|
218
247
|
}
|
|
219
248
|
|
|
220
249
|
toggleLegalAndMarketingVisibility(
|
|
221
|
-
|
|
250
|
+
showMarketingText: boolean,
|
|
222
251
|
showLegalCheckbox: boolean
|
|
223
252
|
) {
|
|
224
|
-
this.
|
|
253
|
+
this.showMarketingText = showMarketingText;
|
|
225
254
|
this.showLegalCheckbox = showLegalCheckbox;
|
|
226
255
|
}
|
|
227
256
|
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
background-repeat: no-repeat;
|
|
6
6
|
background-position: center;
|
|
7
7
|
display: flex;
|
|
8
|
-
flex-
|
|
9
|
-
flex-wrap: wrap;
|
|
8
|
+
flex-flow: column wrap;
|
|
10
9
|
align-items: center;
|
|
11
10
|
justify-content: center;
|
|
12
11
|
text-align: center;
|
|
@@ -14,17 +13,17 @@
|
|
|
14
13
|
|
|
15
14
|
@media screen and (max-width: 768px) {
|
|
16
15
|
.container {
|
|
17
|
-
background-image: url("/
|
|
16
|
+
background-image: url("https://a.sfdcstatic.com/developer-website/images/podcast-subscription-clouds-small.svg");
|
|
18
17
|
background-size: auto 200px;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
.dx-text-
|
|
20
|
+
.dx-text-display-6 {
|
|
22
21
|
max-width: 28ex;
|
|
23
22
|
font-size: var(--dx-g-text-lg);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
.badges {
|
|
27
|
-
margin: 8px auto 6px
|
|
26
|
+
margin: 8px auto 6px;
|
|
28
27
|
text-align: center;
|
|
29
28
|
}
|
|
30
29
|
|
|
@@ -48,7 +47,7 @@
|
|
|
48
47
|
|
|
49
48
|
@media screen and (min-width: 768px) {
|
|
50
49
|
.container {
|
|
51
|
-
background-image: url("/
|
|
50
|
+
background-image: url("https://a.sfdcstatic.com/developer-website/images/podcast-subscription-clouds.svg");
|
|
52
51
|
min-height: 230px;
|
|
53
52
|
}
|
|
54
53
|
|
|
@@ -59,7 +58,7 @@
|
|
|
59
58
|
|
|
60
59
|
.badges a {
|
|
61
60
|
display: inline-block;
|
|
62
|
-
margin: 22px 13px 8px
|
|
61
|
+
margin: 22px 13px 8px;
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
.badges img {
|
|
@@ -81,11 +80,12 @@
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
.secondary-links a {
|
|
84
|
-
color: var(--dx-
|
|
83
|
+
color: var(--dx-podcast-subscription-link-color);
|
|
85
84
|
text-decoration: none;
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
.secondary-links a:hover {
|
|
88
|
+
color: var(--dx-g-link-hover-color);
|
|
89
89
|
text-decoration: underline;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="container">
|
|
3
|
-
<h2 class="dx-text-
|
|
4
|
-
Tune in to the Salesforce Developers Podcast
|
|
3
|
+
<h2 class="dx-text-display-6">
|
|
4
|
+
Tune in to the Salesforce Developers Podcast.
|
|
5
5
|
</h2>
|
|
6
6
|
<ul class="badges">
|
|
7
7
|
<template for:each={badgeLinks} for:item="badgeLink">
|