@ethora/chat-component 26.9.8 → 26.10.1
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/README.md +1 -1
- package/dist/{ChatProfileModal-3UH0H5Ec.js → ChatProfileModal-Bf5jGPBZ.js} +44 -44
- package/dist/FilePreviewModal-Bwx0RZZw.js +1763 -0
- package/dist/{ManageDataModal-BblTuE9g.js → ManageDataModal-Dhkp0LWH.js} +17 -17
- package/dist/{MarkdownBody-RMEx8yW2.js → MarkdownBody-_sUhW2O8.js} +1 -1
- package/dist/{MessageSearchModal-CrYR2EH8.js → MessageSearchModal-rwwWrILl.js} +40 -40
- package/dist/{PublicChatsModal-Bi5r4mrV.js → PublicChatsModal-Byso6_vt.js} +19 -19
- package/dist/{SideDrawer-CDAoobvX.js → SideDrawer-CQPOf0ek.js} +35 -35
- package/dist/{UserProfileModal-4Frgvam-.js → UserProfileModal-Vj2kICvc.js} +10 -10
- package/dist/{UserSettingsModal-C-mb-9cb.js → UserSettingsModal-CioX4ZIV.js} +5 -5
- package/dist/{VideoCallOverlay-92dFLb9U.js → VideoCallOverlay-DodAkiam.js} +3824 -3708
- package/dist/{VisibilityModal-zIAV6dAP.js → VisibilityModal-CIl7rkBM.js} +11 -11
- package/dist/assets/icons.d.ts +2 -3
- package/dist/components/Files/fileCategory.d.ts +4 -2
- package/dist/components/MainComponents/AlbumGrid.d.ts +22 -0
- package/dist/components/MainComponents/AttachmentList.d.ts +6 -6
- package/dist/components/MainComponents/ImageUnavailable.d.ts +21 -0
- package/dist/components/MainComponents/MediaUploadOverlay.d.ts +31 -0
- package/dist/components/MainComponents/MessageContainer.d.ts +3 -0
- package/dist/components/MessageBubble/MediaCaption.d.ts +9 -0
- package/dist/components/MessageBubble/MessageAvatarPhoto.d.ts +17 -0
- package/dist/components/MessageBubble/MessageReaction.d.ts +6 -0
- package/dist/components/MessageBubble/QuickReplies.d.ts +2 -0
- package/dist/components/Modals/FilePreviewModal/FilePreviewModal.d.ts +8 -10
- package/dist/components/Modals/FilePreviewModal/ImageLightbox.d.ts +4 -0
- package/dist/components/Modals/FilePreviewModal/PdfView.d.ts +4 -0
- package/dist/components/Modals/FilePreviewModal/ViewerChrome.d.ts +64 -0
- package/dist/components/RoomComponents/LastMessageItem.d.ts +2 -0
- package/dist/components/RoomComponents/styled/LastMessageMedia.d.ts +19 -0
- package/dist/components/RoomComponents/styled/LastTextMessage.d.ts +2 -2
- package/dist/components/RoomComponents/styled/StyledRoomComponents.d.ts +10 -3
- package/dist/components/VideoCalls/VideoCallSession.d.ts +13 -0
- package/dist/components/styled/FileCard.d.ts +20 -0
- package/dist/components/styled/MediaSurface.d.ts +50 -0
- package/dist/components/styled/MessageImage.d.ts +9 -10
- package/dist/components/styled/SendInput.d.ts +12 -2
- package/dist/components/styled/StyledComponents.d.ts +69 -2
- package/dist/components/styled/StyledInputComponents/MediaComponents.d.ts +36 -24
- package/dist/components/styled/UnsupportedType.d.ts +1 -0
- package/dist/components/styled/VideoMessage.d.ts +11 -6
- package/dist/e2ee/callKey.d.ts +32 -0
- package/dist/e2ee/fileEnvelope.d.ts +16 -5
- package/dist/e2ee/omemo.d.ts +18 -0
- package/dist/firebase-messaging-sw.js +20 -3
- package/dist/{handleCopyClick-BtXos0AJ.js → handleCopyClick-DGaZhy_u.js} +1 -1
- package/dist/helpers/albumLayout.d.ts +53 -0
- package/dist/helpers/attachments.d.ts +22 -1
- package/dist/helpers/avatarImageCache.d.ts +9 -0
- package/dist/helpers/caption.d.ts +63 -0
- package/dist/helpers/composerFocus.d.ts +22 -0
- package/dist/helpers/createMainMessageForThread.d.ts +1 -1
- package/dist/helpers/downloadFile.d.ts +19 -0
- package/dist/helpers/fileKind.d.ts +17 -0
- package/dist/helpers/lastMessagePreview.d.ts +55 -0
- package/dist/helpers/mapWithConcurrency.d.ts +8 -0
- package/dist/helpers/mediaBox.d.ts +110 -0
- package/dist/helpers/mediaBubble.d.ts +39 -0
- package/dist/helpers/mediaLabel.d.ts +10 -0
- package/dist/helpers/mediaSendRetry.d.ts +25 -0
- package/dist/helpers/messageRuns.d.ts +10 -0
- package/dist/helpers/repairFilenameEncoding.d.ts +11 -0
- package/dist/helpers/roomImageGallery.d.ts +34 -0
- package/dist/helpers/safeUrl.d.ts +15 -0
- package/dist/helpers/secureFileUrl.d.ts +4 -1
- package/dist/helpers/viewerSender.d.ts +47 -0
- package/dist/hooks/useAvatarImage.d.ts +21 -0
- package/dist/hooks/useIsMobileViewport.d.ts +5 -0
- package/dist/hooks/useMediaProbe.d.ts +40 -0
- package/dist/hooks/usePaneWidthVar.d.ts +11 -0
- package/dist/hooks/usePdfThumbnail.d.ts +0 -1
- package/dist/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/dist/hooks/useSendMessage.d.ts +4 -1
- package/dist/{main-BnLtessp.js → main-CUB_w8AZ.js} +17712 -14488
- package/dist/main.js +10 -10
- package/dist/networking/api-requests/auth.api.d.ts +2 -0
- package/dist/networking/callKeyStanza.d.ts +7 -0
- package/dist/networking/stanzaHandlers.d.ts +4 -2
- package/dist/networking/xmpp/sendDisplayedMarker.xmpp.d.ts +2 -0
- package/dist/networking/xmpp/sendMediaMessage.xmpp.d.ts +8 -0
- package/dist/networking/xmpp/sendReceivedReceipt.xmpp.d.ts +2 -0
- package/dist/networking/xmppClient.d.ts +5 -0
- package/dist/roomStore/callSlice.d.ts +6 -1
- package/dist/roomStore/index.d.ts +10 -0
- package/dist/roomStore/roomsSlice.d.ts +18 -3
- package/dist/styles/motion.d.ts +22 -2
- package/dist/types/models/attachment.model.d.ts +19 -0
- package/dist/types/models/config.model.d.ts +28 -2
- package/dist/types/models/customComponents.model.d.ts +2 -0
- package/dist/types/models/message.model.d.ts +9 -0
- package/dist/types/models/modal.model.d.ts +19 -0
- package/dist/types/models/room.model.d.ts +16 -0
- package/dist/types/models/xmpp.model.d.ts +3 -0
- package/dist/utils/messageNotificationContent.d.ts +34 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/public/firebase-messaging-sw.js +20 -3
- package/dist/FilePreviewModal-Cgj1iHry.js +0 -743
- package/dist/components/RoomComponents/styled/LastAudioMessage.d.ts +0 -6
- package/dist/components/RoomComponents/styled/LastMessageFile.d.ts +0 -6
- package/dist/components/RoomComponents/styled/LastMessagePhoto.d.ts +0 -6
- package/dist/components/RoomComponents/styled/LastMessageVideo.d.ts +0 -6
|
@@ -42,21 +42,88 @@ export declare const UserName: import('styled-components/dist/types').IStyledCom
|
|
|
42
42
|
export declare const InputContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
43
43
|
export declare const MessageInput: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
|
|
44
44
|
export declare const SendButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
45
|
+
/**
|
|
46
|
+
* How far a reaction row hangs below the bubble's bottom edge, in px. The row
|
|
47
|
+
* straddles the edge, so half of it (12px) is inside the bubble and the other
|
|
48
|
+
* half is the only space the message row reserves below it.
|
|
49
|
+
*/
|
|
50
|
+
export declare const REACTION_HANG_PX = 12;
|
|
51
|
+
/** Clear space between the lowest reaction chip and the next bubble, in px. */
|
|
52
|
+
export declare const REACTION_CLEAR_PX = 4;
|
|
53
|
+
/** Vertical gap below a message that is followed by the same sender, in px. */
|
|
54
|
+
export declare const RUN_GAP_PX = 2;
|
|
55
|
+
/** Vertical gap below the last message of a run, before the next sender, in px. */
|
|
56
|
+
export declare const SENDER_GAP_PX = 8;
|
|
57
|
+
/** Side gutter of a message row, so a bubble's tail is not clipped, in px. */
|
|
58
|
+
export declare const MESSAGE_ROW_GUTTER_PX = 6;
|
|
45
59
|
export declare const CustomMessageContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
46
60
|
$isUser: boolean;
|
|
47
61
|
$reply: boolean;
|
|
48
|
-
|
|
62
|
+
/** The bubble carries a reaction row that hangs below its bottom edge. */
|
|
63
|
+
$reaction?: boolean;
|
|
64
|
+
/** False when the next message comes from the same sender (a run). */
|
|
65
|
+
$lastInGroup?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* How far the reaction chips hang below the bubble, in px, as measured by
|
|
68
|
+
* MessageReaction (one row is REACTION_HANG_PX). Only used with $reaction.
|
|
69
|
+
*/
|
|
70
|
+
$reactionHang?: number;
|
|
49
71
|
}>> & string;
|
|
72
|
+
/**
|
|
73
|
+
* Visual inset between a bubble's edge and what it holds, in px. A bubble with
|
|
74
|
+
* a 1px border (anyone else's message) takes one px less of padding so the
|
|
75
|
+
* visual inset still matches.
|
|
76
|
+
*
|
|
77
|
+
* Media bubbles (pictures, videos, file cards, voice notes) use 6px on every
|
|
78
|
+
* side, the compact Telegram-style inset that the media block aligns to. Text
|
|
79
|
+
* bubbles use 8px vertical and 12px horizontal.
|
|
80
|
+
*/
|
|
81
|
+
export declare const MEDIA_BUBBLE_INSET_PX = 6;
|
|
82
|
+
export declare const TEXT_BUBBLE_INSET_Y_PX = 8;
|
|
83
|
+
export declare const TEXT_BUBBLE_INSET_X_PX = 12;
|
|
84
|
+
/** Bubble corner radius; media inside it is concentric (radius minus inset). */
|
|
85
|
+
export declare const BUBBLE_RADIUS_PX = 18;
|
|
86
|
+
export declare const MEDIA_RADIUS_PX: number;
|
|
87
|
+
/** Glass time pill over media: how far it sits inside the media edge, in px. */
|
|
88
|
+
export declare const MEDIA_TIME_PILL_OFFSET_PX = 8;
|
|
89
|
+
/** Padding (CSS shorthand value) that yields the visual inset, net of the border. */
|
|
90
|
+
export declare const bubblePadding: (props: {
|
|
91
|
+
$isUser: boolean;
|
|
92
|
+
$deleted: boolean;
|
|
93
|
+
$media?: boolean;
|
|
94
|
+
}) => string;
|
|
95
|
+
/** Corner radius where a tail attaches: the bottom corner on the tail side. */
|
|
96
|
+
export declare const TAIL_CORNER_RADIUS_PX = 4;
|
|
97
|
+
/** Tail box: 10px wide, 12px tall, 6px of it outside the bubble edge. */
|
|
98
|
+
export declare const TAIL_WIDTH_PX = 10;
|
|
99
|
+
export declare const TAIL_HEIGHT_PX = 12;
|
|
50
100
|
export declare const CustomMessageBubble: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
51
101
|
$isUser: boolean;
|
|
52
102
|
$deleted: boolean;
|
|
103
|
+
/** The bubble carries a media block (pictures, videos, cards, voice notes). */
|
|
104
|
+
$media?: boolean;
|
|
105
|
+
/** Its only media is one solo picture or video: the bubble hugs it. */
|
|
106
|
+
$solo?: boolean;
|
|
107
|
+
/** Last of its sender's run, and not a media-only bubble: it gets the tail. */
|
|
108
|
+
$tail?: boolean;
|
|
53
109
|
}>> & string;
|
|
54
110
|
export declare const CustomMessageText: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
55
111
|
export declare const CustomUserName: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
56
112
|
$isUser: boolean;
|
|
57
113
|
$color?: string;
|
|
114
|
+
/** Inside a media bubble (6px inset): 4px more so it lines up with the caption. */
|
|
115
|
+
$media?: boolean;
|
|
116
|
+
}>> & string;
|
|
117
|
+
export declare const CustomMessageTimestamp: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
118
|
+
/** Media bubble: the row sits under the media with 0 8px 4px padding. */
|
|
119
|
+
$media?: boolean;
|
|
120
|
+
/** Text bubble: the time floats at the end of the last line of text. */
|
|
121
|
+
$inline?: boolean;
|
|
122
|
+
/** Glass pill over the media's bottom right corner (media-only bubbles). */
|
|
123
|
+
$overlay?: boolean;
|
|
124
|
+
/** Whether the bubble has its 1px border (it shifts the pill by one px). */
|
|
125
|
+
$bordered?: boolean;
|
|
58
126
|
}>> & string;
|
|
59
|
-
export declare const CustomMessageTimestamp: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
60
127
|
export declare const CustomMessagePhoto: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>> & string;
|
|
61
128
|
export declare const CustomMessagePhotoContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
62
129
|
export declare const CustomSystemMessage: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1,33 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const
|
|
9
|
-
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Loading spinner rules shared by the media loading states. The spinner is
|
|
4
|
+
* a fixed-pixel circle with `flex: none`, so a flex parent (the upload scrim,
|
|
5
|
+
* a tiny album tile) cannot squash it into an oval. Whether it is drawn at
|
|
6
|
+
* all is decided by a container query on the box it sits in, see below.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MEDIA_SPINNER_PX = 24;
|
|
9
|
+
/** Boxes smaller than this (on either side) get the shimmer only, no spinner. */
|
|
10
|
+
export declare const MEDIA_SPINNER_MIN_BOX_PX = 48;
|
|
11
|
+
export declare const MediaLoadingSkeleton: React.FC<{
|
|
12
|
+
$width?: number;
|
|
13
|
+
$height?: number;
|
|
14
|
+
}>;
|
|
15
|
+
/** Standalone spinner for a loading overlay. Hidden inside boxes under the min size. */
|
|
16
|
+
export declare const MediaSpinner: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
17
|
+
export declare const Container: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
18
|
+
export declare const FullScreenImage: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>> & string;
|
|
19
|
+
export declare const ModalContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
20
|
+
export declare const ButtonContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
21
|
+
export declare const IconButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
22
|
+
export declare const UnsupportedContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
23
|
+
export declare const BackgroundFile: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
24
|
+
export declare const FileInformation: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
25
|
+
export declare const FileName: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
26
|
+
export declare const FileSizeContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
27
|
+
export declare const FileSize: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
16
28
|
/** Wraps every attachment of one message. Single-file messages keep the
|
|
17
29
|
* old, un-gapped look because there is nothing to separate them from. */
|
|
18
|
-
export declare const AttachmentStack: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<
|
|
19
|
-
export declare const AttachmentGrid: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<
|
|
30
|
+
export declare const AttachmentStack: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
31
|
+
export declare const AttachmentGrid: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
20
32
|
$columns: number;
|
|
21
33
|
}>> & string;
|
|
22
|
-
export declare const AttachmentTile: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<
|
|
23
|
-
export declare const PdfContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<
|
|
34
|
+
export declare const AttachmentTile: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
35
|
+
export declare const PdfContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
24
36
|
$compact: boolean;
|
|
25
37
|
}>> & string;
|
|
26
|
-
export declare const PdfThumbnailFrame: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<
|
|
38
|
+
export declare const PdfThumbnailFrame: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
27
39
|
$compact: boolean;
|
|
28
40
|
}>> & string;
|
|
29
41
|
/** Sits on the thumbnail while pdf.js parses so the row does not pop in. */
|
|
30
|
-
export declare const PdfThumbnailSkeleton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<
|
|
31
|
-
export declare const PdfInformation: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<
|
|
32
|
-
export declare const PdfMetaRow: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<
|
|
33
|
-
export declare const PdfBadge: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<
|
|
42
|
+
export declare const PdfThumbnailSkeleton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
43
|
+
export declare const PdfInformation: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
44
|
+
export declare const PdfMetaRow: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
45
|
+
export declare const PdfBadge: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
/** Full-size player used by the preview modal. Kept here with the bubble video. */
|
|
3
|
+
export declare const FullScreenVideo: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, never>> & string;
|
|
2
4
|
interface CustomMessageVideoProps {
|
|
3
5
|
fileName: string;
|
|
4
6
|
fileURL: string;
|
|
5
7
|
mimetype: string;
|
|
8
|
+
/** Length in seconds, when the attachment recorded one. */
|
|
9
|
+
duration?: string;
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
6
12
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export declare const IconButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
13
|
+
/**
|
|
14
|
+
* A single video in a bubble: the first frame with a glass play button and,
|
|
15
|
+
* when known, a duration chip. A click opens the preview modal, which holds
|
|
16
|
+
* the controls.
|
|
17
|
+
*/
|
|
13
18
|
declare const CustomMessageVideo: React.FC<CustomMessageVideoProps>;
|
|
14
19
|
export default CustomMessageVideo;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Element } from 'ltx';
|
|
2
|
+
/** Namespace of the <call-key> signal element carried inside the SCE envelope. */
|
|
3
|
+
export declare const NS_CALL_E2EE = "ethora:call:e2ee:0";
|
|
4
|
+
/**
|
|
5
|
+
* A fresh 256-bit media key for one call, as a base64 string. A new key per
|
|
6
|
+
* call gives forward secrecy between calls: a key recovered from one call
|
|
7
|
+
* cannot open the next. The string is fed verbatim to both peers'
|
|
8
|
+
* `ExternalE2EEKeyProvider.setKey`, which HKDFs it into the frame key.
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateCallKey(): string;
|
|
11
|
+
/** The <call-key> element that rides inside the OMEMO SCE envelope. */
|
|
12
|
+
export declare function callKeyElement(callId: string, key: string): Element;
|
|
13
|
+
/**
|
|
14
|
+
* Hands `key` to every member of `roomJid`, end-to-end encrypted via OMEMO so
|
|
15
|
+
* the server never sees it.
|
|
16
|
+
*
|
|
17
|
+
* Returns false (a no-op) unless E2EE is enabled for the app AND the backend
|
|
18
|
+
* marked the room `e2ee`, or when no member has published an OMEMO device yet
|
|
19
|
+
* (in which case the caller falls back to a non-E2EE call rather than
|
|
20
|
+
* failing). Returns true once the encrypted key is on its way to at least one
|
|
21
|
+
* recipient device.
|
|
22
|
+
*/
|
|
23
|
+
export declare function distributeCallKey(roomJid: string, callId: string, key: string): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Reads a decrypted <call-key> off a stanza the OMEMO seam has already
|
|
26
|
+
* rewritten in place (so the element sits as an ordinary child). Returns
|
|
27
|
+
* undefined when the stanza is not a call-key signal.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseCallKey(stanza: Element): {
|
|
30
|
+
callId: string;
|
|
31
|
+
key: string;
|
|
32
|
+
} | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IMentionSpan } from '../types/types';
|
|
1
2
|
/** What the server must not learn, and the receiver needs to render. */
|
|
2
3
|
export interface FileEnvelopeMeta {
|
|
3
4
|
mimetype: string;
|
|
@@ -37,12 +38,22 @@ export declare function openSealedFile(ciphertext: Uint8Array, keyMaterial: stri
|
|
|
37
38
|
meta: FileEnvelopeMeta;
|
|
38
39
|
bytes: Uint8Array;
|
|
39
40
|
};
|
|
41
|
+
/** What a sealed media <body> carries besides the keys. */
|
|
42
|
+
export interface SealedMediaPayload {
|
|
43
|
+
keys: string[];
|
|
44
|
+
/** The text typed with the files. Sealed here, never on <data>. */
|
|
45
|
+
caption?: string;
|
|
46
|
+
captionMentions?: IMentionSpan[];
|
|
47
|
+
}
|
|
40
48
|
/**
|
|
41
|
-
* Pull the attachment keys out of a
|
|
49
|
+
* Pull the attachment keys (and the caption, when there is one) out of a
|
|
50
|
+
* decrypted media <body>.
|
|
42
51
|
*
|
|
43
|
-
* The sender put `{v:1,keys:[...]}` there instead of
|
|
44
|
-
* "media" (see sendMediaMessage). Returns undefined for
|
|
45
|
-
* an ordinary media message - or one from a build that
|
|
46
|
-
* falls through untouched.
|
|
52
|
+
* The sender put `{v:1,keys:[...],caption?,captionMentions?}` there instead of
|
|
53
|
+
* the usual literal "media" (see sendMediaMessage). Returns undefined for
|
|
54
|
+
* anything else, so an ordinary media message - or one from a build that
|
|
55
|
+
* predates sealing - falls through untouched.
|
|
47
56
|
*/
|
|
57
|
+
export declare function parseSealedMediaPayload(body?: string): SealedMediaPayload | undefined;
|
|
58
|
+
/** The attachment keys out of a sealed media <body>; see parseSealedMediaPayload. */
|
|
48
59
|
export declare function parseSealedMediaBody(body?: string): string[] | undefined;
|
package/dist/e2ee/omemo.d.ts
CHANGED
|
@@ -105,6 +105,24 @@ export declare class Omemo {
|
|
|
105
105
|
* the room's echo by it.
|
|
106
106
|
*/
|
|
107
107
|
encryptGroupMessage(roomJid: string, members: string[], content: Element[], id: string, cleartext?: Element[]): Promise<Element>;
|
|
108
|
+
/**
|
|
109
|
+
* Sends an ephemeral, end-to-end encrypted control signal to a room's
|
|
110
|
+
* members. Same OMEMO envelope as `encryptGroupMessage`, but it is NOT a
|
|
111
|
+
* chat message: no fallback <body>, no <store> hint, and MAM/carbons are
|
|
112
|
+
* asked to drop it (`no-store` / `no-permanent-store` / `no-copy`).
|
|
113
|
+
*
|
|
114
|
+
* The use case is handing a LiveKit call's media key to the other
|
|
115
|
+
* participants without the server - or anyone relaying the stanza - ever
|
|
116
|
+
* seeing it. The payload rides inside the SCE envelope exactly like a
|
|
117
|
+
* message body would, so the server observes ciphertext only.
|
|
118
|
+
*
|
|
119
|
+
* Returns true when at least one recipient device was reachable (so the
|
|
120
|
+
* caller knows the key actually went out), false when nobody in the room
|
|
121
|
+
* has published an OMEMO device yet. Unlike `encryptGroupMessage` it does
|
|
122
|
+
* not throw on an empty recipient set: a call simply falls back to plaintext
|
|
123
|
+
* media rather than failing, and the caller decides what to surface.
|
|
124
|
+
*/
|
|
125
|
+
sendGroupSignal(roomJid: string, members: string[], content: Element[], id: string): Promise<boolean>;
|
|
108
126
|
/**
|
|
109
127
|
* Empty OMEMO message: completes a session the peer started. It targets one
|
|
110
128
|
* device, so it goes straight to that member's real JID rather than through
|
|
@@ -151,8 +151,25 @@ async function checkAssetAvailability(url) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
// `<appId>_<userId>` (24-hex ids, or an appId and a uuid) is a machine id,
|
|
155
|
+
// never something to put in a notification title.
|
|
156
|
+
const OPAQUE_ID_RE =
|
|
157
|
+
/^(?:[0-9a-f]{24}(?:_[0-9a-f]{24})?|[a-z0-9]+_(?:[0-9a-f]{24}|[0-9a-f-]{36})(?:_[0-9a-z-]+)*)$/i;
|
|
158
|
+
|
|
159
|
+
function isOpaqueId(value) {
|
|
160
|
+
const text = String(value || '').trim();
|
|
161
|
+
return !!text && OPAQUE_ID_RE.test(text.split('@')[0]);
|
|
162
|
+
}
|
|
163
|
+
|
|
154
164
|
function pickTitle(raw = {}, data = {}, notification = {}) {
|
|
155
|
-
|
|
165
|
+
const title = notification.title || raw.title || data.title || '';
|
|
166
|
+
return title && !isOpaqueId(title) ? title : 'New Message';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// One notification per chat: a newer message in the same room replaces it.
|
|
170
|
+
function roomTag(data = {}) {
|
|
171
|
+
const jid = String(data.jid || '').split('@')[0];
|
|
172
|
+
return jid ? `ethora-room-${jid}` : '';
|
|
156
173
|
}
|
|
157
174
|
|
|
158
175
|
function pickBody(raw = {}, data = {}, notification = {}) {
|
|
@@ -449,8 +466,8 @@ async function handlePush(raw = {}, source = 'push') {
|
|
|
449
466
|
icon,
|
|
450
467
|
badge,
|
|
451
468
|
image,
|
|
452
|
-
tag: isCall ? `call:${callId || dedupKey}` : dedupKey,
|
|
453
|
-
renotify: isCall,
|
|
469
|
+
tag: isCall ? `call:${callId || dedupKey}` : roomTag(data) || dedupKey,
|
|
470
|
+
renotify: isCall || !!roomTag(data),
|
|
454
471
|
requireInteraction: isCall,
|
|
455
472
|
// Spread the ORIGINAL payload first so the click handler's isCallPush()
|
|
456
473
|
// sees the full call fields (callId/callToken/kind/room); our routing
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geometry for a multi-media album bubble. Pure data so the grid component
|
|
3
|
+
* stays a dumb renderer and the layout rules can be tested without a DOM.
|
|
4
|
+
*
|
|
5
|
+
* 1 item full width, 4:3
|
|
6
|
+
* 2 items side by side, square cells
|
|
7
|
+
* 3 items one large cell on the left, two stacked on the right
|
|
8
|
+
* 4 items 2 x 2
|
|
9
|
+
* 5+ items 2 x 2 showing the first four, the last cell carries "+N"
|
|
10
|
+
*/
|
|
11
|
+
/** Gap between neighbouring tiles. */
|
|
12
|
+
export declare const ALBUM_GAP_PX = 3;
|
|
13
|
+
/** Radius of a tile corner that sits on the bubble's own corner. */
|
|
14
|
+
export declare const ALBUM_OUTER_RADIUS_PX = 12;
|
|
15
|
+
/** Radius of every other tile corner, the ones that face a neighbour. */
|
|
16
|
+
export declare const ALBUM_INNER_RADIUS_PX = 3;
|
|
17
|
+
export interface AlbumCellPlacement {
|
|
18
|
+
/** CSS `grid-column` value. */
|
|
19
|
+
column: string;
|
|
20
|
+
/** CSS `grid-row` value. */
|
|
21
|
+
row: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AlbumLayout {
|
|
24
|
+
kind: 'full' | 'pair' | 'hero' | 'quad';
|
|
25
|
+
/** Number of tiles actually drawn. */
|
|
26
|
+
visible: number;
|
|
27
|
+
/** Items folded into the "+N" overlay on the last visible tile. */
|
|
28
|
+
hidden: number;
|
|
29
|
+
/** CSS `grid-template-columns`. */
|
|
30
|
+
columns: string;
|
|
31
|
+
/** CSS `grid-template-rows`. */
|
|
32
|
+
rows: string;
|
|
33
|
+
/** CSS `aspect-ratio` of the whole grid. */
|
|
34
|
+
aspectRatio: string;
|
|
35
|
+
/** One entry per visible tile, in order. */
|
|
36
|
+
placements: AlbumCellPlacement[];
|
|
37
|
+
}
|
|
38
|
+
/** Layout for `count` media tiles. Counts below 1 are treated as 1. */
|
|
39
|
+
export declare const getAlbumLayout: (count: number) => AlbumLayout;
|
|
40
|
+
/**
|
|
41
|
+
* Which corners of one tile lie on the bubble's outer edge. Only those get
|
|
42
|
+
* the large radius; corners that face a neighbour get the small inner one.
|
|
43
|
+
*/
|
|
44
|
+
export interface TileCorners {
|
|
45
|
+
topLeft: boolean;
|
|
46
|
+
topRight: boolean;
|
|
47
|
+
bottomRight: boolean;
|
|
48
|
+
bottomLeft: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** Outer-corner flags for the tile at `position` (0-based) of `layout`. */
|
|
51
|
+
export declare const getTileCorners: (layout: AlbumLayout, position: number) => TileCorners;
|
|
52
|
+
/** CSS `border-radius` shorthand (TL TR BR BL) for one tile. */
|
|
53
|
+
export declare const getTileBorderRadius: (layout: AlbumLayout, position: number) => string;
|
|
@@ -28,6 +28,27 @@ export declare const serializeAttachments: (attachments: IAttachment[]) => strin
|
|
|
28
28
|
* predates this feature - and every message from a client that does not
|
|
29
29
|
* speak it - takes the second path.
|
|
30
30
|
*/
|
|
31
|
-
export declare const getMessageAttachments: (message?: Pick<IMessage, "attachments" | "location" | "locationPreview" | "mimetype" | "originalName" | "fileName" | "size">
|
|
31
|
+
export declare const getMessageAttachments: (message?: (Pick<IMessage, "attachments" | "location" | "locationPreview" | "mimetype" | "originalName" | "fileName" | "size"> & {
|
|
32
|
+
duration?: unknown;
|
|
33
|
+
mediaDuration?: unknown;
|
|
34
|
+
}) | null) => IAttachment[];
|
|
35
|
+
/**
|
|
36
|
+
* True when the message carries a file: flagged `isMediafile`, or (older
|
|
37
|
+
* senders that never set the flag) with a real file URL or attachment. The
|
|
38
|
+
* one test every surface uses for "is this a media bubble".
|
|
39
|
+
*/
|
|
40
|
+
export declare const isMediaMessage: (message?: (Partial<Pick<IMessage, "isDeleted" | "isMediafile" | "attachments">> & {
|
|
41
|
+
location?: unknown;
|
|
42
|
+
mimetype?: unknown;
|
|
43
|
+
originalName?: unknown;
|
|
44
|
+
fileName?: unknown;
|
|
45
|
+
locationPreview?: unknown;
|
|
46
|
+
}) | null) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Maps one object from POST /files/ `results` to the attachment a sent
|
|
49
|
+
* message carries. Field names here follow the API's own spelling
|
|
50
|
+
* (`originalname`, `filename`), not the wire attribute names.
|
|
51
|
+
*/
|
|
52
|
+
export declare const toUploadedAttachment: (raw: any) => IAttachment;
|
|
32
53
|
/** Name to show for an attachment, with the URL tail as the last resort. */
|
|
33
54
|
export declare const getAttachmentName: (attachment: IAttachment) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const FAILED_TTL_MS = 60000;
|
|
2
|
+
export declare const avatarIdentity: (url: string) => string;
|
|
3
|
+
/** The URL that already loaded for this file (any token), if any. */
|
|
4
|
+
export declare const getLoadedAvatarUrl: (url: string) => string | undefined;
|
|
5
|
+
export declare const markAvatarLoaded: (url: string) => void;
|
|
6
|
+
export declare const markAvatarFailed: (url: string) => void;
|
|
7
|
+
export declare const hasAvatarFailed: (url: string) => boolean;
|
|
8
|
+
/** Test helper. */
|
|
9
|
+
export declare const resetAvatarCache: () => void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { IMentionSpan } from '../types/types';
|
|
2
|
+
/**
|
|
3
|
+
* The text typed with a set of attachments, sent as part of the media
|
|
4
|
+
* message itself (never as a separate text stanza).
|
|
5
|
+
*
|
|
6
|
+
* `mentions` index into `text`, the same way a text message's mention spans
|
|
7
|
+
* index into its body.
|
|
8
|
+
*/
|
|
9
|
+
export interface CaptionInput {
|
|
10
|
+
text: string;
|
|
11
|
+
mentions?: IMentionSpan[];
|
|
12
|
+
}
|
|
13
|
+
export interface NormalizedCaption {
|
|
14
|
+
caption: string;
|
|
15
|
+
mentions?: IMentionSpan[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Mention spans for a caption, checked against the caption text: a span that
|
|
19
|
+
* no longer reads "@Name" at its offset is dropped. Undefined when nothing is
|
|
20
|
+
* left, so a caption without mentions carries no empty attribute.
|
|
21
|
+
*/
|
|
22
|
+
export declare const normalizeCaptionMentions: (value: unknown, caption: string) => IMentionSpan[] | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Turns what the composer typed into the caption that travels with the
|
|
25
|
+
* media. Undefined for blank text, which means "no caption".
|
|
26
|
+
*/
|
|
27
|
+
export declare const normalizeCaptionInput: (input?: CaptionInput | null) => NormalizedCaption | undefined;
|
|
28
|
+
/** What a media message's text is, and the @-mention spans that index into it. */
|
|
29
|
+
export interface ResolvedCaption {
|
|
30
|
+
text: string;
|
|
31
|
+
mentions?: IMentionSpan[];
|
|
32
|
+
}
|
|
33
|
+
export interface CaptionOptions {
|
|
34
|
+
/**
|
|
35
|
+
* The caller already knows this is a media message (a thin `lastMessage`
|
|
36
|
+
* that only says so by its id). Otherwise it is read off the message.
|
|
37
|
+
*/
|
|
38
|
+
isMedia?: boolean;
|
|
39
|
+
/** The message is sealed: only a caption that came out of the envelope counts. */
|
|
40
|
+
sealed?: boolean;
|
|
41
|
+
/** Extra names of the sender, which a body may merely echo. */
|
|
42
|
+
senderNames?: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The text of a media message, from whichever format carried it. The one
|
|
46
|
+
* place that knows the formats, so every surface (bubble, room list preview,
|
|
47
|
+
* notification, reply quote, copy) agrees:
|
|
48
|
+
*
|
|
49
|
+
* 1. `caption` (+ `captionMentions`): what this SDK sends. The only source
|
|
50
|
+
* for a sealed message, whose caption comes out of the envelope.
|
|
51
|
+
* 2. The caption under another name on `<data>` (`captionText`, `text`,
|
|
52
|
+
* `message`, `description`, `title`) from other clients.
|
|
53
|
+
* 3. A real `body`: older clients and other SDKs put the text in the
|
|
54
|
+
* `<body>` of the media message itself. "media", the file's name or URL,
|
|
55
|
+
* the sender's own name or e-mail and generated labels are not text.
|
|
56
|
+
*
|
|
57
|
+
* Never derived for a sealed message, and never for a message with no file.
|
|
58
|
+
*/
|
|
59
|
+
export declare const resolveMessageCaption: (message?: object | null, options?: CaptionOptions) => ResolvedCaption | undefined;
|
|
60
|
+
/** The caption a message carries, or undefined when it has none. */
|
|
61
|
+
export declare const getMessageCaption: (message?: object | null, options?: CaptionOptions) => string | undefined;
|
|
62
|
+
/** The mention spans of `getMessageCaption`'s text. */
|
|
63
|
+
export declare const getMessageCaptionMentions: (message?: object | null, options?: CaptionOptions) => IMentionSpan[] | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hands "focus the message input" from the room list to the composer.
|
|
3
|
+
*
|
|
4
|
+
* The room list and the composer live in different subtrees, and the
|
|
5
|
+
* composer may only mount after the switch (or re-render later), so a plain
|
|
6
|
+
* callback would race it. Instead the request is parked here until the
|
|
7
|
+
* mounted composer for that room claims it. A claim is one-shot, so a single
|
|
8
|
+
* click focuses exactly once.
|
|
9
|
+
*/
|
|
10
|
+
type Listener = () => void;
|
|
11
|
+
/** Ask the composer for `roomJid` to take focus. Wakes mounted composers. */
|
|
12
|
+
export declare const requestComposerFocus: (roomJid: string | null | undefined) => void;
|
|
13
|
+
/** Mounted composers subscribe here to learn that a request arrived. */
|
|
14
|
+
export declare const subscribeComposerFocus: (listener: Listener) => (() => void);
|
|
15
|
+
/**
|
|
16
|
+
* Claims a pending request for `roomJid`. Returns true exactly once per
|
|
17
|
+
* request, and only for the room the request was made for.
|
|
18
|
+
*/
|
|
19
|
+
export declare const takeComposerFocusRequest: (roomJid: string | null | undefined) => boolean;
|
|
20
|
+
/** Test helper: drops any parked request and all listeners. */
|
|
21
|
+
export declare const resetComposerFocusForTests: () => void;
|
|
22
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IMessage } from '../types/types';
|
|
2
|
-
export declare const createMainMessageForThread: (message: IMessage) => string;
|
|
2
|
+
export declare const createMainMessageForThread: (message: IMessage, t?: (key: string, vars?: Record<string, string | number>) => string) => string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type DownloadResult = 'blob' | 'direct' | 'http-error';
|
|
2
|
+
export interface DownloadDeps {
|
|
3
|
+
fetchImpl?: typeof fetch;
|
|
4
|
+
/** Hands a blob to the browser as a download. */
|
|
5
|
+
saveBlob?: (blob: Blob, fileName: string) => void;
|
|
6
|
+
/** Hands a plain URL to the browser as a download / new tab. */
|
|
7
|
+
saveUrl?: (url: string, fileName: string) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Saves a media file. The blob route is preferred (it keeps the user's file
|
|
11
|
+
* name), but it needs CORS: <img>/<video>/<a> to a host such as
|
|
12
|
+
* secure-files.* never did, so a host without Access-Control-Allow-Origin
|
|
13
|
+
* makes fetch() reject with a bare TypeError. That says nothing about the
|
|
14
|
+
* file, so fall back to handing the URL to the browser directly.
|
|
15
|
+
*
|
|
16
|
+
* A reachable server that answers with an error status is different: its
|
|
17
|
+
* body is an error page, not the file, so nothing is saved.
|
|
18
|
+
*/
|
|
19
|
+
export declare function downloadFile(url: string, fileName: string, deps?: DownloadDeps): Promise<DownloadResult>;
|
|
@@ -11,7 +11,24 @@ export type FileKind = 'image' | 'video' | 'audio' | 'pdf' | 'file';
|
|
|
11
11
|
/** Lowercase extension without the dot; '' when the name carries none. */
|
|
12
12
|
export declare const getFileExtension: (name?: string) => string;
|
|
13
13
|
export declare const isPdfFile: (mimetype?: string, name?: string) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* SVG is deliberately not an image here. It does not render reliably as a
|
|
16
|
+
* message picture, can be blocked by the host's CSP, and is a script
|
|
17
|
+
* injection vector when opened directly. It is treated as a plain file.
|
|
18
|
+
*/
|
|
19
|
+
export declare const isSvgFile: (mimetype?: string, name?: string) => boolean;
|
|
20
|
+
/** True when the file renders as a picture (never for SVG). */
|
|
21
|
+
export declare const isRasterImage: (mimetype?: string, name?: string) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The mimetype a file name's extension stands for, for the pictures, videos,
|
|
24
|
+
* audio and PDFs a bubble can show. Undefined for anything else.
|
|
25
|
+
*/
|
|
26
|
+
export declare const inferMimeFromName: (name?: string) => string | undefined;
|
|
27
|
+
/** A mimetype that says nothing: empty, or the storage's "could not sniff". */
|
|
28
|
+
export declare const isGenericMime: (mimetype?: string) => boolean;
|
|
14
29
|
export declare const getFileKind: (mimetype?: string, name?: string) => FileKind;
|
|
15
30
|
export declare const formatFileSize: (sizeInBytes?: string | number) => string;
|
|
16
31
|
/** Middle-truncates the base name, always keeping the extension visible. */
|
|
17
32
|
export declare const formatFileName: (name: string, maxLength: number) => string;
|
|
33
|
+
/** An animated-picture candidate: image/gif, or a name or URL ending in .gif. */
|
|
34
|
+
export declare const isGifFile: (mimetype?: string, nameOrUrl?: string) => boolean;
|