@social-mail/social-mail-client 1.2.575 → 1.2.577

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 (40) hide show
  1. package/dist/admin/AdminAppIndex.pack.js +136 -13
  2. package/dist/admin/AdminAppIndex.pack.js.map +1 -1
  3. package/dist/admin/AdminAppIndex.pack.min.js +5 -5
  4. package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
  5. package/dist/services/ffmpeg/FFService.d.ts +4 -0
  6. package/dist/services/ffmpeg/FFService.d.ts.map +1 -0
  7. package/dist/services/ffmpeg/FFService.js +42 -0
  8. package/dist/services/ffmpeg/FFService.js.map +1 -0
  9. package/dist/services/files/LocalFileService.d.ts +7 -1
  10. package/dist/services/files/LocalFileService.d.ts.map +1 -1
  11. package/dist/services/files/LocalFileService.js +22 -10
  12. package/dist/services/files/LocalFileService.js.map +1 -1
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/dist/web/AppIndex.pack.js +136 -13
  15. package/dist/web/AppIndex.pack.js.map +1 -1
  16. package/dist/web/AppIndex.pack.min.js +4 -4
  17. package/dist/web/AppIndex.pack.min.js.map +1 -1
  18. package/dist/web/page/mails/mini-compose/Attach.d.ts.map +1 -1
  19. package/dist/web/page/mails/mini-compose/Attach.js +6 -0
  20. package/dist/web/page/mails/mini-compose/Attach.js.map +1 -1
  21. package/dist/web/page/mails/mini-compose/Insert.d.ts.map +1 -1
  22. package/dist/web/page/mails/mini-compose/Insert.js +6 -0
  23. package/dist/web/page/mails/mini-compose/Insert.js.map +1 -1
  24. package/node_modules/@web-atoms/web-controls/dist/basic/FilesDragDrop.d.ts +5 -1
  25. package/node_modules/@web-atoms/web-controls/dist/basic/FilesDragDrop.d.ts.map +1 -1
  26. package/node_modules/@web-atoms/web-controls/dist/basic/FilesDragDrop.js +8 -0
  27. package/node_modules/@web-atoms/web-controls/dist/basic/FilesDragDrop.js.map +1 -1
  28. package/node_modules/@web-atoms/web-controls/dist/basic/UploadEvent.d.ts +9 -2
  29. package/node_modules/@web-atoms/web-controls/dist/basic/UploadEvent.d.ts.map +1 -1
  30. package/node_modules/@web-atoms/web-controls/dist/basic/UploadEvent.js +9 -2
  31. package/node_modules/@web-atoms/web-controls/dist/basic/UploadEvent.js.map +1 -1
  32. package/node_modules/@web-atoms/web-controls/dist/tsconfig.tsbuildinfo +1 -1
  33. package/node_modules/@web-atoms/web-controls/package.json +1 -1
  34. package/node_modules/@web-atoms/web-controls/src/basic/FilesDragDrop.ts +8 -0
  35. package/node_modules/@web-atoms/web-controls/src/basic/UploadEvent.tsx +12 -2
  36. package/package.json +2 -2
  37. package/src/services/ffmpeg/FFService.ts +38 -0
  38. package/src/services/files/LocalFileService.tsx +18 -6
  39. package/src/web/page/mails/mini-compose/Attach.tsx +6 -0
  40. package/src/web/page/mails/mini-compose/Insert.tsx +6 -0
@@ -16,6 +16,7 @@ import EntityService from "../EntityService";
16
16
  import FetchBuilder from "@web-atoms/core/dist/services/FetchBuilder";
17
17
  import FileUploader, { IUploadRequest, IUploadResult } from "../../common/FileUploader";
18
18
  import { apiPath } from "../../common/apiPath";
19
+ import FFService from "../ffmpeg/FFService";
19
20
 
20
21
  export const acceptDocumentAndMedia = ".doc, .docx, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, video/*, application/pdf, .pdf, .txt, audio/*, image/*, .csv, text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, text/plain, text/html";
21
22
 
