@social-mail/social-mail-client 1.2.546 → 1.2.548
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/content/images/svg/logo/logo-orange.svg +57 -0
- package/dist/admin/AdminAppIndex.pack.js +2 -1
- package/dist/admin/AdminAppIndex.pack.js.map +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
- package/dist/common/cache/CacheTTL.d.ts +1 -0
- package/dist/common/cache/CacheTTL.d.ts.map +1 -1
- package/dist/common/cache/CacheTTL.js +2 -1
- package/dist/common/cache/CacheTTL.js.map +1 -1
- package/dist/common/toBase36.d.ts +4 -0
- package/dist/common/toBase36.d.ts.map +1 -1
- package/dist/common/toBase36.js +33 -1
- package/dist/common/toBase36.js.map +1 -1
- package/dist/public/channel/BlogImageService.d.ts.map +1 -1
- package/dist/public/channel/BlogImageService.js +5 -2
- package/dist/public/channel/BlogImageService.js.map +1 -1
- package/dist/public/channel/BlogService.d.ts +4 -5
- package/dist/public/channel/BlogService.d.ts.map +1 -1
- package/dist/public/channel/BlogService.js +26 -10
- package/dist/public/channel/BlogService.js.map +1 -1
- package/dist/public/channel/ChannelMessage.d.ts +0 -12
- package/dist/public/channel/ChannelMessage.d.ts.map +1 -1
- package/dist/public/channel/ChannelMessage.js +3 -137
- package/dist/public/channel/ChannelMessage.js.map +1 -1
- package/dist/public/channel/ChannelMessageList.d.ts +0 -12
- package/dist/public/channel/ChannelMessageList.d.ts.map +1 -1
- package/dist/public/channel/ChannelMessageList.js +3 -127
- package/dist/public/channel/ChannelMessageList.js.map +1 -1
- package/dist/public/channel/ChannelView.d.ts +15 -3
- package/dist/public/channel/ChannelView.d.ts.map +1 -1
- package/dist/public/channel/ChannelView.js +169 -11
- package/dist/public/channel/ChannelView.js.map +1 -1
- package/dist/public/channel/ChannelView.pack.js +902 -884
- package/dist/public/channel/ChannelView.pack.js.map +1 -1
- package/dist/public/channel/ChannelView.pack.min.js +155 -142
- package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
- package/dist/public/channel/PostSummary.d.ts +6 -0
- package/dist/public/channel/PostSummary.d.ts.map +1 -0
- package/dist/public/channel/PostSummary.js +61 -0
- package/dist/public/channel/PostSummary.js.map +1 -0
- package/dist/public/channel/UrlService.d.ts +3 -1
- package/dist/public/channel/UrlService.d.ts.map +1 -1
- package/dist/public/channel/UrlService.js +30 -4
- package/dist/public/channel/UrlService.js.map +1 -1
- package/dist/public/channel/controls/BlogHeader.d.ts +6 -0
- package/dist/public/channel/controls/BlogHeader.d.ts.map +1 -0
- package/dist/public/channel/controls/BlogHeader.js +42 -0
- package/dist/public/channel/controls/BlogHeader.js.map +1 -0
- package/dist/public/channel/controls/PostList.d.ts.map +1 -1
- package/dist/public/channel/controls/PostList.js +32 -9
- package/dist/public/channel/controls/PostList.js.map +1 -1
- package/dist/public/channel/controls/TagCloud.d.ts.map +1 -1
- package/dist/public/channel/controls/TagCloud.js +18 -5
- package/dist/public/channel/controls/TagCloud.js.map +1 -1
- package/dist/public/channel/styles/channelViewStyle.d.ts.map +1 -1
- package/dist/public/channel/styles/channelViewStyle.js +28 -16
- package/dist/public/channel/styles/channelViewStyle.js.map +1 -1
- package/dist/public/store/Store.pack.js +33 -1
- package/dist/public/store/Store.pack.js.map +1 -1
- package/dist/public/store/Store.pack.min.js +1 -1
- package/dist/public/store/Store.pack.min.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/AppIndex.pack.js +2 -1
- package/dist/web/AppIndex.pack.js.map +1 -1
- package/dist/web/AppIndex.pack.min.js +1 -1
- package/dist/web/AppIndex.pack.min.js.map +1 -1
- package/package.json +1 -1
- package/src/common/cache/CacheTTL.ts +2 -1
- package/src/common/toBase36.ts +36 -0
- package/src/public/channel/BlogImageService.ts +3 -0
- package/src/public/channel/BlogService.ts +19 -5
- package/src/public/channel/ChannelMessage.tsx +113 -117
- package/src/public/channel/ChannelMessageList.tsx +110 -106
- package/src/public/channel/ChannelView.tsx +153 -7
- package/src/public/channel/PostSummary.tsx +46 -0
- package/src/public/channel/UrlService.ts +23 -4
- package/src/public/channel/controls/BlogHeader.tsx +29 -0
- package/src/public/channel/controls/PostList.tsx +32 -5
- package/src/public/channel/controls/TagCloud.tsx +18 -4
- package/src/public/channel/styles/channelViewStyle.ts +28 -16
package/package.json
CHANGED
package/src/common/toBase36.ts
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
1
|
export const toBase36 = (n: any) => BigInt(n).toString(36);
|
|
2
2
|
|
|
3
3
|
declare let BigInt: (a: any) => number;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const parseBigInt = (numberString, throwOnFail = true) => {
|
|
7
|
+
if (!numberString) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (numberString.startsWith("$")) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const keySpace = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
14
|
+
let result = BigInt(0);
|
|
15
|
+
const keySpaceLength = BigInt(keySpace.length);
|
|
16
|
+
for (const iterator of numberString) {
|
|
17
|
+
const value = keySpace.indexOf(iterator);
|
|
18
|
+
if (value === -1) {
|
|
19
|
+
if (throwOnFail) {
|
|
20
|
+
throw new Error("invalid string");
|
|
21
|
+
}
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
result = result * keySpaceLength + BigInt(value);
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export class Base36 {
|
|
30
|
+
|
|
31
|
+
static encode(n: number | bigint) {
|
|
32
|
+
return BigInt(n).toString(36);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static decode(n: string, throwOnFail = true) {
|
|
36
|
+
// pg might not accept bigint
|
|
37
|
+
return parseBigInt(n, throwOnFail)?.toString();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -5,6 +5,7 @@ import { Sql } from "../../common/Sql";
|
|
|
5
5
|
import { IMailboxEmail, AppFile, IEmail } from "../../model/model";
|
|
6
6
|
import { CacheTTL } from "../../common/cache/CacheTTL";
|
|
7
7
|
import { apiPath } from "../../common/apiPath";
|
|
8
|
+
import orangeLogo from "@social-mail/social-mail-client/content/images/svg/logo/logo-orange.svg";
|
|
8
9
|
|
|
9
10
|
const cacheVersion = "1a";
|
|
10
11
|
|
|
@@ -30,5 +31,7 @@ export default class BlogImageService {
|
|
|
30
31
|
if (file) {
|
|
31
32
|
return apiPath(`/api/channel/file/webp(100)/${channelID}/${email.emailID}/${file.appFileID}/${file.name}/${file.name}.100.webp`);
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
return orangeLogo;
|
|
33
36
|
}
|
|
34
37
|
}
|
|
@@ -8,11 +8,14 @@ import EmailContentDownloader from "../../services/email/EmailContentDownloader"
|
|
|
8
8
|
import EngagementService from "../../web/page/mails/service/EngagementService";
|
|
9
9
|
import SocialMailApp from "../../common/SocialMailApp";
|
|
10
10
|
import { apiPath } from "../../common/apiPath";
|
|
11
|
+
import { CacheTTL } from "../../common/cache/CacheTTL";
|
|
12
|
+
|
|
13
|
+
const cacheVersion = "1a";
|
|
11
14
|
|
|
12
15
|
const updateAttachments = (channelID, email: IEmail) => {
|
|
13
16
|
if (email.attachments) {
|
|
14
17
|
for (const iterator of email.attachments) {
|
|
15
|
-
iterator.url = apiPath(`/api/
|
|
18
|
+
iterator.url = apiPath(`/api/channel/file/view/${channelID}/${email.emailID}/${iterator.appFileID}/${iterator.name}`);
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
};
|
|
@@ -55,6 +58,8 @@ export default class BlogService {
|
|
|
55
58
|
async getEmails({
|
|
56
59
|
channelID = 0,
|
|
57
60
|
parentID = 0,
|
|
61
|
+
authorID = 0,
|
|
62
|
+
tagID = 0,
|
|
58
63
|
search = "",
|
|
59
64
|
start = 0,
|
|
60
65
|
size = 10,
|
|
@@ -70,23 +75,29 @@ export default class BlogService {
|
|
|
70
75
|
if (search) {
|
|
71
76
|
q = q.where({ search }, (p) => (x) => Sql.text.includes(x.email.textBody, p.search));
|
|
72
77
|
}
|
|
78
|
+
if (tagID) {
|
|
79
|
+
q = q.where({ tagID }, (p) => (x) => x.email.emailTags.some((t) => t.tagID === p.tagID));
|
|
80
|
+
}
|
|
81
|
+
if (authorID) {
|
|
82
|
+
q = q.where({ authorID }, (p) => (x) => x.email.senderID === p.authorID);
|
|
83
|
+
}
|
|
73
84
|
const mailboxEmails = await q
|
|
74
85
|
.include((x) => [x.email.attachments, x.email.engagements, x.email.emailTags.forEach((t) => t.tag)])
|
|
75
86
|
.orderByDescending((x) => x.dateUpdated)
|
|
76
87
|
.toPagedList({ start, size, cancelToken });
|
|
77
88
|
|
|
78
|
-
const emails = { items: mailboxEmails.items.map((x) => x.email), total: mailboxEmails.total };
|
|
89
|
+
// const emails = { items: mailboxEmails.items.map((x) => x.email), total: mailboxEmails.total };
|
|
79
90
|
|
|
80
91
|
const tasks = [];
|
|
81
92
|
|
|
82
|
-
for (const email of
|
|
93
|
+
for (const { email } of mailboxEmails.items) {
|
|
83
94
|
tasks.push(this.downloader.downloadFromUrl(
|
|
84
95
|
apiPath(`/api/emails/channel/content/html/${channelID}/${email.emailID}/${email.headerMessageID}`)
|
|
85
96
|
, email));
|
|
86
97
|
updateAttachments(channelID, email);
|
|
87
98
|
}
|
|
88
99
|
await Promise.all(tasks);
|
|
89
|
-
return
|
|
100
|
+
return mailboxEmails;
|
|
90
101
|
}
|
|
91
102
|
|
|
92
103
|
async getChannel(emailAddress?: any,channelID?, d?) {
|
|
@@ -98,7 +109,10 @@ export default class BlogService {
|
|
|
98
109
|
const c = await q
|
|
99
110
|
.include((x) => x.emailAddress)
|
|
100
111
|
.orderByDescending((x) => x.datePublished)
|
|
101
|
-
.firstOrDefault(
|
|
112
|
+
.firstOrDefault({
|
|
113
|
+
cacheVersion,
|
|
114
|
+
cacheSeconds: CacheTTL.seconds.oneHour
|
|
115
|
+
});
|
|
102
116
|
return c;
|
|
103
117
|
}
|
|
104
118
|
|
|
@@ -1,117 +1,113 @@
|
|
|
1
|
-
import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
|
|
2
|
-
import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
|
|
3
|
-
import BlogService from "./BlogService";
|
|
4
|
-
import XNode from "@web-atoms/core/dist/core/XNode";
|
|
5
|
-
import Action from "@web-atoms/core/dist/view-model/Action";
|
|
6
|
-
import EmojiPopup from "./emoji/EmojiPopup";
|
|
7
|
-
import "./styles/channelViewStyle";
|
|
8
|
-
import PopupService from "@web-atoms/core/dist/web/services/PopupService";
|
|
9
|
-
import { IEmail, IMailbox } from "../../model/model";
|
|
10
|
-
import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
|
|
11
|
-
import PostView from "./PostView";
|
|
12
|
-
import CopyIcon from "../../common/controls/buttons/CopyIcon";
|
|
13
|
-
import TagCloud from "./controls/TagCloud";
|
|
14
|
-
import PopularPosts from "./controls/PostList";
|
|
15
|
-
import RecentPosts from "./controls/RecentPosts";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
}
|
|
1
|
+
// import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
|
|
2
|
+
// import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
|
|
3
|
+
// import BlogService from "./BlogService";
|
|
4
|
+
// import XNode from "@web-atoms/core/dist/core/XNode";
|
|
5
|
+
// import Action from "@web-atoms/core/dist/view-model/Action";
|
|
6
|
+
// import EmojiPopup from "./emoji/EmojiPopup";
|
|
7
|
+
// import "./styles/channelViewStyle";
|
|
8
|
+
// import PopupService from "@web-atoms/core/dist/web/services/PopupService";
|
|
9
|
+
// import { IEmail, IMailbox } from "../../model/model";
|
|
10
|
+
// import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
|
|
11
|
+
// import PostView from "./PostView";
|
|
12
|
+
// import CopyIcon from "../../common/controls/buttons/CopyIcon";
|
|
13
|
+
// import TagCloud from "./controls/TagCloud";
|
|
14
|
+
// import PopularPosts from "./controls/PostList";
|
|
15
|
+
// import RecentPosts from "./controls/RecentPosts";
|
|
16
|
+
// import BlogHeader from "./controls/BlogHeader";
|
|
17
|
+
|
|
18
|
+
// const url = (window as any).pageUrl as URL ?? new URL(location.href);
|
|
19
|
+
|
|
20
|
+
// let {1: channelID = url.searchParams.get("cid") , 2: emailID = url.searchParams.get("eid") } = /^\/channels\/([^\/]+)\/([^\/]+)\//.exec(url?.pathname) ?? {} as any;
|
|
21
|
+
|
|
22
|
+
// channelID = parseInt(channelID, 36);
|
|
23
|
+
// emailID = parseInt(emailID, 36);
|
|
24
|
+
|
|
25
|
+
// const commentIcon = "💬";
|
|
26
|
+
|
|
27
|
+
// export default class ChannelMessage extends AtomControl {
|
|
28
|
+
|
|
29
|
+
// @InjectProperty
|
|
30
|
+
// blogService: BlogService;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// private channel: IMailbox;
|
|
34
|
+
// private email: IEmail;
|
|
35
|
+
|
|
36
|
+
// constructor(app, e = document.createElement("section")) {
|
|
37
|
+
// super(app, e);
|
|
38
|
+
// this.runAfterInit(() => this.app.runAsync(() => this.init()));
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
// async init() {
|
|
42
|
+
|
|
43
|
+
// const channel = await this.blogService.getChannel(void 0, channelID, void 0);
|
|
44
|
+
// this.channel = channel;
|
|
45
|
+
|
|
46
|
+
// const email = await this.blogService.getEmail({ emailID, channelID });
|
|
47
|
+
// this.email = email;
|
|
48
|
+
|
|
49
|
+
// const engagements = email.engagements ?? [];
|
|
50
|
+
// // this.element.className = channelViewStyle;
|
|
51
|
+
// this.element.setAttribute("data-blog-list", "blog-list");
|
|
52
|
+
// this.element.setAttribute("data-layout", "flex-center");
|
|
53
|
+
// this.renderer = <section>
|
|
54
|
+
// <BlogHeader channel={channel}/>
|
|
55
|
+
// <section>
|
|
56
|
+
// <AtomRepeater
|
|
57
|
+
// items={[email]}
|
|
58
|
+
// itemRenderer={(x) => <PostView email={x} />}
|
|
59
|
+
// />
|
|
60
|
+
// </section>
|
|
61
|
+
// <aside>
|
|
62
|
+
// <TagCloud/>
|
|
63
|
+
// <PopularPosts/>
|
|
64
|
+
// <RecentPosts/>
|
|
65
|
+
// </aside>
|
|
66
|
+
// <footer></footer>
|
|
67
|
+
// </section>;
|
|
68
|
+
// }
|
|
69
|
+
|
|
70
|
+
// @Action({ onEvent: "react-email"})
|
|
71
|
+
// async reactEmail(email, ce: CustomEvent) {
|
|
72
|
+
// const { headerMessageID } = email;
|
|
73
|
+
// const emoji: string = await EmojiPopup.showControl(ce.target as any, { parentElement: ce.target as any});
|
|
74
|
+
// const { channel } = this;
|
|
75
|
+
// const subject = `${emoji}:${Number(email.emailID).toString(36)}:${headerMessageID}`;
|
|
76
|
+
// await PopupService.alert({
|
|
77
|
+
// message: <div data-layout="vertical-flex">
|
|
78
|
+
// To add your emoji to this post, email just the emoji {emoji} with given subject to the channel email address.
|
|
79
|
+
// <div>To: {channel.emailAddress.emailAddress} <CopyIcon text={channel.emailAddress.emailAddress}/> </div>
|
|
80
|
+
// <div>Subject: {subject} <CopyIcon text={subject}/></div>
|
|
81
|
+
// <div>Body: {emoji} <CopyIcon text={emoji}/></div>
|
|
82
|
+
// <br/>
|
|
83
|
+
// <div>If you have email client configured, you can click on following link.</div>
|
|
84
|
+
// <div>
|
|
85
|
+
// <a href={`mailto:${channel.emailAddress.emailAddress}?subject=${subject}&body=${emoji}&in-reply-to=${headerMessageID}`}>Email Now</a>
|
|
86
|
+
// </div>
|
|
87
|
+
// </div>,
|
|
88
|
+
// title: "Send Email"
|
|
89
|
+
// });
|
|
90
|
+
// }
|
|
91
|
+
|
|
92
|
+
// @Action({ onEvent: "reply-email"})
|
|
93
|
+
// async replyEmail(email, ce: CustomEvent) {
|
|
94
|
+
// const emoji = commentIcon;
|
|
95
|
+
// const { headerMessageID } = email;
|
|
96
|
+
// const { channel } = this;
|
|
97
|
+
// const subject = `${emoji}:${Number(email.emailID).toString(36)}:${headerMessageID}`;
|
|
98
|
+
// await PopupService.alert({
|
|
99
|
+
// message: <div data-layout="vertical-flex">
|
|
100
|
+
// To send comment to this post, email us your comment with given subject to the channel email address.
|
|
101
|
+
// <div>To: {channel.emailAddress.emailAddress} <CopyIcon text={channel.emailAddress.emailAddress}/></div>
|
|
102
|
+
// <div>Subject: {subject} <CopyIcon text={subject}/></div>
|
|
103
|
+
// <br/>
|
|
104
|
+
// <div>If you have email client configured, you can click on following link.</div>
|
|
105
|
+
// <div>
|
|
106
|
+
// <a href={`mailto:${channel.emailAddress.emailAddress}?subject=${subject}&in-reply-to=${headerMessageID}`}>Email Now</a>
|
|
107
|
+
// </div>
|
|
108
|
+
// </div>,
|
|
109
|
+
// title: "Send Email"
|
|
110
|
+
// });
|
|
111
|
+
// }
|
|
112
|
+
|
|
113
|
+
// }
|
|
@@ -1,121 +1,125 @@
|
|
|
1
|
-
import Bind from "@web-atoms/core/dist/core/Bind";
|
|
2
|
-
import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
|
|
3
|
-
import XNode from "@web-atoms/core/dist/core/XNode";
|
|
4
|
-
import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
|
|
5
|
-
import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
|
|
6
|
-
import LimitedText from "@web-atoms/web-controls/dist/basic/LimitedText";
|
|
7
|
-
import InfiniteRepeater from "../../common/controls/repeater/InfiniteRepeater";
|
|
8
|
-
import { DateFormats } from "../../common/date/DateFormats";
|
|
9
|
-
import { IMailbox, IEmail } from "../../model/model";
|
|
10
|
-
import { renderMail } from "../../web/page/mails/service/ConversationService";
|
|
11
|
-
import BlogService from "./BlogService";
|
|
12
|
-
import "./styles/channelViewStyle";
|
|
13
|
-
import { UrlService } from "./UrlService";
|
|
14
|
-
import TagCloud from "./controls/TagCloud";
|
|
15
|
-
import PopularPosts from "./controls/PostList";
|
|
16
|
-
import RecentPosts from "./controls/RecentPosts";
|
|
1
|
+
// import Bind from "@web-atoms/core/dist/core/Bind";
|
|
2
|
+
// import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
|
|
3
|
+
// import XNode from "@web-atoms/core/dist/core/XNode";
|
|
4
|
+
// import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
|
|
5
|
+
// import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
|
|
6
|
+
// import LimitedText from "@web-atoms/web-controls/dist/basic/LimitedText";
|
|
7
|
+
// import InfiniteRepeater from "../../common/controls/repeater/InfiniteRepeater";
|
|
8
|
+
// import { DateFormats } from "../../common/date/DateFormats";
|
|
9
|
+
// import { IMailbox, IEmail } from "../../model/model";
|
|
10
|
+
// import { renderMail } from "../../web/page/mails/service/ConversationService";
|
|
11
|
+
// import BlogService from "./BlogService";
|
|
12
|
+
// import "./styles/channelViewStyle";
|
|
13
|
+
// import { UrlService } from "./UrlService";
|
|
14
|
+
// import TagCloud from "./controls/TagCloud";
|
|
15
|
+
// import PopularPosts from "./controls/PostList";
|
|
16
|
+
// import RecentPosts from "./controls/RecentPosts";
|
|
17
|
+
// import BlogHeader from "./controls/BlogHeader";
|
|
17
18
|
|
|
18
|
-
export default class ChannelView extends AtomControl {
|
|
19
|
+
// export default class ChannelView extends AtomControl {
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
// @InjectProperty
|
|
22
|
+
// blogService: BlogService;
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
// search = "";
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
// channel: IMailbox;
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
// mails = [] as IEmail[];
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
// constructor(app, e = document.createElement("section")) {
|
|
31
|
+
// super(app, e);
|
|
32
|
+
// this.pushInit();
|
|
33
|
+
// }
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
// async init() {
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
// let { channelID, emailAddress, domainID } = (window as any).socialMail ?? {};
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
// let args = this.element.getAttribute("data-json-args") as any;
|
|
40
|
+
// if (args) {
|
|
41
|
+
// args = JSON.parse(args || "{}");
|
|
42
|
+
// const d = args.domainID || args.domain;
|
|
43
|
+
// if (d) {
|
|
44
|
+
// domainID = d;
|
|
45
|
+
// }
|
|
46
|
+
// const c = args.channels || args.channel;
|
|
47
|
+
// if (c) {
|
|
48
|
+
// channelID = c;
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
// this.element.setAttribute("data-blog-list", "blog-list");
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
// this.channel = await this.blogService.getChannel(emailAddress, channelID, domainID);
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
// channelID = this.channel.mailboxID;
|
|
57
|
+
// emailAddress = this.channel.emailAddress.emailAddress;
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
// this.renderer = <div data-layout="flex-center">
|
|
60
|
+
// <span text="..."/>
|
|
61
|
+
// </div>;
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
63
|
+
// // this.element.className = channelViewStyle;
|
|
64
|
+
// this.renderer = <section>
|
|
65
|
+
// <BlogHeader
|
|
66
|
+
// search={Bind.twoWaysImmediate(() => this.search)}
|
|
67
|
+
// channel={this.channel}/>
|
|
68
|
+
// {/* <header>
|
|
69
|
+
// <div styler-display="flex" styler-gap="size-default">
|
|
70
|
+
// <span text={this.channel.emailAddress.name}/>
|
|
71
|
+
// <a href={`mailto:subscribe-${this.channel.emailAddress.emailAddress}?subject=subscribe`}><button>Follow</button></a>
|
|
72
|
+
// </div>
|
|
73
|
+
// <div styler-display="flex" styler-gap="size-default">
|
|
74
|
+
// <input
|
|
75
|
+
// placeholder="Search..."
|
|
76
|
+
// value={Bind.twoWaysImmediate(() => this.search)}/>
|
|
77
|
+
// </div>
|
|
78
|
+
// </header> */}
|
|
79
|
+
// <section>
|
|
80
|
+
// <AtomRepeater
|
|
81
|
+
// items={this.mails}
|
|
82
|
+
// data-auto-scroll="false"
|
|
83
|
+
// { ... InfiniteRepeater.pagedItems((start) =>
|
|
84
|
+
// (c, e, cancelToken) =>
|
|
85
|
+
// this.blogService.getEmails({
|
|
86
|
+
// channelID: this.channel.mailboxID,
|
|
87
|
+
// start,
|
|
88
|
+
// search: this.search,
|
|
89
|
+
// cancelToken
|
|
90
|
+
// })
|
|
91
|
+
// )}
|
|
92
|
+
// itemRenderer={(email: IEmail) => {
|
|
93
|
+
// const engagements = email.engagements ?? [];
|
|
94
|
+
// return <section data-element="blog-item">
|
|
95
|
+
// <h4 data-element="title">
|
|
96
|
+
// <a href={UrlService.toBlogUrl(channelID, email.emailID, email.subject)} text={email.subject}></a>
|
|
97
|
+
// </h4>
|
|
98
|
+
// <h6 data-element="date" text={DateFormats.relative.short(email.dateSent)}/>
|
|
99
|
+
// <h5 text={email.senderName}/>
|
|
100
|
+
// <section
|
|
101
|
+
// data-element="content">
|
|
102
|
+
// <LimitedText height={200}>
|
|
103
|
+
// <section { ... renderMail({ email })}/>
|
|
104
|
+
// </LimitedText>
|
|
105
|
+
// </section>
|
|
106
|
+
// <footer>
|
|
107
|
+
// { ... engagements.map((x) =>
|
|
108
|
+
// <span
|
|
109
|
+
// title={`View all ${x.engagement} ${x.count}`}
|
|
110
|
+
// text={`${x.engagement} ${x.count}`}/>)}
|
|
111
|
+
// </footer>
|
|
112
|
+
// </section>;
|
|
113
|
+
// }}
|
|
114
|
+
// />
|
|
115
|
+
// </section>
|
|
116
|
+
// <aside>
|
|
117
|
+
// <TagCloud/>
|
|
118
|
+
// <PopularPosts/>
|
|
119
|
+
// <RecentPosts/>
|
|
120
|
+
// </aside>
|
|
121
|
+
// <footer></footer>
|
|
122
|
+
// </section>;
|
|
123
|
+
// }
|
|
120
124
|
|
|
121
|
-
}
|
|
125
|
+
// }
|