@social-mail/social-mail-client 1.2.98 → 1.2.99

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.
Files changed (45) hide show
  1. package/dist/admin/AdminAppIndex.pack.js.map +1 -1
  2. package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
  3. package/dist/common/controls/emoji-picker/EmojiPicker.d.ts.map +1 -1
  4. package/dist/common/controls/emoji-picker/EmojiPicker.js.map +1 -1
  5. package/dist/public/channel/BlogService.d.ts +2 -1
  6. package/dist/public/channel/BlogService.d.ts.map +1 -1
  7. package/dist/public/channel/BlogService.js +15 -5
  8. package/dist/public/channel/BlogService.js.map +1 -1
  9. package/dist/public/channel/ChannelMessage.d.ts +3 -0
  10. package/dist/public/channel/ChannelMessage.d.ts.map +1 -1
  11. package/dist/public/channel/ChannelMessage.js +59 -11
  12. package/dist/public/channel/ChannelMessage.js.map +1 -1
  13. package/dist/public/channel/ChannelMessageList.d.ts.map +1 -1
  14. package/dist/public/channel/ChannelMessageList.js +4 -4
  15. package/dist/public/channel/ChannelMessageList.js.map +1 -1
  16. package/dist/public/channel/ChannelView.d.ts.map +1 -1
  17. package/dist/public/channel/ChannelView.js +3 -66
  18. package/dist/public/channel/ChannelView.js.map +1 -1
  19. package/dist/public/channel/ChannelView.pack.js +5744 -5353
  20. package/dist/public/channel/ChannelView.pack.js.map +1 -1
  21. package/dist/public/channel/ChannelView.pack.min.js +121 -115
  22. package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
  23. package/dist/public/channel/emoji/EmojiPopup.d.ts +6 -0
  24. package/dist/public/channel/emoji/EmojiPopup.d.ts.map +1 -0
  25. package/dist/public/channel/emoji/EmojiPopup.js +37 -0
  26. package/dist/public/channel/emoji/EmojiPopup.js.map +1 -0
  27. package/dist/public/channel/styles/channelViewStyle.d.ts.map +1 -0
  28. package/dist/public/channel/styles/channelViewStyle.js +120 -0
  29. package/dist/public/channel/styles/channelViewStyle.js.map +1 -0
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/dist/web/AppIndex.pack.js.map +1 -1
  32. package/dist/web/AppIndex.pack.min.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/common/controls/emoji-picker/EmojiPicker.tsx +0 -12
  35. package/src/public/channel/BlogService.ts +13 -5
  36. package/src/public/channel/ChannelMessage.tsx +63 -11
  37. package/src/public/channel/ChannelMessageList.tsx +3 -4
  38. package/src/public/channel/ChannelView.tsx +1 -63
  39. package/src/public/channel/emoji/EmojiPopup.tsx +28 -0
  40. package/src/public/channel/styles/channelViewStyle.ts +110 -0
  41. package/dist/public/channel/channelViewStyle.d.ts.map +0 -1
  42. package/dist/public/channel/channelViewStyle.js +0 -53
  43. package/dist/public/channel/channelViewStyle.js.map +0 -1
  44. package/src/public/channel/channelViewStyle.ts +0 -42
  45. /package/dist/public/channel/{channelViewStyle.d.ts → styles/channelViewStyle.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.2.98",
3
+ "version": "1.2.99",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,8 +1,6 @@
1
1
  import XNode from "@web-atoms/core/dist/core/XNode";
2
2
  import sleep from "@web-atoms/core/dist/core/sleep";
3
- import FetchBuilder from "@web-atoms/core/dist/services/FetchBuilder";
4
3
  import WebApp from "@web-atoms/core/dist/web/WebApp";
5
- import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
6
4
  import BottomPopup from "@web-atoms/web-controls/dist/mobile-app/BottomPopup";
7
5
 
8
6
  declare let EmojiMart: any;
@@ -18,16 +16,6 @@ interface IEmoji {
18
16
  }[];
19
17
  }
20
18
 
