@social-mail/social-mail-client 1.2.11 → 1.2.13

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 (33) hide show
  1. package/dist/admin/AdminAppIndex.pack.js +171 -30
  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/common/pages/mailboxes/services/MailboxService.d.ts +2 -1
  6. package/dist/common/pages/mailboxes/services/MailboxService.d.ts.map +1 -1
  7. package/dist/common/pages/mailboxes/services/MailboxService.js +28 -1
  8. package/dist/common/pages/mailboxes/services/MailboxService.js.map +1 -1
  9. package/dist/tsconfig.tsbuildinfo +1 -1
  10. package/dist/web/AppIndex.pack.js +171 -30
  11. package/dist/web/AppIndex.pack.js.map +1 -1
  12. package/dist/web/AppIndex.pack.min.js +6 -6
  13. package/dist/web/AppIndex.pack.min.js.map +1 -1
  14. package/dist/web/page/mails/ConversationPage.d.ts.map +1 -1
  15. package/dist/web/page/mails/ConversationPage.js +5 -1
  16. package/dist/web/page/mails/ConversationPage.js.map +1 -1
  17. package/dist/web/page/mails/MailboxContacts.d.ts +1 -0
  18. package/dist/web/page/mails/MailboxContacts.d.ts.map +1 -1
  19. package/dist/web/page/mails/MailboxContacts.js +27 -22
  20. package/dist/web/page/mails/MailboxContacts.js.map +1 -1
  21. package/dist/web/page/mails/contact/AddMiniContactPage.d.ts +9 -0
  22. package/dist/web/page/mails/contact/AddMiniContactPage.d.ts.map +1 -0
  23. package/dist/web/page/mails/contact/AddMiniContactPage.js +96 -0
  24. package/dist/web/page/mails/contact/AddMiniContactPage.js.map +1 -0
  25. package/dist/web/page/mails/service/ConversationService.d.ts.map +1 -1
  26. package/dist/web/page/mails/service/ConversationService.js +11 -5
  27. package/dist/web/page/mails/service/ConversationService.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/common/pages/mailboxes/services/MailboxService.ts +25 -1
  30. package/src/web/page/mails/ConversationPage.tsx +3 -0
  31. package/src/web/page/mails/MailboxContacts.tsx +38 -18
  32. package/src/web/page/mails/contact/AddMiniContactPage.tsx +72 -0
  33. package/src/web/page/mails/service/ConversationService.tsx +11 -5
@@ -21,6 +21,7 @@ import { CommonEvents } from "../../../common/events/CommonEvents";
21
21
  import Switch from "@web-atoms/web-controls/dist/basic/Switch";
22
22
  import Checkbox from "@web-atoms/web-controls/dist/basic/Checkbox";
23
23
  import ToggleButtonBar from "@web-atoms/web-controls/dist/basic/ToggleButtonBar";
24
+ import AddMiniContactPage from "./contact/AddMiniContactPage";
24
25
 
