@social-mail/social-mail-client 1.2.66 → 1.2.68

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 (41) hide show
  1. package/dist/admin/AdminAppIndex.pack.js +188 -10
  2. package/dist/admin/AdminAppIndex.pack.js.map +1 -1
  3. package/dist/admin/AdminAppIndex.pack.min.js +6 -6
  4. package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
  5. package/dist/model/model.d.ts +1 -1
  6. package/dist/model/model.d.ts.map +1 -1
  7. package/dist/tsconfig.tsbuildinfo +1 -1
  8. package/dist/web/AppIndex.pack.js +188 -10
  9. package/dist/web/AppIndex.pack.js.map +1 -1
  10. package/dist/web/AppIndex.pack.min.js +6 -6
  11. package/dist/web/AppIndex.pack.min.js.map +1 -1
  12. package/dist/web/page/channels/detail/ChannelDetailPage.d.ts +4 -1
  13. package/dist/web/page/channels/detail/ChannelDetailPage.d.ts.map +1 -1
  14. package/dist/web/page/channels/detail/ChannelDetailPage.js +52 -2
  15. package/dist/web/page/channels/detail/ChannelDetailPage.js.map +1 -1
  16. package/dist/web/page/channels/services/ChannelService.d.ts +5 -3
  17. package/dist/web/page/channels/services/ChannelService.d.ts.map +1 -1
  18. package/dist/web/page/channels/services/ChannelService.js +13 -0
  19. package/dist/web/page/channels/services/ChannelService.js.map +1 -1
  20. package/dist/web/page/mails/mini-compose/MiniComposeBox.d.ts.map +1 -1
  21. package/dist/web/page/mails/mini-compose/MiniComposeBox.js +13 -5
  22. package/dist/web/page/mails/mini-compose/MiniComposeBox.js.map +1 -1
  23. package/dist/web/page/mails/mini-compose/ToggleEmoji.d.ts +4 -0
  24. package/dist/web/page/mails/mini-compose/ToggleEmoji.d.ts.map +1 -0
  25. package/dist/web/page/mails/mini-compose/ToggleEmoji.js +35 -0
  26. package/dist/web/page/mails/mini-compose/ToggleEmoji.js.map +1 -0
  27. package/dist/web/page/mails/service/MailService.d.ts.map +1 -1
  28. package/dist/web/page/mails/service/MailService.js +9 -2
  29. package/dist/web/page/mails/service/MailService.js.map +1 -1
  30. package/dist/web/page/templates/emoji-bar/EmojiBar.d.ts +3 -0
  31. package/dist/web/page/templates/emoji-bar/EmojiBar.d.ts.map +1 -0
  32. package/dist/web/page/templates/emoji-bar/EmojiBar.js +59 -0
  33. package/dist/web/page/templates/emoji-bar/EmojiBar.js.map +1 -0
  34. package/package.json +1 -1
  35. package/src/model/model.ts +1 -1
  36. package/src/web/page/channels/detail/ChannelDetailPage.tsx +47 -1
  37. package/src/web/page/channels/services/ChannelService.ts +11 -1
  38. package/src/web/page/mails/mini-compose/MiniComposeBox.tsx +9 -2
  39. package/src/web/page/mails/mini-compose/ToggleEmoji.tsx +24 -0
  40. package/src/web/page/mails/service/MailService.ts +9 -2
  41. package/src/web/page/templates/emoji-bar/EmojiBar.tsx +42 -0
@@ -1,5 +1,5 @@
1
1
  import { ContentPage } from "@web-atoms/web-controls/dist/mobile-app/MobileApp";
2
- import { IEmail, 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
5
  import XNode from "@web-atoms/core/dist/core/XNode";
@@ -12,6 +12,11 @@ import LimitedText from "@web-atoms/web-controls/dist/basic/LimitedText";
12
12
  import { renderMail } from "../../mails/service/ConversationService";
13
13
  import { DateFormats } from "../../../../common/date/DateFormats";
14
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";
15
20
 
16
21
  const css = styled.css `
17
22
 
@@ -80,6 +85,8 @@ export default class ChannelDetailPage extends ContentPage {
80
85
 
81
86
  public search = "";
82
87
 
88
+ public version = 1;
89
+
83
90
  @InjectProperty
84
91
  private mailboxService: MailboxService;
85
92
 
@@ -106,6 +113,7 @@ export default class ChannelDetailPage extends ContentPage {
106
113
  this.channelService.getMails({
107
114
  channelID: this.parameters.id,
108
115
  search: this.search,
116
+ version: this.version,
109
117
  cancelToken
110
118
  })
111
119
  )}
@@ -117,6 +125,7 @@ export default class ChannelDetailPage extends ContentPage {
117
125
  <h6 data-element="author" text={email.senderName}/>
118
126
  <i
119
127
  data-element="actions"
128
+ data-click-event="mail-options"
120
129
  class="fa-light fa-square-ellipsis-vertical"/>
121
130
  <section
122
131
  data-element="content">
@@ -129,4 +138,41 @@ export default class ChannelDetailPage extends ContentPage {
129
138
  </section>;
130
139
  }
131
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
+ }
132
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 { Email, 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({})
@@ -16,6 +16,7 @@ export default class ChannelService {
16
16
  start = 0,
17
17
  size = 100,
18
18
  search = "",
19
+ version = 0,
19
20
  cancelToken
20
21
  }) {
21
22
  let q = this.entityService.query(Email);
@@ -78,4 +79,13 @@ export default class ChannelService {
78
79
  }
79
80
  await this.entityService.save(cloners);
80
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
+ }
81
91
  }
@@ -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
+ }
@@ -53,8 +53,15 @@ export default class MailService {
53
53
 
54
54
  async send(email: IEmail) {
55
55
  const { textBody } = email;
56
- if (textBody) {
57
- email.subject ||= textBody.split("\n")[0].substring(0, 80);
56
+ if (textBody && !email.subject ) {
57
+ const lines = textBody.split("\n");
58
+ for (const line of lines) {
59
+ if (!line.trim()) {
60
+ continue;
61
+ }
62
+ email.subject ||= line.substring(0, 80);
63
+ break;
64
+ }
58
65
  }
59
66
  for (const iterator of email.recipients) {
60
67
  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));