@salesforcedevs/dw-components 1.15.0 → 1.16.2
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 +0 -1
- package/package.json +2 -2
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.html +4 -21
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.ts +7 -11
- package/src/modules/dw/slackSuccess/slackSuccess.css +0 -65
- package/src/modules/dw/slackSuccess/slackSuccess.html +0 -32
- package/src/modules/dw/slackSuccess/slackSuccess.ts +0 -34
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dw-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.2",
|
|
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.4",
|
|
27
27
|
"setimmediate": "1.0.5"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "602466e6ecec48ad5685a6bcc75c6a8aa22eb80d"
|
|
30
30
|
}
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
authors={firstPost.authors}
|
|
16
16
|
></dx-card-blog-post>
|
|
17
17
|
<dx-grid columns="one">
|
|
18
|
-
<template
|
|
18
|
+
<template
|
|
19
|
+
for:each={secondThirdAndFourth}
|
|
20
|
+
for:item="post"
|
|
21
|
+
>
|
|
19
22
|
<dx-card-blog-post
|
|
20
23
|
layout="horizontal"
|
|
21
24
|
datetime={post.datetime}
|
|
@@ -30,26 +33,6 @@
|
|
|
30
33
|
</dx-grid>
|
|
31
34
|
</dx-grid>
|
|
32
35
|
</div>
|
|
33
|
-
<dx-grid columns="four">
|
|
34
|
-
<template for:each={restOfBlogPosts} for:item="post">
|
|
35
|
-
<dx-card-blog-post
|
|
36
|
-
label="BLOG POST"
|
|
37
|
-
body={post.body}
|
|
38
|
-
datetime={post.datetime}
|
|
39
|
-
href={post.href}
|
|
40
|
-
img-alt={post.imgAlt}
|
|
41
|
-
img-src={post.imgSrc}
|
|
42
|
-
key={post.id}
|
|
43
|
-
header={post.title}
|
|
44
|
-
authors={post.authors}
|
|
45
|
-
></dx-card-blog-post>
|
|
46
|
-
<dx-hr
|
|
47
|
-
spacing="2xs"
|
|
48
|
-
class="mobile-divider_posts"
|
|
49
|
-
key={post.id}
|
|
50
|
-
></dx-hr>
|
|
51
|
-
</template>
|
|
52
|
-
</dx-grid>
|
|
53
36
|
</div>
|
|
54
37
|
|
|
55
38
|
<div class="hide-on-desktop">
|
|
@@ -17,7 +17,7 @@ type BlogPost = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export default class CardBlogPostProvider extends LightningElement {
|
|
20
|
-
@api count: string = "
|
|
20
|
+
@api count: string = "4";
|
|
21
21
|
@track _sortedPosts: BlogPost[] = [];
|
|
22
22
|
|
|
23
23
|
private _featuredPost: BlogPost | undefined;
|
|
@@ -28,7 +28,7 @@ export default class CardBlogPostProvider extends LightningElement {
|
|
|
28
28
|
if (this._featuredPost) {
|
|
29
29
|
this._sortedPosts = [
|
|
30
30
|
this._featuredPost,
|
|
31
|
-
...this.filterOutFeaturedPost(posts)
|
|
31
|
+
...this.filterOutFeaturedPost(posts, this._featuredPost)
|
|
32
32
|
];
|
|
33
33
|
} else {
|
|
34
34
|
this._sortedPosts = posts;
|
|
@@ -43,7 +43,7 @@ export default class CardBlogPostProvider extends LightningElement {
|
|
|
43
43
|
this._featuredPost = featuredPost;
|
|
44
44
|
this._sortedPosts = [
|
|
45
45
|
featuredPost,
|
|
46
|
-
...this.filterOutFeaturedPost(this._posts)
|
|
46
|
+
...this.filterOutFeaturedPost(this._posts, featuredPost)
|
|
47
47
|
];
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -56,19 +56,15 @@ export default class CardBlogPostProvider extends LightningElement {
|
|
|
56
56
|
return this._sortedPosts[0];
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
get
|
|
60
|
-
return this._sortedPosts.slice(1,
|
|
59
|
+
get secondThirdAndFourth() {
|
|
60
|
+
return this._sortedPosts.slice(1, 4);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
return this._sortedPosts.slice(3);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
private filterOutFeaturedPost(posts: BlogPost[]) {
|
|
63
|
+
private filterOutFeaturedPost(posts: BlogPost[], featuredPost: BlogPost) {
|
|
68
64
|
// the featured post + the rest must equal count
|
|
69
65
|
const countMinusOne = parseInt(this.count, 10) - 1;
|
|
70
66
|
return posts
|
|
71
|
-
.filter((post) => post.id !==
|
|
67
|
+
.filter((post) => post.id !== featuredPost.id)
|
|
72
68
|
.slice(0, countMinusOne);
|
|
73
69
|
}
|
|
74
70
|
|
|
@@ -1,65 +0,0 @@
|
|
|
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-display-6 {
|
|
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
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="slack-success_main">
|
|
3
|
-
<div class="slack-success_container">
|
|
4
|
-
<p class="dx-text-display-6 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="https://a.sfdcstatic.com/developer-website/images/cody-cloud-slack.svg"
|
|
28
|
-
alt="Cody the Bear on a laptop below a Slack icon"
|
|
29
|
-
/>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|