@ethora/chat-component 26.6.6 → 26.6.7

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 (48) hide show
  1. package/dist/assets/icons.d.ts +0 -4
  2. package/dist/components/MainComponents/ChatHeader.d.ts +1 -2
  3. package/dist/components/MainComponents/ProfileImagePlaceholder.d.ts +0 -2
  4. package/dist/components/MainComponents/Switch.d.ts +0 -8
  5. package/dist/components/MessageBubble/MessageTranslations.d.ts +10 -0
  6. package/dist/components/RoomComponents/ChatRoomItem.d.ts +2 -2
  7. package/dist/firebase-messaging-sw.js +4 -16
  8. package/dist/helpers/callLogMessage.d.ts +0 -22
  9. package/dist/helpers/createUserNameFromSetUser.d.ts +1 -36
  10. package/dist/helpers/resolveIconColor.d.ts +3 -5
  11. package/dist/hooks/useChatSettingState.d.ts +0 -2
  12. package/dist/hooks/useChatWrapperInit.d.ts +1 -3
  13. package/dist/hooks/useSendMessage.d.ts +0 -1
  14. package/dist/main.d.ts +2 -1
  15. package/dist/main.js +77070 -19
  16. package/dist/main.js.map +1 -1
  17. package/dist/networking/apiClient.d.ts +15 -7
  18. package/dist/networking/authRefresh.d.ts +102 -0
  19. package/dist/networking/xmppClient.d.ts +49 -2
  20. package/dist/roomStore/Middleware/unreadMidlleware.d.ts +0 -1
  21. package/dist/roomStore/callSlice.d.ts +0 -1
  22. package/dist/roomStore/chatSettingsSlice.d.ts +2 -25
  23. package/dist/roomStore/roomsSlice.d.ts +1 -8
  24. package/dist/types/models/config.model.d.ts +15 -122
  25. package/dist/types/models/language.model.d.ts +1 -1
  26. package/dist/types/models/message.model.d.ts +0 -1
  27. package/dist/version.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/public/firebase-messaging-sw.js +4 -16
  30. package/dist/VideoCallOverlay-gE1OvEiT.js +0 -23647
  31. package/dist/VideoCallOverlay-gE1OvEiT.js.map +0 -1
  32. package/dist/components/MainComponents/LanguageSelectorModal.d.ts +0 -3
  33. package/dist/components/MessageBubble/MessageTranslate.d.ts +0 -25
  34. package/dist/components/MessageBubble/TranslatedMessageBody.d.ts +0 -21
  35. package/dist/components/Notification/NotificationPermissionBanner.d.ts +0 -16
  36. package/dist/components/RoomComponents/OnlineUsersPopover.d.ts +0 -11
  37. package/dist/helpers/isLikelyMucJid.d.ts +0 -18
  38. package/dist/helpers/scheduleAckCatchup.d.ts +0 -27
  39. package/dist/helpers/toBaseLanguage.d.ts +0 -8
  40. package/dist/hooks/useIsMobileViewport.d.ts +0 -1
  41. package/dist/hooks/useMessageTranslation.d.ts +0 -28
  42. package/dist/hooks/useRoomPresence.d.ts +0 -10
  43. package/dist/i18n/strings.d.ts +0 -15
  44. package/dist/i18n/useT.d.ts +0 -33
  45. package/dist/main-Doq70DIE.js +0 -74474
  46. package/dist/main-Doq70DIE.js.map +0 -1
  47. package/dist/networking/helpers/refreshChecker.d.ts +0 -1
  48. package/dist/utils/translateModePolicy.d.ts +0 -19