21
- interface IEmojiMart {
22
- categories: {
23
- id: string;
24
- emojis: string[];
25
- }[];
26
- emojis: {
27
- [key: string]: IEmoji
28
- };
29
- }
30
-
31
19
  export default class EmojiPicker extends BottomPopup {
32
20
 
33
21
  async init() {
@@ -26,18 +26,24 @@ export default class BlogService {
26
26
  }) {
27
27
  const q = this.entityService.query(Email, "channelEmails", channelID)
28
28
  .where({ emailID }, (p) => (x) => x.emailID === p.emailID)
29
- .include((x) => [x.children, x.engagements]);
30
- return q.firstOrDefault();
29
+ .include((x) => [x.engagements]);
30
+ const email = await q.firstOrDefault();
31
+ await this.downloader.downloadFromUrl(`/api/emails/channel/content/html/${channelID}/${email.emailID}/${email.headerMessageID}`, email);
32
+ return email;
31
33
  }
32
34
 
33
35
  async getEmails({
34
36
  channelID = 0,
37
+ parentID = 0,
35
38
  search = "",
36
39
  start = 0,
37
40
  size = 10,
38
41
  cancelToken
39
42
  }) {
40
43
  let q = this.entityService.query(Email, "channelEmails", channelID);
44
+ if(parentID) {
45
+ q = q.where({ parentID}, (p) => (x) => x.parentID === p.parentID);
46
+ }
41
47
  if (search) {
42
48
  q = q.where({ search }, (p) => (x) => Sql.text.includes(x.textBody, p.search));
43
49
  }
@@ -49,9 +55,11 @@ export default class BlogService {
49
55
  const tasks = [];
50
56
 
51
57
  for (const email of emails.items) {
52
- tasks.push(this.downloader.downloadFromUrl(`/api/emails/channel/content/html/${channelID}/${email.emailID}`, email));
53
- for (const iterator of email.attachments) {
54
- iterator.url = `/api/emails/channel/attachment/${channelID}/${email.emailID}/${iterator.appFileID}`;
58
+ tasks.push(this.downloader.downloadFromUrl(`/api/emails/channel/content/html/${channelID}/${email.emailID}/${email.headerMessageID}`, email));
59
+ if (email.attachments) {
60
+ for (const iterator of email.attachments) {
61
+ iterator.url = `/api/emails/channel/attachment/${channelID}/${email.emailID}/${email.headerMessageID}/${iterator.appFileID}`;
62
+ }
55
63
  }
56
64
  }
57
65
  await Promise.all(tasks);
@@ -4,10 +4,15 @@ import BlogService from "./BlogService";
4
4
  import XNode from "@web-atoms/core/dist/core/XNode";
5
5
  import { DateFormats } from "../../common/date/DateFormats";
6
6
  import { renderMail } from "../../web/page/mails/service/ConversationService";
7
+ import Action from "@web-atoms/core/dist/view-model/Action";
8
+ import EmojiPopup from "./emoji/EmojiPopup";
9
+ import { channelViewStyle } from "./styles/channelViewStyle";
10
+ import PopupService from "@web-atoms/core/dist/web/services/PopupService";
11
+ import { IEmail, IMailbox } from "../../model/model";
7
12
 
8
13
  const url = (window as any).pageUrl as URL;
9
14
 
10
- let {1: channelID = 1, 2: emailID = 82 } = /^\/channels\/([^\/]+)\/([^\/]+)\//.exec(url.pathname) ?? {} as any;
15
+ let {1: channelID = "1", 2: emailID = "2a" } = /^\/channels\/([^\/]+)\/([^\/]+)\//.exec(url?.pathname) ?? {} as any;
11
16
 
12
17
  channelID = parseInt(channelID, 36);
13
18
  emailID = parseInt(emailID, 36);
@@ -17,6 +22,10 @@ export default class ChannelMessage extends AtomControl {
17
22
  @InjectProperty
18
23
  blogService: BlogService;
19
24
 
25
+
26
+ private channel: IMailbox;
27
+ private email: IEmail;
28
+
20
29
  constructor(app, e = document.createElement("section")) {
21
30
  super(app, e);
22
31
  this.runAfterInit(() => this.app.runAsync(() => this.init()));
@@ -25,26 +34,69 @@ export default class ChannelMessage extends AtomControl {
25
34
  async init() {
26
35
 
27
36
  const channel = await this.blogService.getChannel(void 0, channelID, void 0);
37
+ this.channel = channel;
28
38
 
29
- const email = await this.blogService.getEmail(emailID);
39
+ const email = await this.blogService.getEmail({ emailID, channelID });
40
+ this.email = email;
30
41
 
31
- this.renderer = <section data-element="blog-item">
42
+ const engagements = email.engagements ?? [];
43
+ this.element.className = channelViewStyle;
44
+ this.element.setAttribute("data-blog-list", "blog-list");
45
+ this.element.setAttribute("data-layout", "flex-center");
46
+ this.renderer = <section>
32
47
  <header>
33
48
  <div styler-display="flex" styler-gap="size-default">
34
49
  <span text={channel.emailAddress.name}/>
35
50
  <a href={`mailto:subscribe-${channel.emailAddress.emailAddress}?subject=subscribe`}><button>Follow</button></a>
36
51
  </div>
37
52
  </header>
38
- <h4 data-element="title">
39
- <label text={email.subject}/>
40
- </h4>
41
- <h6 data-element="date" text={DateFormats.relative.short(email.dateSent)}/>
42
- <h5 text={email.senderName}/>
43
- <section
44
- data-element="content">
45
- <section { ... renderMail({ email })}/>
53
+ <section>
54
+ <section>
55
+ <section data-element="blog-item">
56
+ <h4 data-element="title">
57
+ <label text={email.subject}/>
58
+ </h4>
59
+ <h6 data-element="date" text={DateFormats.relative.short(email.dateSent)}/>
60
+ <h5 text={email.senderName}/>
61
+ <section
62
+ data-element="content">
63
+ <section { ... renderMail({ email })}/>
64
+ </section>
65
+ <footer>
66
+ <i
67
+ data-click-event="react-email"
68
+ class="fa-light fa-face-smile-plus" title="React"/>
69
+ { ... engagements.map((x) =>
70
+ <span
71
+ title={`View all ${x.engagement} ${x.count}`}
72
+ text={`${x.engagement} ${x.count}`}/>)}
73
+ </footer>
74
+
75
+ </section>
76
+ </section>
46
77
  </section>
78
+ <aside></aside>
79
+ <footer></footer>
47
80
  </section>;
48
81
  }
49
82
 
83
+ @Action({ onEvent: "react-email"})
84
+ async reactEmail(a, ce: CustomEvent) {
85
+ const emoji: string = await EmojiPopup.showControl(ce.target as any, { parentElement: ce.target as any});
86
+ const { channel, email } = this;
87
+ const subject = `${emoji}:${Number(email.emailID).toString(36)}:${email.headerMessageID}`;
88
+ await PopupService.alert({
89
+ message: <div data-layout="vertical-flex">
90
+ To engage with this conversation, please join the channel.
91
+ And then reply to this email with following subject.
92
+ <div>To: {channel.emailAddress.emailAddress}</div>
93
+ <div>Subject: {subject}</div>
94
+ <div>
95
+ <a href={`mailto:${channel.emailAddress.emailAddress}?subject=${subject}&body=${emoji}`}>Email Now</a>
96
+ </div>
97
+ </div>,
98
+ title: "Send Email"
99
+ });
100
+ }
101
+
50
102
  }
@@ -9,9 +9,8 @@ import { DateFormats } from "../../common/date/DateFormats";
9
9
  import { IMailbox, IEmail } from "../../model/model";
10
10
  import { renderMail } from "../../web/page/mails/service/ConversationService";
11
11
  import BlogService from "./BlogService";
12
- import { channelViewStyle } from "./channelViewStyle";
12
+ import { channelViewStyle } from "./styles/channelViewStyle";
13
13
  import { UrlService } from "./UrlService";
14
- import sleep from "@web-atoms/core/dist/core/sleep";
15
14
 
16
15
  export default class ChannelView extends AtomControl {
17
16
 
@@ -97,12 +96,12 @@ export default class ChannelView extends AtomControl {
97
96
  <section { ... renderMail({ email })}/>
98
97
  </LimitedText>
99
98
  </section>
100
- <section>
99
+ <footer>
101
100
  { ... engagements.map((x) =>
102
101
  <span
103
102
  title={`View all ${x.engagement} ${x.count}`}
104
103
  text={`${x.engagement} ${x.count}`}/>)}
105
- </section>
104
+ </footer>
106
105
  </section>;
107
106
  }}
108
107
  />
@@ -1,72 +1,10 @@
1
1
  import "../../style/GlobalStyle";
2
2
  import Pack from "@web-atoms/core/dist/Pack";
3
- import styled from "@web-atoms/core/dist/style/styled";
4
3
 
5
- styled.css `
6
-
7
- box-sizing: border-box;
8
-
9
- & > header {
10
-
11
- }
12
-
13
- & > section {
14
- & [data-element=blog-item] {
15
- margin: 10px;
16
- border: solid 1px lightgray;
17
- border-radius: 10px;
18
- display: grid;
19
- grid-template-columns: 1fr auto auto;
20
- grid-template-rows: auto 1fr;
21
-
22
- background-color: gray;
23
-
24
- & > h4 {
25
- grid-row: 1;
26
- grid-column: 1;
27
- margin-block-start: 0;
28
- margin-block-end: 0;
29
- padding: 10px;
30
- & > a {
31
- text-decoration: none;
32
- color: white;
33
- &:hover {
34
- text-decoration: underline;
35
- color: #73ff73;
36
- }
37
- }
38
- }
39
-
40
- & > h5 {
41
- grid-row: 1;
42
- grid-column: 2;
43
- margin-block-start: 0;
44
- margin-block-end: 0;
45
- padding: 10px;
46
- }
47
- & > h6 {
48
- grid-row: 1;
49
- grid-column: 3;
50
- margin-block-start: 0;
51
- margin-block-end: 0;
52
- padding: 10px;
53
- }
54
- & > section {
55
- padding: 10px;
56
- border-bottom-left-radius: 10px;
57
- border-bottom-right-radius: 10px;
58
- grid-row: 2;
59
- grid-column: 1 / span 3;
60
- background-color: canvas;
61
- }
62
- }
63
- }
64
-
65
- `.installGlobal("[data-blog-list=blog-list]");
66
4
 
67
5
  const url = new URL(location.href);
68
6
  (window as any).pageUrl = url;
69
- const { default: view } = await (/\/channels\//.test(url.pathname)
7
+ const { default: view } = await (/\/channels\//.test(url.pathname) || url.searchParams.has("detail")
70
8
  ? import("./ChannelMessage")
71
9
  : import("./ChannelMessageList")) as any;
72
10
 
@@ -0,0 +1,28 @@
1
+ import WebApp from "@web-atoms/core/dist/web/WebApp";
2
+ import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
3
+ import InlinePopup from "@web-atoms/web-controls/dist/basic/InlinePopup";
4
+
5
+ declare let EmojiMart: any;
6
+
7
+ export default class EmojiPopup extends InlinePopup {
8
+ constructor(app, e) {
9
+ super(app, e);
10
+ this.runAfterInit(() => this.app.runAsync(() => this.init()));
11
+ }
12
+
13
+ async init() {
14
+
15
+ await WebApp.installScript("https://cdn.jsdelivr.net/npm/emoji-mart@latest/dist/browser.js");
16
+
17
+ const picker = new EmojiMart.Picker({
18
+ previewPosition: "none",
19
+ autoFocus: true,
20
+ theme: "light",
21
+ maxFrequentRows: 2,
22
+ onEmojiSelect: (emoji) => this.close(emoji.native)
23
+ });
24
+
25
+ this.element.appendChild(picker);
26
+
27
+ }
28
+ }
@@ -0,0 +1,110 @@
1
+ import styled from "@web-atoms/core/dist/style/styled";
2
+
3
+ styled.css `
4
+
5
+ box-sizing: border-box;
6
+
7
+ & > header {
8
+
9
+ }
10
+
11
+ & > section {
12
+ & [data-element=blog-item] {
13
+ margin: 10px;
14
+ border: solid 1px lightgray;
15
+ border-radius: 10px;
16
+ display: grid;
17
+ grid-template-columns: 1fr auto auto;
18
+ grid-template-rows: auto 1fr auto;
19
+
20
+ background-color: gray;
21
+
22
+ & > h4 {
23
+ grid-row: 1;
24
+ grid-column: 1;
25
+ margin-block-start: 0;
26
+ margin-block-end: 0;
27
+ padding: 10px;
28
+ & > a {
29
+ text-decoration: none;
30
+ color: white;
31
+ &:hover {
32
+ text-decoration: underline;
33
+ color: #73ff73;
34
+ }
35
+ }
36
+ }
37
+
38
+ & > h5 {
39
+ grid-row: 1;
40
+ grid-column: 2;
41
+ margin-block-start: 0;
42
+ margin-block-end: 0;
43
+ padding: 10px;
44
+ }
45
+ & > h6 {
46
+ grid-row: 1;
47
+ grid-column: 3;
48
+ margin-block-start: 0;
49
+ margin-block-end: 0;
50
+ padding: 10px;
51
+ }
52
+ & > section {
53
+ padding: 10px;
54
+ grid-row: 2;
55
+ grid-column: 1 / span 3;
56
+ background-color: canvas;
57
+ }
58
+ & > footer {
59
+ padding: 10px;
60
+ grid-row: 3;
61
+ grid-column: 1/ span 3;
62
+ background-color: canvas;
63
+ border-bottom-left-radius: 10px;
64
+ border-bottom-right-radius: 10px;
65
+ }
66
+ }
67
+ }
68
+
69
+ `.installGlobal("[data-blog-list=blog-list]");
70
+
71
+ export const channelViewStyle = styled.css `
72
+
73
+ display: flex;
74
+ flex-direction: column;
75
+ gap: 5px;
76
+
77
+ & > header, & > footer {
78
+ display: flex;
79
+ flex-direction: row;
80
+ flex-wrap: wrap;
81
+ gap: 10px;
82
+ padding: 10px;
83
+ background: #FAFAFA;
84
+ }
85
+
86
+ @media (min-width: 900px) {
87
+ display: grid;
88
+ grid-template-columns: 1fr auto;
89
+ grid-template-rows: auto 1fr auto;
90
+ gap: 5px;
91
+
92
+ & > header {
93
+ grid-row: 1;
94
+ grid-column: 1 / span 2;
95
+ }
96
+ & > section {
97
+ grid-row: 2;
98
+ grid-column: 1;
99
+ }
100
+ & > aside {
101
+ grid-row: 2;
102
+ grid-column: 2;
103
+ }
104
+ & > footer {
105
+ grid-row: 3;
106
+ grid-column: 1 / span 2;
107
+ }
108
+ }
109
+
110
+ `.installLocal();
@@ -1 +0,0 @@
1
- {"version":3,"file":"channelViewStyle.d.ts","sourceRoot":"","sources":["../../../src/public/channel/channelViewStyle.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,QAuCb,CAAC"}
@@ -1,53 +0,0 @@
1
- System.register(["@web-atoms/core/dist/style/styled"], function (_export, _context) {
2
- "use strict";
3
-
4
- var styled, channelViewStyle;
5
- return {
6
- setters: [function (_webAtomsCoreDistStyleStyled) {
7
- styled = _webAtomsCoreDistStyleStyled.default;
8
- }],
9
- execute: function () {
10
- _export("channelViewStyle", channelViewStyle = styled.css`
11
-
12
- display: flex;
13
- flex-direction: column;
14
- gap: 5px;
15
-
16
- & > header, & > footer {
17
- display: flex;
18
- flex-direction: row;
19
- flex-wrap: wrap;
20
- gap: 10px;
21
- padding: 10px;
22
- background: #FAFAFA;
23
- }
24
-
25
- @media (min-width: 900px) {
26
- display: grid;
27
- grid-template-columns: 1fr auto;
28
- grid-template-rows: auto 1fr auto;
29
- gap: 5px;
30
-
31
- & > header {
32
- grid-row: 1;
33
- grid-column: 1 / span 2;
34
- }
35
- & > section {
36
- grid-row: 2;
37
- grid-column: 1;
38
- }
39
- & > aside {
40
- grid-row: 2;
41
- grid-column: 2;
42
- }
43
- & > footer {
44
- grid-row: 3;
45
- grid-column: 1 / span 2;
46
- }
47
- }
48
-
49
- `.installLocal());
50
- }
51
- };
52
- });
53
- //# sourceMappingURL=channelViewStyle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["styled","_webAtomsCoreDistStyleStyled","default","execute","_export","channelViewStyle","css","installLocal"],"sources":["../../../src/public/channel/channelViewStyle.ts"],"sourcesContent":[null],"mappings":";;;;;;MAAOA,MAAM,GAAAC,4BAAA,CAAAC,OAAA;IAAA;IAAAC,OAAA,WAAAA,CAAA;MAAAC,OAAA,qBAEAC,gBAAgB,GAAGL,MAAM,CAACM,GAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuC1C,CAACC,YAAY,EAAE;IAAA;EAAA;AAAA"}
@@ -1,42 +0,0 @@
1
- import styled from "@web-atoms/core/dist/style/styled";
2
-
3
- export const channelViewStyle = styled.css `
4
-
5
- display: flex;
6
- flex-direction: column;
7
- gap: 5px;
8
-
9
- & > header, & > footer {
10
- display: flex;
11
- flex-direction: row;
12
- flex-wrap: wrap;
13
- gap: 10px;
14
- padding: 10px;
15
- background: #FAFAFA;
16
- }
17
-
18
- @media (min-width: 900px) {
19
- display: grid;
20
- grid-template-columns: 1fr auto;
21
- grid-template-rows: auto 1fr auto;
22
- gap: 5px;
23
-
24
- & > header {
25
- grid-row: 1;
26
- grid-column: 1 / span 2;
27
- }
28
- & > section {
29
- grid-row: 2;
30
- grid-column: 1;
31
- }
32
- & > aside {
33
- grid-row: 2;
34
- grid-column: 2;
35
- }
36
- & > footer {
37
- grid-row: 3;
38
- grid-column: 1 / span 2;
39
- }
40
- }
41
-
42
- `.installLocal();