@ethora/chat-component-rn 26.5.18 → 26.5.20
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/lib/commonjs/components/MainComponents/ChatHeader.js +2 -0
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/Message.js +24 -6
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +9 -3
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +5 -2
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/styledModalComponents.js +6 -2
- package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +6 -4
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledComponents.js +6 -2
- package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +6 -1
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/commonjs/helpers/parseMessageBody.js +12 -5
- package/lib/commonjs/helpers/parseMessageBody.js.map +1 -1
- package/lib/commonjs/helpers/typography.js +28 -0
- package/lib/commonjs/helpers/typography.js.map +1 -0
- package/lib/commonjs/hooks/useChatFonts.js +91 -7
- package/lib/commonjs/hooks/useChatFonts.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +6 -6
- package/lib/commonjs/networking/outboundQueue.js +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +2 -0
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MessageBubble/Message.js +24 -6
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js +9 -3
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +5 -2
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/styledModalComponents.js +6 -2
- package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +6 -4
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledComponents.js +6 -2
- package/lib/module/components/styled/StyledComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +6 -1
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/module/helpers/parseMessageBody.js +12 -5
- package/lib/module/helpers/parseMessageBody.js.map +1 -1
- package/lib/module/helpers/typography.js +23 -0
- package/lib/module/helpers/typography.js.map +1 -0
- package/lib/module/hooks/useChatFonts.js +92 -8
- package/lib/module/hooks/useChatFonts.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +6 -6
- package/lib/module/networking/outboundQueue.js +1 -1
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/styledModalComponents.d.ts +7 -1
- package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledComponents.d.ts +7 -1
- package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts +6 -2
- package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
- package/lib/typescript/helpers/parseMessageBody.d.ts +2 -1
- package/lib/typescript/helpers/parseMessageBody.d.ts.map +1 -1
- package/lib/typescript/helpers/typography.d.ts +14 -0
- package/lib/typescript/helpers/typography.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatFonts.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +1 -1
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/outboundQueue.d.ts +2 -2
- package/lib/typescript/types/types.d.ts +53 -2
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/MainComponents/ChatHeader.tsx +6 -1
- package/src/components/MessageBubble/Message.tsx +30 -8
- package/src/components/Modals/AttachSheet/AttachSheet.tsx +9 -3
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +13 -2
- package/src/components/Modals/styledModalComponents.tsx +6 -3
- package/src/components/styled/SendInput.tsx +6 -4
- package/src/components/styled/StyledComponents.ts +6 -3
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +4 -1
- package/src/helpers/parseMessageBody.tsx +13 -4
- package/src/helpers/typography.ts +19 -0
- package/src/hooks/useChatFonts.ts +69 -11
- package/src/hooks/useSendMessage.tsx +6 -6
- package/src/main.ts +1 -0
- package/src/networking/outboundQueue.ts +2 -2
- package/src/types/types.ts +56 -2
|
@@ -22,21 +22,21 @@ import type { IConfig, IMessage } from '../types/types';
|
|
|
22
22
|
// case (e.g. device offline before the message ever made it to the
|
|
23
23
|
// XMPP socket) — bug #18.
|
|
24
24
|
//
|
|
25
|
-
//
|
|
25
|
+
// 10s window: a brief network blip that reconnects inside this window
|
|
26
26
|
// still resolves on its own — the offline send is buffered in the
|
|
27
27
|
// outbound queue (OUTBOUND_QUEUE_TTL_MS, kept in lockstep) and replayed
|
|
28
28
|
// the moment the stream comes back, so the server echo flips the bubble
|
|
29
|
-
// to delivered. Only a drop that outlasts
|
|
29
|
+
// to delivered. Only a drop that outlasts 10s flips it to "Failed → tap
|
|
30
30
|
// to retry". If a slow send completes just after the window, the
|
|
31
31
|
// delivery clears the failed flag (see newMessageMidlleware) so it
|
|
32
32
|
// doesn't get stuck showing "Failed".
|
|
33
|
-
const PENDING_WATCHDOG_MS =
|
|
33
|
+
const PENDING_WATCHDOG_MS = 10_000;
|
|
34
34
|
|
|
35
35
|
// Media gets a longer window than text: the optimistic bubble appears before
|
|
36
36
|
// the file upload even starts, and a large file (up to the 50MB cap) over a
|
|
37
|
-
// slow link can legitimately take far longer than
|
|
38
|
-
// it at
|
|
39
|
-
// duplicate upload.
|
|
37
|
+
// slow link can legitimately take far longer than 10s to upload + send. Failing
|
|
38
|
+
// it at 10s mid-upload would flash a wrong "Failed" and let the user kick off a
|
|
39
|
+
// duplicate upload.
|
|
40
40
|
const MEDIA_PENDING_WATCHDOG_MS = 30_000;
|
|
41
41
|
|
|
42
42
|
// Monotonic counter for stanza ids. Bumped on each send within a single
|
package/src/main.ts
CHANGED
|
@@ -41,7 +41,7 @@ export interface QueuedSend {
|
|
|
41
41
|
* Per-item replay window. Kept in lockstep with the matching send
|
|
42
42
|
* watchdog so a reconnect inside the window replays the buffered send,
|
|
43
43
|
* while a longer drop lets the watchdog own the failure (no duplicate).
|
|
44
|
-
* Text uses
|
|
44
|
+
* Text uses 10s, media 30s (large uploads need longer). Falls back to
|
|
45
45
|
* OUTBOUND_QUEUE_TTL_MS when omitted.
|
|
46
46
|
*/
|
|
47
47
|
ttlMs?: number;
|
|
@@ -51,7 +51,7 @@ export interface QueuedSend {
|
|
|
51
51
|
|
|
52
52
|
// Default replay window (text). Mirrors PENDING_WATCHDOG_MS in useSendMessage.
|
|
53
53
|
// Media enqueues a longer per-item ttlMs (see QueuedSend.ttlMs).
|
|
54
|
-
export const OUTBOUND_QUEUE_TTL_MS =
|
|
54
|
+
export const OUTBOUND_QUEUE_TTL_MS = 10_000;
|
|
55
55
|
|
|
56
56
|
let queue: QueuedSend[] = [];
|
|
57
57
|
|
package/src/types/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ViewStyle, ImageSourcePropType } from 'react-native';
|
|
1
|
+
import type { ViewStyle, ImageSourcePropType, TextStyle } from 'react-native';
|
|
2
2
|
import type { Iso639_1Codes } from './models/language.model';
|
|
3
3
|
import type { IMessage, IReply } from './models/message.model';
|
|
4
4
|
import type { RoomMember } from './models/room.model';
|
|
@@ -248,10 +248,31 @@ export interface RNFontSource {
|
|
|
248
248
|
* itself (e.g. via `@expo-google-fonts/*` or its own `useFonts`), pass only
|
|
249
249
|
* `fontFamily` and leave `fonts` empty.
|
|
250
250
|
*/
|
|
251
|
+
/**
|
|
252
|
+
* Per-element font size / weight override.
|
|
253
|
+
*
|
|
254
|
+
* `fontWeight` is honoured even with a custom `fontFamily`: when
|
|
255
|
+
* `weightFamilies` is configured, the chat maps the requested weight to the
|
|
256
|
+
* matching family variant at render time (a single font file can't synthesise
|
|
257
|
+
* 500/600 — only fake-bold ~700 — so the variant family is what actually
|
|
258
|
+
* renders medium/semibold). Omit a field to keep the component default.
|
|
259
|
+
*/
|
|
260
|
+
export interface ChatTextStyle {
|
|
261
|
+
/** Point size. */
|
|
262
|
+
fontSize?: number;
|
|
263
|
+
/** '400' | '500' | '600' | '700' | 'normal' | 'bold' | number. */
|
|
264
|
+
fontWeight?: TextStyle['fontWeight'];
|
|
265
|
+
}
|
|
266
|
+
|
|
251
267
|
export interface TypographyConfig {
|
|
252
268
|
/** Family applied across the chat UI. Must be loaded (via `fonts` or by the host). */
|
|
253
269
|
fontFamily?: string;
|
|
254
|
-
/**
|
|
270
|
+
/**
|
|
271
|
+
* Optional per-weight families. REQUIRED for `fontWeight` overrides to take
|
|
272
|
+
* visible effect when a custom `fontFamily` is set — RN can't synthesise
|
|
273
|
+
* intermediate weights from one font file, so each weight needs its own
|
|
274
|
+
* loaded family (and a matching entry in `fonts`).
|
|
275
|
+
*/
|
|
255
276
|
weightFamilies?: {
|
|
256
277
|
regular?: string;
|
|
257
278
|
medium?: string;
|
|
@@ -260,6 +281,39 @@ export interface TypographyConfig {
|
|
|
260
281
|
};
|
|
261
282
|
/** Fonts for the SDK to load with expo-font before applying `fontFamily`. */
|
|
262
283
|
fonts?: RNFontSource[];
|
|
284
|
+
|
|
285
|
+
// ----- per-element size / weight overrides -----
|
|
286
|
+
/** Message body text inside chat bubbles. Default 16. */
|
|
287
|
+
messageText?: ChatTextStyle;
|
|
288
|
+
/** Sender name shown above incoming messages. Default 14 / "500". */
|
|
289
|
+
senderName?: ChatTextStyle;
|
|
290
|
+
/** Room title in the chat header. Default 16 / "600". */
|
|
291
|
+
headerTitle?: ChatTextStyle;
|
|
292
|
+
/** Message composer: the input/placeholder text plus its layout sizing. */
|
|
293
|
+
input?: ChatTextStyle & {
|
|
294
|
+
/** Min height of the input box in px. Default 40. */
|
|
295
|
+
minHeight?: number;
|
|
296
|
+
/** Max height before the input scrolls in px. Default 120. */
|
|
297
|
+
maxHeight?: number;
|
|
298
|
+
/** Width & height of the round send button in px. Default 40. */
|
|
299
|
+
sendButtonSize?: number;
|
|
300
|
+
};
|
|
301
|
+
/** Chat profile screen (opens when tapping the room name in the header). */
|
|
302
|
+
profile?: {
|
|
303
|
+
/** Big room-name title at the top of the profile screen. Default 24 / "400". */
|
|
304
|
+
title?: ChatTextStyle;
|
|
305
|
+
/** Member name rows. Default 16 / "600". */
|
|
306
|
+
memberName?: ChatTextStyle;
|
|
307
|
+
};
|
|
308
|
+
/** Attach (photo/document picker) bottom sheet. */
|
|
309
|
+
attachSheet?: {
|
|
310
|
+
/** "Attach" header label. Default 13 / "600". */
|
|
311
|
+
title?: ChatTextStyle;
|
|
312
|
+
/** Row labels (Camera / Gallery / Document). Default 16 / "500". */
|
|
313
|
+
rowLabel?: ChatTextStyle;
|
|
314
|
+
/** Cancel button. Default 16 / "600". */
|
|
315
|
+
cancelButton?: ChatTextStyle;
|
|
316
|
+
};
|
|
263
317
|
}
|
|
264
318
|
|
|
265
319
|
export interface IConfig {
|