@social-mail/social-mail-client 1.2.65 → 1.2.67

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 (62) hide show
  1. package/dist/admin/AdminAppIndex.pack.js +475 -47
  2. package/dist/admin/AdminAppIndex.pack.js.map +1 -1
  3. package/dist/admin/AdminAppIndex.pack.min.js +63 -7
  4. package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
  5. package/dist/model/model.d.ts +120 -2
  6. package/dist/model/model.d.ts.map +1 -1
  7. package/dist/model/model.js +90 -1
  8. package/dist/model/model.js.map +1 -1
  9. package/dist/public/channel/BlogService.d.ts.map +1 -1
  10. package/dist/public/channel/BlogService.js +2 -2
  11. package/dist/public/channel/BlogService.js.map +1 -1
  12. package/dist/public/channel/ChannelMessageList.d.ts.map +1 -1
  13. package/dist/public/channel/ChannelMessageList.js +3 -1
  14. package/dist/public/channel/ChannelMessageList.js.map +1 -1
  15. package/dist/public/channel/ChannelView.pack.js +95 -4
  16. package/dist/public/channel/ChannelView.pack.js.map +1 -1
  17. package/dist/public/channel/ChannelView.pack.min.js +2 -2
  18. package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/dist/web/AppIndex.pack.js +476 -48
  21. package/dist/web/AppIndex.pack.js.map +1 -1
  22. package/dist/web/AppIndex.pack.min.js +64 -8
  23. package/dist/web/AppIndex.pack.min.js.map +1 -1
  24. package/dist/web/drawer/AppDrawer.js +1 -1
  25. package/dist/web/drawer/AppDrawer.js.map +1 -1
  26. package/dist/web/page/channels/detail/ChannelDetailPage.d.ts +6 -1
  27. package/dist/web/page/channels/detail/ChannelDetailPage.d.ts.map +1 -1
  28. package/dist/web/page/channels/detail/ChannelDetailPage.js +178 -2
  29. package/dist/web/page/channels/detail/ChannelDetailPage.js.map +1 -1
  30. package/dist/web/page/channels/services/ChannelService.d.ts +11 -1
  31. package/dist/web/page/channels/services/ChannelService.d.ts.map +1 -1
  32. package/dist/web/page/channels/services/ChannelService.js +50 -1
  33. package/dist/web/page/channels/services/ChannelService.js.map +1 -1
  34. package/dist/web/page/mails/ConversationPage.d.ts.map +1 -1
  35. package/dist/web/page/mails/ConversationPage.js +6 -3
  36. package/dist/web/page/mails/ConversationPage.js.map +1 -1
  37. package/dist/web/page/mails/mini-compose/MiniComposeBox.d.ts.map +1 -1
  38. package/dist/web/page/mails/mini-compose/MiniComposeBox.js +13 -5
  39. package/dist/web/page/mails/mini-compose/MiniComposeBox.js.map +1 -1
  40. package/dist/web/page/mails/mini-compose/ToggleEmoji.d.ts +4 -0
  41. package/dist/web/page/mails/mini-compose/ToggleEmoji.d.ts.map +1 -0
  42. package/dist/web/page/mails/mini-compose/ToggleEmoji.js +35 -0
  43. package/dist/web/page/mails/mini-compose/ToggleEmoji.js.map +1 -0
  44. package/dist/web/page/mails/service/MailService.d.ts.map +1 -1
  45. package/dist/web/page/mails/service/MailService.js +5 -2
  46. package/dist/web/page/mails/service/MailService.js.map +1 -1
  47. package/dist/web/page/templates/emoji-bar/EmojiBar.d.ts +3 -0
  48. package/dist/web/page/templates/emoji-bar/EmojiBar.d.ts.map +1 -0
  49. package/dist/web/page/templates/emoji-bar/EmojiBar.js +59 -0
  50. package/dist/web/page/templates/emoji-bar/EmojiBar.js.map +1 -0
  51. package/package.json +1 -1
  52. package/src/model/model.ts +137 -5
  53. package/src/public/channel/BlogService.ts +4 -2
  54. package/src/public/channel/ChannelMessageList.tsx +4 -1
  55. package/src/web/drawer/AppDrawer.tsx +1 -1
  56. package/src/web/page/channels/detail/ChannelDetailPage.tsx +159 -1
  57. package/src/web/page/channels/services/ChannelService.ts +42 -1
  58. package/src/web/page/mails/ConversationPage.tsx +5 -0
  59. package/src/web/page/mails/mini-compose/MiniComposeBox.tsx +9 -2
  60. package/src/web/page/mails/mini-compose/ToggleEmoji.tsx +24 -0
  61. package/src/web/page/mails/service/MailService.ts +3 -2
  62. package/src/web/page/templates/emoji-bar/EmojiBar.tsx +42 -0