25
26
  const css = styled.css `
26
27
  &[data-page-type=master-detail] {
@@ -151,23 +152,23 @@ export default class MailsPage extends MasterDetailPage {
151
152
 
152
153
 
153
154
  // this.actionRenderer = () => <i class="fas fa-plus" data-click-event="compose-email"/>;
154
- this.actionRenderer = () => <div><PopupActionButton
155
- icon="fa-solid fa-plus"
156
- popup={() => <div data-click-event="none" data-click-animate="no" >
157
- <MenuItem
158
- label="Compose Social"
159
- data-click-event="compose-social"
160
- />
161
- <MenuItem
162
- label="Compose Basic"
163
- data-click-event="compose-email"
164
- />
165
- <MenuItem
166
- label="From Template"
167
- data-click-event="compose-template"
168
- />
169
- </div>}
170
- /></div>;
155
+ // this.actionRenderer = () => <div><PopupActionButton
156
+ // icon="fa-solid fa-plus"
157
+ // popup={() => <div data-click-event="none" data-click-animate="no" >
158
+ // <MenuItem
159
+ // label="Compose Social"
160
+ // data-click-event="compose-social"
161
+ // />
162
+ // <MenuItem
163
+ // label="Compose Basic"
164
+ // data-click-event="compose-email"
165
+ // />
166
+ // <MenuItem
167
+ // label="From Template"
168
+ // data-click-event="compose-template"
169
+ // />
170
+ // </div>}
171
+ // /></div>;
171
172
  document.title = mailbox.emailAddress?.emailAddress;
172
173
  if (isMobileView) {
173
174
  this.headerRenderer = () => <div data-layout="row">
@@ -192,7 +193,15 @@ export default class MailsPage extends MasterDetailPage {
192
193
  class="threads"
193
194
  header={true}
194
195
  headerRenderer={() =>
195
- <div data-font-size="smaller"><ToggleButtonBar items={types} value={Bind.sourceTwoWays(this, (x) => x.source.showBlocked)}/></div>
196
+ <div data-layout="row" data-font-size="smaller">
197
+ <ToggleButtonBar items={types} value={Bind.sourceTwoWays(this, (x) => x.source.showBlocked)}/>
198
+ <button
199
+ data-click-event="add-new-contact"
200
+ data-layout="accent-icon-button">
201
+ <i class="fas fa-plus"/>
202
+ Add
203
+ </button>
204
+ </div>
196
205
  }
197
206
  data-list-selection="default"
198
207
  data-items-updated-event="mails-available"
@@ -309,4 +318,15 @@ export default class MailsPage extends MasterDetailPage {
309
318
  this.selectedThread = this.mails[index];
310
319
  }
311
320
 
321
+ @Action({ onEvent: "add-new-contact"})
322
+ async addNewContact() {
323
+ const c = await PageNavigator.pushPageForResult(AddMiniContactPage, { mailboxID: this.parameters.id });
324
+ let existing = this.mails.find((x) => x.emailAddressID === c.emailAddressID);
325
+ if (!existing) {
326
+ existing = c;
327
+ this.mails.add(existing);
328
+ }
329
+ this.selectedThread = existing;
330
+ }
331
+
312
332
  }
@@ -0,0 +1,72 @@
1
+ import { PopupWindowPage } from "@web-atoms/web-controls/dist/mobile-app/MobileApp";
2
+ import { EmailAddress, IEmailAddress, IMailboxContact, MailboxContact } from "../../../../model/model";
3
+ import XNode from "@web-atoms/core/dist/core/XNode";
4
+ import Form from "@web-atoms/web-controls/dist/basic/Form";
5
+ import FormField from "@web-atoms/web-controls/dist/basic/FormField";
6
+ import Bind from "@web-atoms/core/dist/core/Bind";
7
+ import Action from "@web-atoms/core/dist/view-model/Action";
8
+ import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
9
+ import MailboxService from "../../../../common/pages/mailboxes/services/MailboxService";
10
+ import DateTime from "@web-atoms/date-time/dist/DateTime";
11
+
12
+ const errorForInvalidEmail = (e: string) => {
13
+ if(!e) {
14
+ return "Email address is required";
15
+ }
16
+ if(/[\s\:\/\\\#\$\%\^]/i.test(e.trim())) {
17
+ return "Email address cannot contain space or special characters.";
18
+ }
19
+ if (!/\@/i.test(e)) {
20
+ return "Invalid email address";
21
+ }
22
+ return "";
23
+ };
24
+
25
+ export default class AddMiniContactPage extends PopupWindowPage {
26
+
27
+ model: IMailboxContact = MailboxContact.create({
28
+ name: "",
29
+ emailAddressText: ""
30
+ });
31
+
32
+ @InjectProperty
33
+ private mailboxService: MailboxService;
34
+
35
+ async init() {
36
+ this.model.mailboxID = this.parameters.mailboxID;
37
+ this.title = "Add New Contact";
38
+ this.renderer = <div>
39
+ <Form>
40
+ <FormField
41
+ label="Valid Email Address"
42
+ required={true}
43
+ error={Bind.oneWay(() => errorForInvalidEmail(this.model.emailAddressText))}>
44
+ <input
45
+ autofocus={true}
46
+ placeholder="... someone@socialmail.in "
47
+ value={Bind.twoWaysImmediate(() => this.model.emailAddressText)}/>
48
+ </FormField>
49
+ <FormField label="Name">
50
+ <input value={Bind.twoWaysImmediate(() => this.model.name)}/>
51
+ </FormField>
52
+ <div
53
+ data-layout="command-row">
54
+ <button
55
+ data-submit-event="add-contact"
56
+ data-layout="accent-icon-button">
57
+ <i class="fas fa-save"/>
58
+ Add
59
+ </button>
60
+ </div>
61
+ </Form>
62
+ </div>;
63
+ }
64
+
65
+ @Action({ onEvent: "add-contact", close: true })
66
+ async addContact() {
67
+ const now = DateTime.now;
68
+ this.model.dateCreated = now;
69
+ this.model.dateUpdated = now;
70
+ return await this.mailboxService.saveContact(this.model);
71
+ }
72
+ }
@@ -34,11 +34,16 @@ export const renderMail = AtomControl.registerProperty("data-html", "html", (c,
34
34
  for (const iterator of descendentElementIterator(msg)) {
35
35
  if(iterator.tagName === "IMG") {
36
36
  const src = iterator.getAttribute("src");
37
- if (src?.startsWith("cid:")) {
38
- const cid = src.substring(4);
39
- const a = mail.attachments.find((x) => x.contentID === cid);
40
- if (a) {
41
- iterator.setAttribute("src", `/api/files/${a.appFileID}/${a.fileContentID}/${a.name}`);
37
+ if (src) {
38
+ if (src.startsWith("cid:")) {
39
+ const cid = src.substring(4);
40
+ const a = mail.attachments.find((x) => x.contentID === cid);
41
+ if (a) {
42
+ iterator.setAttribute("src", `/api/files/${a.appFileID}/${a.fileContentID}/${a.name}`);
43
+ }
44
+ }
45
+ if (/^http\:\/\//i.test(src)) {
46
+ iterator.setAttribute("src", src.substring(5));
42
47
  }
43
48
  }
44
49
  continue;
@@ -132,6 +137,7 @@ export default class ConversationService {
132
137
  if (create && email) {
133
138
  email.recipients ??= [];
134
139
  email.mailboxes ??= [];
140
+ email.senderID = mailboxID;
135
141
  if (!email.mailboxes.some((m) => m.mailboxID === mailboxID)) {
136
142
  email.mailboxes.push(MailboxEmail.create({
137
143
  mailboxID