@salesforcedevs/dw-components 0.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/LICENSE +12 -0
- package/lwc.config.json +24 -0
- package/package.json +26 -0
- package/src/modules/dw/blogsGrid/blogsGrid.css +89 -0
- package/src/modules/dw/blogsGrid/blogsGrid.html +73 -0
- package/src/modules/dw/blogsGrid/blogsGrid.ts +28 -0
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.css +3 -0
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.html +16 -0
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.ts +29 -0
- package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.css +3 -0
- package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.html +12 -0
- package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +29 -0
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.css +171 -0
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.html +138 -0
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.ts +431 -0
- package/src/modules/dw/contentArchive/altData.js +3 -0
- package/src/modules/dw/contentArchive/contentArchive.css +242 -0
- package/src/modules/dw/contentArchive/contentArchive.html +340 -0
- package/src/modules/dw/contentArchive/contentArchive.ts +519 -0
- package/src/modules/dw/contentArchive/contentArchive.types.ts +98 -0
- package/src/modules/dw/contentArchive/utils.ts +193 -0
- package/src/modules/dw/deSignupForm/deSignupForm.css +75 -0
- package/src/modules/dw/deSignupForm/deSignupForm.html +117 -0
- package/src/modules/dw/deSignupForm/deSignupForm.ts +269 -0
- package/src/modules/dw/deSignupForm/submitForm.ts +93 -0
- package/src/modules/dw/docsGrid/docsGrid.css +83 -0
- package/src/modules/dw/docsGrid/docsGrid.html +89 -0
- package/src/modules/dw/docsGrid/docsGrid.ts +540 -0
- package/src/modules/dw/eventsList/eventsList.css +113 -0
- package/src/modules/dw/eventsList/eventsList.html +98 -0
- package/src/modules/dw/eventsList/eventsList.ts +192 -0
- package/src/modules/dw/instrumentation/instrumentation.html +1 -0
- package/src/modules/dw/instrumentation/instrumentation.ts +97 -0
- package/src/modules/dw/newsletterForm/newsletterForm.css +74 -0
- package/src/modules/dw/newsletterForm/newsletterForm.html +67 -0
- package/src/modules/dw/newsletterForm/newsletterForm.ts +233 -0
- package/src/modules/dw/podcastSubscription/podcastSubscription.css +91 -0
- package/src/modules/dw/podcastSubscription/podcastSubscription.html +24 -0
- package/src/modules/dw/podcastSubscription/podcastSubscription.ts +52 -0
- 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 +36 -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/slackCta/slackCta.css +47 -0
- package/src/modules/dw/slackCta/slackCta.html +17 -0
- package/src/modules/dw/slackCta/slackCta.ts +12 -0
- 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 +34 -0
- package/src/modules/dwBaseElements/postsGrid/postsGrid.ts +80 -0
- package/src/modules/dwHelpers/postsGrid/postsGrid.css +9 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LightningElement } from "lwc";
|
|
2
|
+
import { getTableData, RCG_URL } from "./getTableData";
|
|
3
|
+
import altData from "./altData";
|
|
4
|
+
|
|
5
|
+
export default class RCGTable extends LightningElement {
|
|
6
|
+
private columnData = null;
|
|
7
|
+
private rowData = null;
|
|
8
|
+
private rcgUrl = RCG_URL;
|
|
9
|
+
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
this.renderTableData();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
prependLinksWithUrl(data) {
|
|
15
|
+
return data.map((el) => {
|
|
16
|
+
return {
|
|
17
|
+
...el,
|
|
18
|
+
link: `${RCG_URL}${el.link}`
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async renderTableData() {
|
|
24
|
+
try {
|
|
25
|
+
const data = await getTableData();
|
|
26
|
+
this.columnData = data.COLUMNS;
|
|
27
|
+
this.rowData = this.prependLinksWithUrl(data.DATA);
|
|
28
|
+
} catch (err) {
|
|
29
|
+
console.log(`${err} Defaulting to alternative table data instead.`);
|
|
30
|
+
this.columnData = altData.COLUMNS;
|
|
31
|
+
this.rowData = this.prependLinksWithUrl(altData.DATA);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
|
|
4
|
+
.container {
|
|
5
|
+
background-repeat: no-repeat;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
flex-wrap: wrap;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
text-align: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.button {
|
|
15
|
+
padding: 10px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.podcast {
|
|
19
|
+
background-image: url("/assets/svg/slack-cta-podcast-background-left.svg"),
|
|
20
|
+
url("/assets/svg/slack-cta-podcast-background-right.svg");
|
|
21
|
+
background-position: 20% 0%, 80% 100%;
|
|
22
|
+
padding-top: 20px;
|
|
23
|
+
margin-top: -20px;
|
|
24
|
+
padding-bottom: var(--dx-g-spacing-2xl);
|
|
25
|
+
margin-bottom: calc(var(--dx-g-spacing-2xl) * -1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.dx-text-heading-4 {
|
|
29
|
+
font-size: var(--dx-g-text-xl);
|
|
30
|
+
max-width: 370px;
|
|
31
|
+
}
|
|
32
|
+
@media screen and (max-width: 1000px) {
|
|
33
|
+
.podcast {
|
|
34
|
+
background-position: 10% 10%, 90% 100%;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media screen and (max-width: 768px) {
|
|
39
|
+
.dx-text-heading-4 {
|
|
40
|
+
max-width: 28ex;
|
|
41
|
+
font-size: var(--dx-g-text-lg);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.podcast {
|
|
45
|
+
background-image: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class={containerClass}>
|
|
3
|
+
<h2 class="dx-text-heading-4"><slot></slot></h2>
|
|
4
|
+
|
|
5
|
+
<dx-button
|
|
6
|
+
size="small"
|
|
7
|
+
variant="secondary"
|
|
8
|
+
icon-symbol="slack"
|
|
9
|
+
icon-sprite="salesforcebrand"
|
|
10
|
+
icon-position="left"
|
|
11
|
+
href="/slack/install"
|
|
12
|
+
class="button"
|
|
13
|
+
>
|
|
14
|
+
{innerText}
|
|
15
|
+
</dx-button>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { SlackCtaBackgroundVariant } from "typings/custom";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
|
|
5
|
+
export default class SlackAdd extends LightningElement {
|
|
6
|
+
@api innerText?: string = "Add to Slack";
|
|
7
|
+
@api background?: SlackCtaBackgroundVariant;
|
|
8
|
+
|
|
9
|
+
get containerClass() {
|
|
10
|
+
return cx("container", this.background);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
@import "dxHelpers/text";
|
|
2
|
+
|
|
3
|
+
.slack-success_main {
|
|
4
|
+
background-color: var(--dx-g-indigo-vibrant-30);
|
|
5
|
+
|
|
6
|
+
/* Give this thing a circular bottom that actually goes off the page, to make a rounded look */
|
|
7
|
+
border-radius: 0 0 100% 100%;
|
|
8
|
+
left: -30%;
|
|
9
|
+
margin-bottom: 100px;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
position: relative;
|
|
12
|
+
width: 160%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.slack-success_container {
|
|
16
|
+
align-items: center;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
color: #fff;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
font-family: var(--dx-g-font-display);
|
|
22
|
+
justify-content: center;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
max-width: 100vw;
|
|
25
|
+
padding: 60px var(--dx-g-spacing-xl);
|
|
26
|
+
text-align: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.slack-success_success-message.dx-text-heading-4 {
|
|
30
|
+
color: #fff;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.slack-success_command {
|
|
34
|
+
background-color: var(--dx-g-indigo-vibrant-20);
|
|
35
|
+
border-radius: 3px;
|
|
36
|
+
display: inline-block;
|
|
37
|
+
font-family: var(--dx-g-font-mono);
|
|
38
|
+
font-size: var(--dx-g-text-sm);
|
|
39
|
+
font-weight: bold;
|
|
40
|
+
padding: 5px 10px;
|
|
41
|
+
margin: 0 5px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.slack-success_screenshot {
|
|
45
|
+
max-height: 156px;
|
|
46
|
+
padding-top: var(--dx-g-spacing-xl);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.slack-success_open-button {
|
|
50
|
+
padding-top: var(--dx-g-spacing-xl);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.slack-success_cody {
|
|
54
|
+
padding-top: var(--dx-g-spacing-4xl);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (max-width: 768px) {
|
|
58
|
+
.slack-success_main {
|
|
59
|
+
margin-bottom: 60px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.slack-success_cody {
|
|
63
|
+
max-width: 260px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="slack-success_main">
|
|
3
|
+
<div class="slack-success_container">
|
|
4
|
+
<p class="dx-text-heading-4 slack-success_success-message">
|
|
5
|
+
Success! 🎉 You've installed the Salesforce Developers app in
|
|
6
|
+
your Slack workspace.
|
|
7
|
+
</p>
|
|
8
|
+
<p class="slack-success__instruction">
|
|
9
|
+
Type
|
|
10
|
+
<span class="slack-success_command">/recent</span>
|
|
11
|
+
in Slack and select the content you'd like to like to view.
|
|
12
|
+
</p>
|
|
13
|
+
<img
|
|
14
|
+
class="slack-success_screenshot"
|
|
15
|
+
src="/assets/images/slack-recent-shortcuts.png"
|
|
16
|
+
alt="Slack screenshot showing Recent Blog Posts and Recent Podcasts shortcuts"
|
|
17
|
+
/>
|
|
18
|
+
<dx-button
|
|
19
|
+
class="slack-success_open-button"
|
|
20
|
+
href={buttonUri}
|
|
21
|
+
size="small"
|
|
22
|
+
>
|
|
23
|
+
Open Slack
|
|
24
|
+
</dx-button>
|
|
25
|
+
<img
|
|
26
|
+
class="slack-success_cody"
|
|
27
|
+
src="/assets/images/cody-cloud-slack.svg"
|
|
28
|
+
alt="Cody the Bear on a laptop below a Slack icon"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LightningElement } from "lwc";
|
|
2
|
+
|
|
3
|
+
export default class SlackSuccess extends LightningElement {
|
|
4
|
+
private buttonUri = "slack://open";
|
|
5
|
+
|
|
6
|
+
async connectedCallback(): Promise<void> {
|
|
7
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
8
|
+
const code = searchParams.get("code");
|
|
9
|
+
|
|
10
|
+
if (!code) {
|
|
11
|
+
// TODO: failure view, design pending
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const slackApiBaseUrl =
|
|
15
|
+
process.env.DSC_SLACK_API_DOMAIN ||
|
|
16
|
+
process.env.BASE_URL ||
|
|
17
|
+
"https://developer.salesforce.com";
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const response = await fetch(
|
|
21
|
+
`${slackApiBaseUrl}/slack/api/oauth?code=${code}`
|
|
22
|
+
);
|
|
23
|
+
const { url } = await response.json();
|
|
24
|
+
|
|
25
|
+
if (url) {
|
|
26
|
+
this.buttonUri = url;
|
|
27
|
+
}
|
|
28
|
+
} catch (ex) {
|
|
29
|
+
// No need to do anything other than log here; the default buttonUri should still be in
|
|
30
|
+
// place/sufficient
|
|
31
|
+
console.error(ex);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { api, LightningElement } from "lwc";
|
|
2
|
+
import { toJson } from "dxUtils/normalizers";
|
|
3
|
+
import { track } from "dxUtils/analytics";
|
|
4
|
+
import { WordpressPost, NormalizedPost } from "typings/custom";
|
|
5
|
+
|
|
6
|
+
const ANALYTICS_INFO = {
|
|
7
|
+
elementType: "link",
|
|
8
|
+
destinationType: "internal",
|
|
9
|
+
ctaClick: true
|
|
10
|
+
};
|
|
11
|
+
export abstract class PostsGrid extends LightningElement {
|
|
12
|
+
@api columns = "three";
|
|
13
|
+
@api archives = false;
|
|
14
|
+
|
|
15
|
+
_posts: Array<NormalizedPost> = [];
|
|
16
|
+
_count = 6;
|
|
17
|
+
_loadMoreAmount = 6;
|
|
18
|
+
_morePostsViewed = false;
|
|
19
|
+
|
|
20
|
+
@api
|
|
21
|
+
get posts() {
|
|
22
|
+
return this._posts;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
set posts(value) {
|
|
26
|
+
this._posts = (toJson(value) as Array<WordpressPost>).map(
|
|
27
|
+
this.normalizePost
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@api
|
|
32
|
+
get count() {
|
|
33
|
+
return this._count;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
set count(value) {
|
|
37
|
+
this._count = +value || this._count;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get postList(): Array<NormalizedPost> {
|
|
41
|
+
return this._posts.slice(0, this.count);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
onClick(e: Event): void {
|
|
45
|
+
if (!this._morePostsViewed) {
|
|
46
|
+
this._count += this._loadMoreAmount;
|
|
47
|
+
this._morePostsViewed = true;
|
|
48
|
+
track(e.target, "custEv_ctaLinkClick", {
|
|
49
|
+
...ANALYTICS_INFO,
|
|
50
|
+
clickText: "show more",
|
|
51
|
+
itemTitle: "show more"
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
track(e.target, "custEv_ctaLinkClick", {
|
|
55
|
+
...ANALYTICS_INFO,
|
|
56
|
+
clickText: "view archives",
|
|
57
|
+
itemTitle: "view archives",
|
|
58
|
+
clickUrl: "https://developer.salesforce.com/content-archive"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get morePostsViewed(): boolean {
|
|
64
|
+
return this._morePostsViewed;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get showLoadMore(): boolean {
|
|
68
|
+
return this.archives && this.hasMorePosts;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get showArchives(): boolean {
|
|
72
|
+
return this._morePostsViewed && this.archives;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get hasMorePosts(): boolean {
|
|
76
|
+
return this.count < this._posts.length && !this._morePostsViewed;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
abstract normalizePost(post: WordpressPost): NormalizedPost;
|
|
80
|
+
}
|