@@ -1,7 +1,81 @@
1
1
  import { ContentPage } from "@web-atoms/web-controls/dist/mobile-app/MobileApp";
2
- import { IMailbox } from "../../../../model/model";
2
+ import { IEmail, IMailbox, IMailboxContactEmail } from "../../../../model/model";
3
3
  import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
4
4
  import MailboxService from "../../../../common/pages/mailboxes/services/MailboxService";
5
+ import XNode from "@web-atoms/core/dist/core/XNode";
6
+ import AppCommands from "../../../commands/AppCommands";
7
+ import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
8
+ import ChannelService from "../services/ChannelService";
9
+ import InfiniteRepeater from "../../../../common/controls/repeater/InfiniteRepeater";
10
+ import Bind from "@web-atoms/core/dist/core/Bind";
11
+ import LimitedText from "@web-atoms/web-controls/dist/basic/LimitedText";
12
+ import { renderMail } from "../../mails/service/ConversationService";
13
+ import { DateFormats } from "../../../../common/date/DateFormats";
14
+ import styled from "@web-atoms/core/dist/style/styled";
15
+ import Action from "@web-atoms/core/dist/view-model/Action";
16
+ import PageNavigator from "@web-atoms/web-controls/dist/PageNavigator";
17
+ import InlinePopupControl from "@web-atoms/web-controls/dist/basic/InlinePopupControl";
18
+ import { MenuItem } from "@web-atoms/web-controls/dist/basic/PopupButton";
19
+ import MailDetailPage from "../../mails/detail/MailDetailPage";
20
+
21
+ const css = styled.css `
22
+
23
+ & [data-blog-list=blog-list] {
24
+
25
+
26
+ display: flex;
27
+ flex-direction: column;
28
+ gap: 10px;
29
+
30
+ & > * {
31
+ border: solid 1px lightgray;
32
+ border-radius: 5px;
33
+ display: inline-grid;
34
+ grid-template-columns: 5px 1fr auto auto 5px;
35
+ grid-template-rows: 5px auto auto 1fr auto 5px;
36
+
37
+ & > [data-element=bg] {
38
+ grid-row: 1 / span 3;
39
+ grid-column: 1/ span 5;
40
+ background-color: lightgrey;
41
+ z-index: -1;
42
+ }
43
+
44
+ & > h4, & > h6 {
45
+ margin-block-start: 0;
46
+ margin-block-end: 0;
47
+ }
48
+
49
+ & > [data-element=actions] {
50
+ grid-row: 2;
51
+ grid-column: 4;
52
+ }
53
+
54
+ & > [data-element=title] {
55
+ grid-row: 3;
56
+ grid-column: 2 / span 2;
57
+ }
58
+
59
+ & > [data-element=date] {
60
+ grid-row: 2;
61
+ grid-column: 3;
62
+ }
63
+
64
+ & > [data-element=author] {
65
+ grid-row: 2;
66
+ grid-column: 2;
67
+ }
68
+
69
+ & > [data-element=content] {
70
+ grid-row: 4;
71
+ grid-column: 2 / span 4;
72
+ }
73
+ }
74
+
75
+ }
76
+
77
+ `.installLocal();
78
+
5
79
 