@@ -79,10 +80,10 @@ export default class LocalFileService extends TaskManager {
79
80
  constructor() {
80
81
  super();
81
82
  document.body.addEventListener("uploadRequested", (ce: CustomEvent) => {
82
- const { target, detail: { files, extra, uploadEvent } } = ce;
83
+ const { target, detail: { files, extra, uploadEvent, convert } } = ce;
83
84
  ce.preventDefault();
84
85
  this.app.runAsync(async () => {
85
- const detail = await FileUploadWindow.showModal<IUploadedFile>({ parameters: { files, extra }});
86
+ const detail = await FileUploadWindow.showModal<IUploadedFile>({ parameters: ce.detail});
86
87
  target.dispatchEvent(
87
88
  new CustomEvent( StringHelper.fromHyphenToCamel(uploadEvent),
88
89
  { detail, bubbles: true }));
@@ -170,6 +171,8 @@ export default class LocalFileService extends TaskManager {
170
171
  extra = JSON.parse(extra);
171
172
  }
172
173
 
174
+
175
+
173
176
  const sha256 = await this.sha256(file);
174
177
 
175
178
  if (extra?.parentID) {
@@ -250,7 +253,7 @@ export default class LocalFileService extends TaskManager {
250
253
  });
251
254
  }
252
255
 
253
- upload(files: File[], extra: any, ct?: CancelToken) {
256
+ upload({ files, extra, convert, uploadEvent, maxSize }: { files: File[], extra: any, convert: boolean, uploadEvent, maxSize }, ct?: CancelToken) {
254
257
 
255
258
  const tasks = [] as IFileUpload[];
256
259
  const upload = {
@@ -267,6 +270,15 @@ export default class LocalFileService extends TaskManager {
267
270
  progress: 0
268
271
  };
269
272
  uploadFile.promise = this.run(async () => {
273
+
274
+ let targetFile = file;
275
+
276
+ if (convert) {
277
+ if(/video/i.test(targetFile.type) && targetFile.size > maxSize ) {
278
+ targetFile = await FFService.convert(targetFile);
279
+ }
280
+ }
281
+
270
282
  let lastError: string;
271
283
  for(let i=0; i<3; i++) {
272
284
  try {
@@ -274,7 +286,7 @@ export default class LocalFileService extends TaskManager {
274
286
 
275
287
  // we will check if file exists and has same sha256?
276
288
 
277
- const r = await this.uploadFile(file, extra, ct, (n) => uploadFile.progress = n);
289
+ const r = await this.uploadFile(targetFile, extra, ct, (n) => uploadFile.progress = n);
278
290
  upload.progress += r.file.size;
279
291
  setTimeout(() => tasks.remove(uploadFile), 500);
280
292
  upload.error = "";
@@ -298,7 +310,7 @@ export default class LocalFileService extends TaskManager {
298
310
 
299
311
 
300
312
  class FileUploadWindow extends PopupWindow {
301
- public parameters: { files?: File[], uploadEvent?: string, extra?: any } = {};
313
+ public parameters: any = {};
302
314
 
303
315
  @InjectProperty
304
316
  private localFileService: LocalFileService;
@@ -316,7 +328,7 @@ class FileUploadWindow extends PopupWindow {
316
328
  await this.requestCancel();
317
329
  }, null, { capture: true });
318
330
 
319
- const task = this.localFileService.upload(this.parameters.files, this.parameters.extra, this.cancelToken);
331
+ const task = this.localFileService.upload(this.parameters, this.cancelToken);
320
332
  this.files = task.tasks;
321
333
 
322
334
  this.footerRenderer = () => <div data-layout="command-row">
@@ -17,6 +17,7 @@ export default function Attach({ alignment = "above" as IPopupOptions["alignment
17
17
  <MenuItem
18
18
  { ... UploadEvent.AttachUploadAction({
19
19
  accept: "image/*",
20
+ maxSize: 20*1024*1024,
20
21
  multiple: true,
21
22
  extra: {
22
23
  }
@@ -27,6 +28,7 @@ export default function Attach({ alignment = "above" as IPopupOptions["alignment
27
28
  <MenuItem
28
29
  { ... UploadEvent.AttachUploadAction({
29
30
  accept: "image/*",
31
+ maxSize: 20*1024*1024,
30
32
  capture: "user",
31
33
  extra: {
32
34
  }
@@ -38,6 +40,8 @@ export default function Attach({ alignment = "above" as IPopupOptions["alignment
38
40
  { ... UploadEvent.AttachUploadAction({
39
41
  accept: "video/*",
40
42
  multiple: false,
43
+ maxSize: 20*1024*1024,
44
+ convert: true,
41
45
  extra: {
42
46
  }
43
47
  })}
@@ -48,6 +52,8 @@ export default function Attach({ alignment = "above" as IPopupOptions["alignment
48
52
  { ... UploadEvent.AttachUploadAction({
49
53
  accept: "video/*",
50
54
  capture: "user",
55
+ maxSize: 20*1024*1024,
56
+ convert: true,
51
57
  extra: {
52
58
  }
53
59
  })}
@@ -36,6 +36,7 @@ export default function Insert({ alignment = "above" as IPopupOptions["alignment
36
36
  { ... UploadEvent.AttachUploadAction({
37
37
  accept: "image/*",
38
38
  multiple: true,
39
+ maxSize: 20*1024*1024,
39
40
  extra: {
40
41
  insert: true
41
42
  }
@@ -48,6 +49,7 @@ export default function Insert({ alignment = "above" as IPopupOptions["alignment
48
49
  { ... UploadEvent.AttachUploadAction({
49
50
  accept: "image/*",
50
51
  capture: "user",
52
+ maxSize: 20*1024*1024,
51
53
  extra: {
52
54
  insert: true
53
55
  }
@@ -60,6 +62,8 @@ export default function Insert({ alignment = "above" as IPopupOptions["alignment
60
62
  { ... UploadEvent.AttachUploadAction({
61
63
  accept: "video/*",
62
64
  multiple: false,
65
+ maxSize: 20*1024*1024,
66
+ convert: true,
63
67
  extra: {
64
68
  insert: true
65
69
  }
@@ -72,6 +76,8 @@ export default function Insert({ alignment = "above" as IPopupOptions["alignment
72
76
  { ... UploadEvent.AttachUploadAction({
73
77
  accept: "video/*",
74
78
  capture: "user",
79
+ convert: true,
80
+ maxSize: 20*1024*1024,
75
81
  extra: {
76
82
  insert: true
77
83
  }