@droppii-org/chat-sdk 0.1.47 → 0.1.49
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/components/biz-thread-detail/BizAttachmentPreview.d.ts +9 -0
- package/dist/components/biz-thread-detail/BizAttachmentPreview.d.ts.map +1 -0
- package/dist/components/biz-thread-detail/BizAttachmentPreview.js +74 -0
- package/dist/components/biz-thread-detail/BizImageViewer.d.ts +8 -0
- package/dist/components/biz-thread-detail/BizImageViewer.d.ts.map +1 -0
- package/dist/components/biz-thread-detail/BizImageViewer.js +35 -0
- package/dist/components/biz-thread-detail/BizMessageContent.d.ts.map +1 -1
- package/dist/components/biz-thread-detail/BizMessageContent.js +46 -1
- package/dist/components/biz-thread-detail/BizMoreOptionPanel.d.ts +2 -1
- package/dist/components/biz-thread-detail/BizMoreOptionPanel.d.ts.map +1 -1
- package/dist/components/biz-thread-detail/BizMoreOptionPanel.js +6 -2
- package/dist/components/biz-thread-detail/BizThreadDetailInput.d.ts.map +1 -1
- package/dist/components/biz-thread-detail/BizThreadDetailInput.js +32 -7
- package/dist/components/biz-thread-detail/index.d.ts +2 -2
- package/dist/components/biz-thread-detail/index.d.ts.map +1 -1
- package/dist/components/biz-thread-detail/index.js +1 -1
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +57 -32
- package/dist/screens/biz-thread-detail/index.js +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/fileValidation.d.ts +2 -0
- package/dist/utils/fileValidation.d.ts.map +1 -1
- package/dist/utils/fileValidation.js +30 -0
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { TFunction } from "i18next";
|
|
|
3
3
|
export declare const ACCEPTED_IMAGE_TYPES: string[];
|
|
4
4
|
export declare const MAX_IMAGE_SIZE_MB = 5;
|
|
5
5
|
export declare const MAX_VIDEO_SIZE_MB = 200;
|
|
6
|
+
export declare const DOCUMENT_MIME_TYPES: string[];
|
|
6
7
|
export interface FileValidationOptions {
|
|
7
8
|
t: TFunction;
|
|
8
9
|
currentUploadedFiles?: UploadFile[];
|
|
@@ -19,6 +20,7 @@ export declare const validateFile: (file: File, t: TFunction) => FileValidationR
|
|
|
19
20
|
* Validates video count limit (max 1 video)
|
|
20
21
|
*/
|
|
21
22
|
export declare const validateVideoLimit: (newFiles: File[], currentUploadedFiles: UploadFile[], t: TFunction) => FileValidationResult;
|
|
23
|
+
export declare const processAndValidateDocuments: (files: File[], t: TFunction) => UploadFile[];
|
|
22
24
|
/**
|
|
23
25
|
* Process and validate multiple files, converting to UploadFile format
|
|
24
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileValidation.d.ts","sourceRoot":"","sources":["../../src/utils/fileValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,UAAU,EAAE,MAAM,MAAM,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,oBAAoB,UAA2C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,iBAAiB,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"fileValidation.d.ts","sourceRoot":"","sources":["../../src/utils/fileValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,UAAU,EAAE,MAAM,MAAM,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,oBAAoB,UAA2C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,mBAAmB,UAI/B,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,CAAC,EAAE,SAAS,CAAC;IACb,oBAAoB,CAAC,EAAE,UAAU,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,IAAI,EACV,GAAG,SAAS,KACX,oBAuBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,IAAI,EAAE,EAChB,sBAAsB,UAAU,EAAE,EAClC,GAAG,SAAS,KACX,oBAYF,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,OAAO,IAAI,EAAE,EACb,GAAG,SAAS,KACX,UAAU,EAyBZ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,IAAI,EAAE,EACb,SAAS,qBAAqB,KAC7B,UAAU,EAuCZ,CAAC"}
|
|
@@ -2,6 +2,11 @@ import { message as antdMessage } from "antd";
|
|
|
2
2
|
export const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/png", "image/jpg"];
|
|
3
3
|
export const MAX_IMAGE_SIZE_MB = 5;
|
|
4
4
|
export const MAX_VIDEO_SIZE_MB = 200;
|
|
5
|
+
export const DOCUMENT_MIME_TYPES = [
|
|
6
|
+
"application/pdf",
|
|
7
|
+
"application/msword",
|
|
8
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
9
|
+
];
|
|
5
10
|
/**
|
|
6
11
|
* Validates a single file for type and size
|
|
7
12
|
*/
|
|
@@ -37,6 +42,31 @@ export const validateVideoLimit = (newFiles, currentUploadedFiles, t) => {
|
|
|
37
42
|
}
|
|
38
43
|
return { isValid: true };
|
|
39
44
|
};
|
|
45
|
+
export const processAndValidateDocuments = (files, t) => {
|
|
46
|
+
try {
|
|
47
|
+
return files
|
|
48
|
+
.filter((file) => {
|
|
49
|
+
if (!DOCUMENT_MIME_TYPES.includes(file.type)) {
|
|
50
|
+
antdMessage.error(t("invalid_document_format", { fileName: file.name }));
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
})
|
|
55
|
+
.map((file) => ({
|
|
56
|
+
uid: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
57
|
+
name: file.name,
|
|
58
|
+
status: "done",
|
|
59
|
+
type: file.type,
|
|
60
|
+
size: file.size,
|
|
61
|
+
originFileObj: file,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error("Error processing documents:", error);
|
|
66
|
+
antdMessage.error(t("file_processing_error"));
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
};
|
|
40
70
|
/**
|
|
41
71
|
* Process and validate multiple files, converting to UploadFile format
|
|
42
72
|
*/
|