6
80
  export default class ChannelDetailPage extends ContentPage {
7
81
 
@@ -9,12 +83,96 @@ export default class ChannelDetailPage extends ContentPage {
9
83
 
10
84
  public mailbox: IMailbox;
11
85
 
86
+ public search = "";
87
+
88
+ public version = 1;
89
+
12
90
  @InjectProperty
13
91
  private mailboxService: MailboxService;
14
92
 
93
+ @InjectProperty
94
+ private channelService: ChannelService;
95
+
15
96
  async init() {
97
+
16
98
  this.mailbox = await this.mailboxService.get(this.parameters.id);
17
99
  this.title = `${this.mailbox.emailAddress.name || this.mailbox.name} (${this.mailbox.emailAddress.emailAddress})`;
100
+
101
+ this.headerRenderer = () => <div data-layout="header-row">
102
+ <input type="search" value={Bind.twoWaysImmediate(() => this.search)}/>
103
+ <a
104
+ data-click-event="route"
105
+ href={AppCommands.openSubscribers.displayRoute({ id: this.parameters.id})}>Subscribers</a>
106
+ </div>;
107
+
108
+ this.renderer = <section class={css}>
109
+ <AtomRepeater
110
+ data-blog-list="blog-list"
111
+ { ... InfiniteRepeater.pagedItems((start) =>
112
+ (c, e, cancelToken) =>
113
+ this.channelService.getMails({
114
+ channelID: this.parameters.id,
115
+ search: this.search,
116
+ version: this.version,
117
+ cancelToken
118
+ })
119
+ )}
120
+ itemRenderer={(email: IEmail) => <section data-element="blog-item">
121
+ <div data-element="bg"/>
122
+ <h4 data-element="title"
123
+ text={email.subject}/>
124
+ <h6 data-element="date" text={DateFormats.relative.short(email.dateSent)}/>
125
+ <h6 data-element="author" text={email.senderName}/>
126
+ <i
127
+ data-element="actions"
128
+ data-click-event="mail-options"
129
+ class="fa-light fa-square-ellipsis-vertical"/>
130
+ <section
131
+ data-element="content">
132
+ <LimitedText height={200}>
133
+ <section { ... renderMail({ email })}/>
134
+ </LimitedText>
135
+ </section>
136
+ </section>}
137
+ />
138
+ </section>;
18
139
  }
19
140
 
141
+ @Action({ onEvent: "mail-options"})
142
+ async mailOptions(email: IEmail, ce: CustomEvent) {
143
+ void InlinePopupControl.showPopup(ce.target as HTMLElement, <div
144
+ data-click-event="none"
145
+ data-click-animate="none">
146
+ { email?.status === "published" &&
147
+ <MenuItem
148
+ icon="fas fa-trash-can"
149
+ data-click-event="delete-mail"
150
+ label="Hide"/>
151
+ }
152
+ <MenuItem
153
+ eventClick={() => PageNavigator.pushPage(MailDetailPage, email)}
154
+ icon="fas fa-eye"
155
+ label="Details"
156
+ />
157
+ <MenuItem
158
+ href={`/api/files/download/${email.originalFileID}`}
159
+ icon="fas fa-download"
160
+ label="Download"
161
+ />
162
+ <MenuItem
163
+ data-click-event="open-logs"
164
+ icon="fa-regular fa-clock-rotate-left"
165
+ label="Logs"
166
+ />
167
+ </div>);
168
+ }
169
+
170
+ @Action({
171
+ onEvent: "delete-mail",
172
+ confirm: "Are you sure you want to delete this email?"
173
+ })
174
+ async deleteMail(email: IEmail) {
175
+ await this.channelService.deleteMail(email);
176
+ this.version++;
177
+ }
20
178
  }
@@ -1,7 +1,7 @@
1
1
  import DITransient from "@web-atoms/core/dist/di/DITransient";
2
2
  import { Inject } from "@web-atoms/core/dist/di/Inject";
3
3
  import EntityService from "../../../../services/EntityService";
4
- import { IMailboxContact, Mailbox, MailboxContact } from "../../../../model/model";
4
+ import { Email, IEmail, IMailboxContact, Mailbox, MailboxContact } from "../../../../model/model";
5
5
  import { Sql } from "../../../../common/Sql";
6
6
 
7
7
  @DITransient({})
@@ -10,6 +10,38 @@ export default class ChannelService {
10
10
  @Inject
11
11
  private entityService: EntityService;
12
12
 
13
+ public async getMails({
14
+ channelID,
15
+ published = true,
16
+ start = 0,
17
+ size = 100,
18
+ search = "",
19
+ version = 0,
20
+ cancelToken
21
+ }) {
22
+ let q = this.entityService.query(Email);
23
+
24
+ if (channelID) {
25
+ q = q.where({ channelID}, (p) => (x) => x.mailboxes.some((m) => m.mailboxID === p.channelID));
26
+ }
27
+
28
+ if (published) {
29
+ q = q.where((x) => x.status === "published");
30
+ } else {
31
+ q = q.where((x) => x.status !== "published");
32
+ }
33
+
34
+ if (search) {
35
+ if (!/\%/.test(search)) {
36
+ search = search + "%";
37
+ }
38
+ q = q.where({ search }, (p) => (x) => Sql.text.like(x.subject, p.search));
39
+ }
40
+
41
+ return q.orderByDescending((x) => x.emailID)
42
+ .toPagedList({ start, size, cancelToken });
43
+ }
44
+
13
45
  public async getMailbox(id: number) {
14
46
  return this.entityService.query(Mailbox)
15
47
  .include((x) => x.emailAddress)
@@ -47,4 +79,13 @@ export default class ChannelService {
47
79
  }
48
80
  await this.entityService.save(cloners);
49
81
  }
82
+
83
+ async deleteMail(email: IEmail) {
84
+ const { emailID } = email;
85
+ await this.entityService.save(Email.create({
86
+ emailID,
87
+ status: "deleted"
88
+ }));
89
+ email.status = "deleted";
90
+ }
50
91
  }
@@ -288,6 +288,11 @@ export default class ConversationPage extends ContentPage {
288
288
  void InlinePopupControl.showPopup(ce.target as HTMLElement, <div
289
289
  data-click-event="none"
290
290
  data-click-animate="none">
291
+ { thread.email?.status === "published" &&
292
+ <MenuItem
293
+ icon="fas fa-delete"
294
+ data-click-event="un-publish-mail"/>
295
+ }
291
296
  <MenuItem
292
297
  eventClick={() => PageNavigator.pushPage(MailDetailPage, thread.email)}
293
298
  icon="fas fa-eye"
@@ -29,6 +29,8 @@ import Unlink from "@web-atoms/web-controls/dist/html-editor/commands/Unlink";
29
29
  import Separator from "@web-atoms/web-controls/dist/html-editor/commands/Separator";
30
30
  import Insert from "./Insert";
31
31
  import TimeSpan from "@web-atoms/date-time/dist/TimeSpan";
32
+ import ToggleEmoji from "./ToggleEmoji";
33
+ import { emojiBarAsText } from "../../templates/emoji-bar/EmojiBar";
32
34
 
33
35
  const css = styled.css `
34
36
  display: grid;
@@ -103,7 +105,10 @@ export default class MiniComposeBox extends AtomControl {
103
105
 
104
106
  this.typedMessage = this.draft?.htmlBody
105
107
  ? this.draft.htmlBody
106
- : `<div contentEditable="true" style="background-color: white; color: black;"><p>&nbsp;</br></p></div>`;
108
+ : `<section style="background-color: white; color: black;">
109
+ <section contentEditable="true">&nbsp;</br></section>
110
+ ${emojiBarAsText()}
111
+ </section>`;
107
112
 
108
113
  this.render(<div>
109
114
  <MailHtmlEditor
@@ -119,11 +124,12 @@ export default class MiniComposeBox extends AtomControl {
119
124
  <AddLink/>
120
125
  <Unlink/>
121
126
  <Separator/>
127
+ <ToggleEmoji/>
122
128
  </Toolbar></div>}
123
129
  data-element="editor"
124
130
  data-html-editor="email-editor"
125
131
  presenter={Bind.presenter((c) => this.editor = c )}
126
- content={`<div contentEditable="true" style="background-color: white; color: black;">${this.typedMessage}</div>`}
132
+ content={this.typedMessage}
127
133
  style-min-height="50px"
128
134
  />
129
135
  <i
@@ -209,6 +215,7 @@ export default class MiniComposeBox extends AtomControl {
209
215
  const { html , text } = this.editor.htmlTextContent;
210
216
  this.draft.htmlBody = html;
211
217
  this.draft.textBody = text;
218
+ await this.save();
212
219
 
213
220
  this.draft.status = "scheduled";
214
221
  this.draft.dateSent = DateTime.now.add(TimeSpan.fromSeconds(30));
@@ -0,0 +1,24 @@
1
+ import Bind from "@web-atoms/core/dist/core/Bind";
2
+ import XNode from "@web-atoms/core/dist/core/XNode";
3
+ import { IPopupOptions } from "@web-atoms/core/dist/web/services/PopupService";
4
+ import PopupButton, { MenuItem } from "@web-atoms/web-controls/dist/basic/PopupButton";
5
+ import { MailHtmlEditor } from "../../../../common/controls/html/InlineHtmlEditorWithToolbar";
6
+
7
+ const toggleEmojiAction = Bind.event((editor: MailHtmlEditor) => {
8
+
9
+ });
10
+
11
+ export default function ToggleEmoji({ alignment = "above" as IPopupOptions["alignment"]}) {
12
+ return <PopupButton
13
+ class="command"
14
+ data-layout="toolbar-button"
15
+ icon="fas fa-message-smile"
16
+ title="Toggle Emoji"
17
+ alignment={alignment}>
18
+ <MenuItem
19
+ icon="ri-list-unordered"
20
+ label="List"
21
+ event-click={toggleEmojiAction}
22
+ />
23
+ </PopupButton>;
24
+ }
@@ -52,8 +52,9 @@ export default class MailService {
52
52
  }
53
53
 
54
54
  async send(email: IEmail) {
55
- if (email.textBody) {
56
- email.subject ||= email.textBody.substring(0, 80);
55
+ const { textBody } = email;
56
+ if (textBody) {
57
+ email.subject ||= textBody.split("\n")[0].substring(0, 80);
57
58
  }
58
59
  for (const iterator of email.recipients) {
59
60
  if (iterator.emailAddressText) {
@@ -0,0 +1,42 @@
1
+ import XNode from "@web-atoms/core/dist/core/XNode";
2
+ import { Emoji } from "../../../../services/Emoji";
3
+ import DomToString from "@web-atoms/email-dom/dist/DomToString";
4
+
5
+ const EmojiButton = ({
6
+ emoji,
7
+ command = "track",
8
+ title
9
+ }) => {
10
+ const emojiCode = "u" + Emoji.emojiUnicode(emoji);
11
+ const selector = `social-button-${emojiCode}`;
12
+ return <a
13
+ class={selector}
14
+ style="text-decoration: none;outline: none;border:none; margin-right: 5px"
15
+ data-social-mail-command={command}
16
+ title={title}
17
+ data-social-mail-transform="buttons-3x"
18
+ data-social-mail-transform-max-image="30px"
19
+ data-social-mail-track={emoji}>
20
+ <button style="margin: 1px;padding:2px;padding-left: 5px;padding-right: 5px; border: solid 1px lightgray; border-radius: 9999px; display: inline-flex; align-items: center;">
21
+ {emoji} <span
22
+ data-social-mail-element="count"/>
23
+ </button>
24
+ </a>;
25
+ };
26
+
27
+ export const emojiBar = (addComments = true) => <table data-social-mail-component="emoji-tracker" contentEditable="false" style="width:100%">
28
+ <td>
29
+ <EmojiButton emoji="👍" title={"Like this ... "}/>
30
+ <EmojiButton emoji="👎" title={"Don't like this ... "}/>
31
+ <EmojiButton emoji="🗨️" title={"Comment ... "}/>
32
+ </td>
33
+ <td style="text-align: right">
34
+ <EmojiButton
35
+ emoji="👁️‍🗨️"
36
+ command="view"
37
+ title={"Views"}
38
+ />
39
+ </td>
40
+ </table>;
41
+
42
+ export const emojiBarAsText = (addComments = true) => DomToString(emojiBar(addComments));