@@ -1,3 +0,0 @@
1
- import { default as React } from 'react';
2
- export declare const LanguageSelectorButton: React.FC;
3
- export default LanguageSelectorButton;
@@ -1,25 +0,0 @@
1
- import { FC } from 'react';
2
- import { IConfig, IMessage } from '../../types/types';
3
- interface MessageTranslateProps {
4
- message: IMessage;
5
- isUser: boolean;
6
- config?: IConfig;
7
- }
8
- /**
9
- * Manual-mode message translation (LinkedIn-style). Renders a "Translate"
10
- * link under an incoming message; on click it calls
11
- * `config.translates.onTranslate` (host-provided) - or, when the host
12
- * doesn't supply one, reads whatever translation already arrived attached
13
- * to the stanza (`message.translations`) - and shows the result inline
14
- * with a "Show original" toggle. No default translation service is called
15
- * here; a message with nothing attached and no host `onTranslate` simply
16
- * has nothing to reveal (see `translation.failed`).
17
- *
18
- * Visibility: `config.translates.showTranslateForMessage(message)` if the host
19
- * supplies it (they keep the locale logic and just tell us yes/no); otherwise
20
- * we compare the message's source base-language with the reader's base-language
21
- * (region ignored, so en-US vs en-CA shows nothing). The reader's FULL locale
22
- * (fr-CA vs fr-FR) is still forwarded to `onTranslate` as `targetLocale`.
23
- */
24
- declare const MessageTranslate: FC<MessageTranslateProps>;
25
- export default MessageTranslate;
@@ -1,21 +0,0 @@
1
- import { default as React, ReactNode } from 'react';
2
- interface TranslatedMessageBodyProps {
3
- /** Text as sent, in the sender's language. */
4
- originalText: string;
5
- accentColor?: string;
6
- /** Renders the translated text (markdown pipeline, mentions, etc). */
7
- children: ReactNode;
8
- /**
9
- * Whether this message was sent by the current user. The sender already
10
- * knows what they wrote, so their own messages skip the quote-plus-
11
- * translation treatment and just show the original text.
12
- */
13
- isUser: boolean;
14
- }
15
- /**
16
- * A message body that is showing a translation: the translated text reads
17
- * as the primary content, with the original quoted above it for reference
18
- * - skipped for the current user's own messages (see `isUser`).
19
- */
20
- export declare const TranslatedMessageBody: React.FC<TranslatedMessageBodyProps>;
21
- export default TranslatedMessageBody;
@@ -1,16 +0,0 @@
1
- import { default as React } from 'react';
2
- import { IConfig } from '../../types/types';
3
- interface NotificationPermissionBannerProps {
4
- config?: IConfig;
5
- /** Triggers the browser permission prompt + push registration. */
6
- requestPermission: () => Promise<void>;
7
- }
8
- /**
9
- * In-app banner nudging the user to enable browser notifications. Fully
10
- * config-driven (config.pushNotifications.permissionBanner) and self-contained:
11
- * it reads the live Notification permission, renders the "enable" or "blocked"
12
- * variant accordingly, and hides itself when notifications are granted /
13
- * unsupported / disabled. SSR-safe.
14
- */
15
- declare const NotificationPermissionBanner: React.FC<NotificationPermissionBannerProps>;
16
- export default NotificationPermissionBanner;
@@ -1,11 +0,0 @@
1
- import { default as React } from 'react';
2
- import { RoomMember } from '../../types/types';
3
- interface OnlineUsersPopoverProps {
4
- /** xmppUsernames currently online in this room (from useRoomPresence). */
5
- onlineUsernames: string[];
6
- members?: RoomMember[];
7
- myXmppUsername: string;
8
- isChatActive?: boolean;
9
- }
10
- declare const OnlineUsersPopover: React.FC<OnlineUsersPopoverProps>;
11
- export default OnlineUsersPopover;
@@ -1,18 +0,0 @@
1
- export declare const isLikelyMucJid: (jid: unknown) => jid is string;
2
- /**
3
- * True when `value` can be used as the localpart of a MUC room JID, i.e. it is
4
- * safe to build `${value}@conference.<host>` from it.
5
- *
6
- * Ethora room localparts are always `<appId>_<roomId>`, so the underscore is a
7
- * reliable discriminator against slice keys, plain flags and stray strings.
8
- * Callers that already hold a full JID should use `isLikelyMucJid` instead.
9
- */
10
- export declare const isLikelyRoomLocalpart: (value: unknown) => value is string;
11
- /**
12
- * Normalise a room reference into a full MUC JID, or return null when the
13
- * input cannot be one. Use at every point that would otherwise blindly do
14
- * `chatJID.includes('@') ? chatJID : chatJID + '@' + conference`: that pattern
15
- * silently manufactures a valid-looking JID out of any garbage handed to it,
16
- * which is how slice keys ended up being joined as rooms.
17
- */
18
- export declare const toRoomJid: (chatJID: unknown, conference: string | undefined) => string | null;
@@ -1,27 +0,0 @@
1
- import { default as XmppClient } from '../networking/xmppClient';
2
- /**
3
- * How long to wait for the MUC to reflect our own message back before
4
- * assuming it never will. A MUC echo normally lands in ~100-300ms - far
5
- * faster than a MAM round trip could answer anyway - so this only has to
6
- * be generous enough not to fire during a slow-but-healthy send.
7
- */
8
- export declare const ACK_CATCHUP_DELAY_MS = 2500;
9
- /** The echo is what flips `pending` to false (see addRoomMessage). */
10
- export declare const hasEchoLanded: (roomJID: string, messageId: string) => boolean;
11
- /**
12
- * Safety net for a send whose MUC echo never arrives (e.g. our presence
13
- * silently dropped): re-assert presence and pull history - ONCE, and only
14
- * if the echo really is missing.
15
- *
16
- * It must stay a safety net. This used to be a poll: an immediate fetch on
17
- * every send plus a retry loop re-arming every 700ms for 5s until the echo
18
- * landed. Every getHistoryStanza makes the server re-send the room's last
19
- * 10-20 archived messages down the socket, so one send produced ~6 MAM
20
- * replies (9 worst case) - the "I get my message back 4 times" seen in the
21
- * WS frames. It was self-amplifying too: a slower echo fired more history
22
- * storms, and each storm's stanzas fed the reducer/persist churn that was
23
- * slowing the echo down in the first place.
24
- *
25
- * @returns the timer, so the caller can cancel it on unmount.
26
- */
27
- export declare const scheduleAckCatchup: (client: XmppClient, roomJID: string, messageId: string, onSettled?: () => void) => ReturnType<typeof setTimeout>;
@@ -1,8 +0,0 @@
1
- import { Iso639_1Codes } from '../types/models/language.model';
2
- /**
3
- * "fr-CA" -> "fr", "EN" -> "en". Region only matters for the translation
4
- * service's dialect handling - everywhere else (matching a source language
5
- * against a reader's, caching, `langSource`) only the base language is
6
- * meaningful.
7
- */
8
- export declare const toBaseLanguage: (locale?: string | null) => Iso639_1Codes;
@@ -1 +0,0 @@
1
- export declare const useIsMobileViewport: (breakpoint?: number) => boolean;
@@ -1,28 +0,0 @@
1
- import { IMessage } from '../types/types';
2
- export interface MessageTranslationState {
3
- /** False when the message is already in the reader's language, or no
4
- * translation is available - render the plain body, no quote. */
5
- hasTranslation: boolean;
6
- originalText: string;
7
- /** Translation when hasTranslation, else the original - always safe to
8
- * render directly. */
9
- displayText: string;
10
- }
11
- /**
12
- * Translation for ONE message, into the reader's language only.
13
- *
14
- * Pure and synchronous - no HTTP call. Every translation this client ever
15
- * shows arrives over XMPP already: the sender tags outgoing messages with
16
- * `<translate source="xx"/>` (see sendTextMessageWithTranslateTag) and
17
- * whatever process attaches actual translations does so server-side,
18
- * landing on `message.translations` when the stanza is parsed (see
19
- * getDataFromXml). This function only ever reads that - it never calls a
20
- * translation service itself, so there's nothing to fail when one isn't
21
- * reachable, and nothing to await.
22
- *
23
- * A message sent before the sender had translate-sending turned on simply
24
- * never got tagged, so it has no translation to show - not an error, just
25
- * absence of the underlying data (see the enable/disable-translates
26
- * disclaimer in LanguageSelectorModal).
27
- */
28
- export declare const useMessageTranslation: (message: Pick<IMessage, "body" | "langSource" | "translations">, readerLocale?: string, enabled?: boolean) => MessageTranslationState;
@@ -1,10 +0,0 @@
1
- /**
2
- * xmppUsernames currently ONLINE (available MUC presence) in the given room.
3
- * Populated from the room's presence stanzas: an available presence marks a
4
- * user online; a `type='unavailable'` presence marks them offline. When you
5
- * join a room the server sends the presence of everyone already online, so the
6
- * list is correct from the first render and updates live as users come/go.
7
- */
8
- export declare const useRoomPresence: (roomJID?: string) => string[];
9
- /** Whether a specific member (by xmppUsername) is currently online in the room. */
10
- export declare const useIsUserOnline: (roomJID?: string, xmppUsername?: string) => boolean;
@@ -1,15 +0,0 @@
1
- export type UiStringTable = Record<string, string>;
2
- export declare const BUILTIN_STRINGS: Record<string, UiStringTable>;
3
- export declare const DEFAULT_UI_LANGUAGE = "en";
4
- /** Reduce a BCP-47 locale ("fr-CA") to its base language ("fr"), lowercased. */
5
- export declare const toBaseLanguage: (locale?: string | null) => string;
6
- /**
7
- * Build the effective string table for a locale: the built-in table for that
8
- * base language (falling back to English for any missing key), with host
9
- * overrides from `config.i18n.strings` merged on top.
10
- */
11
- export declare const resolveStringTable: (locale?: string | null, overrides?: UiStringTable | null) => UiStringTable;
12
- /** Replace `{name}` placeholders with values from `vars`. */
13
- export declare const interpolate: (template: string, vars?: Record<string, string | number>) => string;
14
- /** One-shot translate for non-React code (helpers). */
15
- export declare const translateKey: (key: string, locale?: string | null, overrides?: UiStringTable | null, vars?: Record<string, string | number>) => string;
@@ -1,33 +0,0 @@
1
- /**
2
- * UI translation hook. Reads the active locale + host overrides from
3
- * `config.i18n` and returns a `t(key, vars?)` function.
4
- *
5
- * const t = useT();
6
- * <SearchInput placeholder={t('search.placeholder')} />
7
- * <span>{t('presence.onlineCount', { count })}</span>
8
- *
9
- * Locale resolves to the base language for captions (region is only used for
10
- * message translation). Missing keys fall back to English, then to the raw
11
- * key, so nothing ever renders blank.
12
- *
13
- * When the host doesn't set `config.i18n.locale` explicitly, this falls
14
- * back to `langSource` - the same reader-language state the in-chat globe
15
- * picker (LanguageSelectorButton) and `config.translates.readerLocale`
16
- * drive (see useChatWrapperInit's resolveExternalReaderLocaleLangSource).
17
- * So picking a language in the chat changes both message translations AND
18
- * static captions together, as one language switch, unless the host is
19
- * explicitly managing UI locale separately via `config.i18n.locale`.
20
- */
21
- /**
22
- * The locale the UI is currently in, resolved by the same rule useT uses
23
- * (explicit `config.i18n.locale`, else the reader's `langSource`).
24
- *
25
- * For anything Intl already localises - dates, numbers, relative times -
26
- * where you need the locale itself rather than a string from the table.
27
- * Without it components reach for a hardcoded 'en-US' and quietly render
28
- * American dates under a Chinese UI (DateLabel did exactly that).
29
- * Undefined means "no explicit choice", which Intl reads as the browser's
30
- * own locale - the right default.
31
- */
32
- export declare const useUiLocale: () => string | undefined;
33
- export declare const useT: () => (key: string, vars?: Record<string, string | number>) => string;