stream-chat 9.50.1 → 9.50.2
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/cjs/index.browser.js +10 -3
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +10 -3
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +10 -3
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/messageComposer/attachmentManager.d.ts +2 -0
- package/package.json +1 -1
- package/src/messageComposer/attachmentManager.ts +15 -2
|
@@ -33,6 +33,8 @@ export declare class AttachmentManager {
|
|
|
33
33
|
setCustomUploadFn: (doUploadRequest: UploadRequestFn) => void;
|
|
34
34
|
get attachments(): LocalAttachment[];
|
|
35
35
|
get hasUploadPermission(): boolean;
|
|
36
|
+
get hasCustomDoUploadRequest(): boolean;
|
|
37
|
+
get hasAvailableUploadSlots(): boolean;
|
|
36
38
|
get isUploadEnabled(): boolean;
|
|
37
39
|
get successfulUploads(): LocalAttachment[];
|
|
38
40
|
get successfulUploadsCount(): number;
|
package/package.json
CHANGED
|
@@ -168,8 +168,16 @@ export class AttachmentManager {
|
|
|
168
168
|
)?.includes('upload-file');
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
get hasCustomDoUploadRequest() {
|
|
172
|
+
return typeof this.config.doUploadRequest === 'function';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
get hasAvailableUploadSlots() {
|
|
176
|
+
return this.availableUploadSlots > 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
171
179
|
get isUploadEnabled() {
|
|
172
|
-
return this.hasUploadPermission && this.
|
|
180
|
+
return this.hasUploadPermission && this.hasAvailableUploadSlots;
|
|
173
181
|
}
|
|
174
182
|
|
|
175
183
|
get successfulUploads() {
|
|
@@ -726,7 +734,12 @@ export class AttachmentManager {
|
|
|
726
734
|
};
|
|
727
735
|
|
|
728
736
|
uploadFiles = async (files: FileReference[] | FileList | FileLike[]) => {
|
|
729
|
-
if (
|
|
737
|
+
if (
|
|
738
|
+
(this.hasCustomDoUploadRequest && !this.hasAvailableUploadSlots) ||
|
|
739
|
+
(!this.hasCustomDoUploadRequest && !this.isUploadEnabled)
|
|
740
|
+
)
|
|
741
|
+
return;
|
|
742
|
+
|
|
730
743
|
const iterableFiles: FileReference[] | FileLike[] = isFileList(files)
|
|
731
744
|
? Array.from(files)
|
|
732
745
|
: files;
|