@social-mail/social-mail-client 1.2.92 → 1.2.95
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/dist/admin/AdminAppIndex.pack.js +57 -134
- package/dist/admin/AdminAppIndex.pack.js.map +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js +4 -4
- package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
- package/dist/common/pages/logs/LogsPage.d.ts.map +1 -1
- package/dist/common/pages/logs/LogsPage.js +1 -1
- package/dist/common/pages/logs/LogsPage.js.map +1 -1
- package/dist/common/pages/logs/services/AppLogService.d.ts +1 -1
- package/dist/common/pages/logs/services/AppLogService.js +3 -3
- package/dist/common/pages/logs/services/AppLogService.js.map +1 -1
- package/dist/model/model.d.ts +18 -112
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +6 -82
- package/dist/model/model.js.map +1 -1
- package/dist/public/channel/ChannelView.pack.js +22 -129
- package/dist/public/channel/ChannelView.pack.js.map +1 -1
- package/dist/public/channel/ChannelView.pack.min.js +1 -1
- package/dist/public/channel/ChannelView.pack.min.js.map +1 -1
- package/dist/services/email/EmailContentDownloader.d.ts +2 -2
- package/dist/services/email/EmailContentDownloader.d.ts.map +1 -1
- package/dist/services/email/EmailContentDownloader.js +5 -11
- package/dist/services/email/EmailContentDownloader.js.map +1 -1
- package/dist/services/socket/sockets.d.ts +1 -0
- package/dist/services/socket/sockets.d.ts.map +1 -1
- package/dist/services/socket/sockets.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/AppIndex.pack.js +57 -134
- package/dist/web/AppIndex.pack.js.map +1 -1
- package/dist/web/AppIndex.pack.min.js +4 -4
- package/dist/web/AppIndex.pack.min.js.map +1 -1
- package/dist/web/page/mails/ConversationPage.d.ts.map +1 -1
- package/dist/web/page/mails/ConversationPage.js +31 -1
- package/dist/web/page/mails/ConversationPage.js.map +1 -1
- package/dist/web/page/mails/service/ConversationService.d.ts +1 -1
- package/dist/web/page/mails/service/ConversationService.d.ts.map +1 -1
- package/dist/web/page/mails/service/ConversationService.js +11 -36
- package/dist/web/page/mails/service/ConversationService.js.map +1 -1
- package/package.json +1 -1
- package/src/common/pages/logs/LogsPage.tsx +4 -4
- package/src/common/pages/logs/services/AppLogService.ts +2 -2
- package/src/model/model.ts +20 -124
- package/src/services/email/EmailContentDownloader.ts +6 -14
- package/src/services/socket/sockets.ts +4 -1
- package/src/web/page/mails/ConversationPage.tsx +35 -2
- package/src/web/page/mails/service/ConversationService.tsx +6 -36
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DISingleton from "@web-atoms/core/dist/di/DISingleton";
|
|
2
2
|
import TaskManager from "@web-atoms/entity/dist/models/TaskManager";
|
|
3
|
-
import { EmailEngagement, IEmail } from "../../model/model";
|
|
3
|
+
import { EmailEngagement, IEmail, IMailboxContactEmail } from "../../model/model";
|
|
4
4
|
import FetchBuilder from "@web-atoms/core/dist/services/FetchBuilder";
|
|
5
5
|
import { Inject } from "@web-atoms/core/dist/di/Inject";
|
|
6
6
|
import EntityService from "../EntityService";
|
|
@@ -9,37 +9,29 @@ import DateTime from "@web-atoms/date-time/dist/DateTime";
|
|
|
9
9
|
@DISingleton({})
|
|
10
10
|
export default class EmailContentDownloader extends TaskManager {
|
|
11
11
|
|
|
12
|
-
async download(
|
|
13
|
-
|
|
14
|
-
if (email.htmlBody) {
|
|
15
|
-
return email.htmlBody;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!email.originalFileID) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
12
|
+
async download(mce: IMailboxContactEmail) {
|
|
21
13
|
|
|
22
14
|
const cache = await window.caches.open("email-content-cache");
|
|
23
15
|
|
|
24
|
-
const cacheKey = new URL(
|
|
16
|
+
const cacheKey = new URL(mce.htmlBodyUrl, location.href);
|
|
25
17
|
|
|
26
18
|
const content = await cache.match(cacheKey);
|
|
27
19
|
|
|
28
20
|
if (content) {
|
|
29
|
-
return email.htmlBody = await content.text();
|
|
21
|
+
return mce.email.htmlBody = await content.text();
|
|
30
22
|
}
|
|
31
23
|
|
|
32
24
|
return await this.run(async () => {
|
|
33
25
|
|
|
34
26
|
for(let i = 0;i<3;i++) {
|
|
35
27
|
try {
|
|
36
|
-
const text = await FetchBuilder.get(
|
|
28
|
+
const text = await FetchBuilder.get(mce.htmlBodyUrl).responseAsText();
|
|
37
29
|
await cache.put(cacheKey, new Response(text, {
|
|
38
30
|
headers: {
|
|
39
31
|
"cache-control": "public, max-age=86000"
|
|
40
32
|
}
|
|
41
33
|
}));
|
|
42
|
-
return email.htmlBody = text;
|
|
34
|
+
return mce.email.htmlBody = text;
|
|
43
35
|
} catch (error){
|
|
44
36
|
// eslint-disable-next-line no-console
|
|
45
37
|
console.error(error);
|
|
@@ -88,7 +88,10 @@ class SocketNamespace {
|
|
|
88
88
|
@DISingleton()
|
|
89
89
|
export class MailboxSocket {
|
|
90
90
|
|
|
91
|
-
async join(room: string, events: {
|
|
91
|
+
async join(room: string, events: {
|
|
92
|
+
newMail(mailboxID, emailAddressID, emailID);
|
|
93
|
+
mailRead?(mailboxID, emailAddressID, emailID);
|
|
94
|
+
}) {
|
|
92
95
|
const disposables = new AtomDisposableList();
|
|
93
96
|
const ns = SocketNamespace.for("mailbox");
|
|
94
97
|
ns.connect(room, events).then((v) => disposables.add(v), console.error);
|
|
@@ -126,7 +126,16 @@ export default class ConversationPage extends ContentPage {
|
|
|
126
126
|
this.registerDisposable(await this.resolve(MailboxSocket).join(mb.mailboxID.toString(), {
|
|
127
127
|
newMail: () => {
|
|
128
128
|
this.version ++;
|
|
129
|
-
}
|
|
129
|
+
},
|
|
130
|
+
mailRead: (mailboxID, emailAddressID, emailID) => {
|
|
131
|
+
for (const iterator of this.mailsRepeater.items) {
|
|
132
|
+
if (iterator.emailID !== emailID) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
iterator.timeRead = DateTime.now;
|
|
136
|
+
this.mailsRepeater.refreshItem(iterator);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
130
139
|
}));
|
|
131
140
|
|
|
132
141
|
this.renderer = <div>
|
|
@@ -153,6 +162,22 @@ export default class ConversationPage extends ContentPage {
|
|
|
153
162
|
const remaining = DateTime.from(item.dateSent ?? DateTime.today).diff(DateTime.now);
|
|
154
163
|
const isSending = thread.email.status === "scheduled" && remaining.totalSeconds > 3;
|
|
155
164
|
|
|
165
|
+
let readStatus = "";
|
|
166
|
+
let readColor = "";
|
|
167
|
+
if (sent) {
|
|
168
|
+
const timeRead = thread.timeRead && DateTime.from(thread.timeRead);
|
|
169
|
+
if (timeRead) {
|
|
170
|
+
readStatus = `Read ${DateFormats.relative.short(timeRead)}`;
|
|
171
|
+
readColor = "green";
|
|
172
|
+
} else if (item.status === "sent"){
|
|
173
|
+
readStatus = "Sent";
|
|
174
|
+
readColor = "yellow";
|
|
175
|
+
} else {
|
|
176
|
+
readStatus = "In queue";
|
|
177
|
+
readColor = "lightblue";
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
156
181
|
if (remaining.totalSeconds > 0) {
|
|
157
182
|
setTimeout(() => this.mailsRepeater.refreshItem(thread), 2000);
|
|
158
183
|
}
|
|
@@ -193,7 +218,15 @@ export default class ConversationPage extends ContentPage {
|
|
|
193
218
|
{thread.email.tags && <div data-layout="row">
|
|
194
219
|
{ ... thread.email.tags.split(",").map((x) => <span text={`#${x.startsWith("#") ? x.substring(1) : x}`}/>)}
|
|
195
220
|
</div>}
|
|
196
|
-
{
|
|
221
|
+
{ sent
|
|
222
|
+
? <div data-layout="row">
|
|
223
|
+
<i
|
|
224
|
+
class="fa-solid fa-circle-small"
|
|
225
|
+
style-color={readColor}
|
|
226
|
+
title={readStatus}
|
|
227
|
+
/>
|
|
228
|
+
</div>
|
|
229
|
+
: <div data-layout="row">
|
|
197
230
|
|
|
198
231
|
<i
|
|
199
232
|
data-click-event="react-email"
|
|
@@ -79,38 +79,6 @@ export const renderMail = AtomControl.registerProperty("data-html", "html", (c,
|
|
|
79
79
|
return;
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
const downloadEmailContent = async (es: EntityService, email: IEmail) => {
|
|
83
|
-
if (email.replyCount) {
|
|
84
|
-
const children = await es.query(Email)
|
|
85
|
-
.where({ emailID: email.emailID }, (p) => (x) => x.emailID === p.emailID && x.engagement !== null)
|
|
86
|
-
.orderByDescending((x) => x.emailID)
|
|
87
|
-
.toPagedList({
|
|
88
|
-
start: 0,
|
|
89
|
-
size: 4,
|
|
90
|
-
cacheVersion: "a",
|
|
91
|
-
cacheSeconds: 900
|
|
92
|
-
});
|
|
93
|
-
email.children = children?.items ?? [];
|
|
94
|
-
} else {
|
|
95
|
-
email.children ??= [];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (!email.originalFileID) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
for(let i=0;i < 10;i++) {
|
|
103
|
-
try {
|
|
104
|
-
const rs = await fetch(email.htmlBodyUrl);
|
|
105
|
-
const text = await rs.text();
|
|
106
|
-
email.htmlBody = text;
|
|
107
|
-
return;
|
|
108
|
-
} catch (error) {
|
|
109
|
-
console.error(error);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
82
|
@DISingleton()
|
|
115
83
|
export default class ConversationService {
|
|
116
84
|
|
|
@@ -210,7 +178,8 @@ export default class ConversationService {
|
|
|
210
178
|
const d = BusyProgress.create();
|
|
211
179
|
|
|
212
180
|
try {
|
|
213
|
-
for (const
|
|
181
|
+
for (const mce of emails.items) {
|
|
182
|
+
const { email } = mce;
|
|
214
183
|
// if (email.htmlBody || typeof email.htmlBody === "string") {
|
|
215
184
|
// continue;
|
|
216
185
|
// }
|
|
@@ -219,7 +188,7 @@ export default class ConversationService {
|
|
|
219
188
|
email.htmlBody ??= "";
|
|
220
189
|
email.textBody ??= "";
|
|
221
190
|
|
|
222
|
-
tasks.push(this.downloadEmailContent(
|
|
191
|
+
tasks.push(this.downloadEmailContent(mce));
|
|
223
192
|
tasks.push(this.engagementService.downloadEngagements(email));
|
|
224
193
|
}
|
|
225
194
|
await Promise.all(tasks);
|
|
@@ -236,7 +205,8 @@ export default class ConversationService {
|
|
|
236
205
|
CommonEvents.onEmailUnscheduled.dispatchEvent(mce);
|
|
237
206
|
}
|
|
238
207
|
|
|
239
|
-
async downloadEmailContent(
|
|
208
|
+
async downloadEmailContent(mce: IMailboxContactEmail) {
|
|
209
|
+
const { email } = mce;
|
|
240
210
|
if (email.replyCount) {
|
|
241
211
|
const children = await this.entityService.query(Email)
|
|
242
212
|
.where({ emailID: email.emailID }, (p) => (x) => x.emailID === p.emailID && x.engagement !== null)
|
|
@@ -251,7 +221,7 @@ export default class ConversationService {
|
|
|
251
221
|
} else {
|
|
252
222
|
email.children ??= [];
|
|
253
223
|
}
|
|
254
|
-
await this.emailContentDownloader.download(
|
|
224
|
+
await this.emailContentDownloader.download(mce);
|
|
255
225
|
}
|
|
256
226
|
|
|
257
227
|
|