@ethora/chat-component 26.10.6 → 26.10.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 (42) hide show
  1. package/README.md +14 -0
  2. package/dist/{ChatProfileModal-OJCKwdNp.js → ChatProfileModal-BDZvd0rm.js} +145 -145
  3. package/dist/{FilePreviewModal-DwNUEHei.js → FilePreviewModal-DlOjnYzv.js} +79 -79
  4. package/dist/{ManageDataModal-CaQ2VBPn.js → ManageDataModal-BZLGJZze.js} +16 -16
  5. package/dist/{MarkdownBody-BeoG2cpo.js → MarkdownBody-CtArwCDa.js} +1 -1
  6. package/dist/{MessageSearchModal-DMw9o49-.js → MessageSearchModal-CcUnfZlU.js} +46 -46
  7. package/dist/{PublicChatsModal-CWdYILv_.js → PublicChatsModal-BWn0NXVo.js} +10 -10
  8. package/dist/{SideDrawer-Cl-vbuIG.js → SideDrawer-CqZl9sxK.js} +28 -28
  9. package/dist/UserProfileModal-D0JZ3-uy.js +635 -0
  10. package/dist/{UserSettingsModal-DgCAHmNh.js → UserSettingsModal-OvykYDsT.js} +4 -4
  11. package/dist/{VideoCallOverlay-Cq2cECWj.js → VideoCallOverlay-DrvO2v_g.js} +4616 -4477
  12. package/dist/{VisibilityModal-D7vqGbrA.js → VisibilityModal-pOF9-UXR.js} +11 -11
  13. package/dist/components/Modals/styledModalComponents.d.ts +4 -4
  14. package/dist/components/VideoCalls/VideoCallSession.d.ts +2 -0
  15. package/dist/firebase-messaging-sw.js +918 -96
  16. package/dist/{handleCopyClick-Crn2jEEu.js → handleCopyClick-BUbVvd2G.js} +1 -1
  17. package/dist/helpers/callClaim.d.ts +17 -0
  18. package/dist/helpers/callOutcomeSync.d.ts +23 -0
  19. package/dist/helpers/callPush.d.ts +23 -0
  20. package/dist/helpers/incomingCallPush.d.ts +89 -0
  21. package/dist/helpers/pushRoomHandoff.d.ts +13 -0
  22. package/dist/hooks/useChatSettingState.d.ts +1 -0
  23. package/dist/hooks/usePushNotifications.d.ts +2 -0
  24. package/dist/{main-36gqdbJ8.js → main-CpHMnydn.js} +11799 -11045
  25. package/dist/main.js +17 -17
  26. package/dist/networking/api-requests/rooms.api.d.ts +9 -0
  27. package/dist/networking/xmpp/sendMessageReaction.xmpp.d.ts +13 -1
  28. package/dist/networking/xmppClient.d.ts +2 -1
  29. package/dist/roomStore/Middleware/blockedHydrationMiddleware.d.ts +2 -0
  30. package/dist/roomStore/chatSettingsSlice.d.ts +2 -1
  31. package/dist/types/models/config.model.d.ts +7 -0
  32. package/dist/types/models/xmpp.model.d.ts +2 -1
  33. package/dist/utils/callAuthMirror.d.ts +1 -0
  34. package/dist/utils/callBroadcast.d.ts +12 -0
  35. package/dist/utils/callNotifications.d.ts +67 -0
  36. package/dist/utils/firebasePushNotifications.d.ts +14 -0
  37. package/dist/utils/handledCalls.d.ts +5 -0
  38. package/dist/utils/pushServiceWorkerBridge.d.ts +19 -0
  39. package/dist/utils/webLock.d.ts +13 -0
  40. package/package.json +1 -1
  41. package/public/firebase-messaging-sw.js +918 -96
  42. package/dist/UserProfileModal-B8KtGnwZ.js +0 -594
@@ -1,4 +1,4 @@
1
- import { E as e, G as t } from "./main-36gqdbJ8.js";
1
+ import { U as e, X as t } from "./main-CpHMnydn.js";
2
2
  const i = e.div`
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -0,0 +1,17 @@
1
+ /** Records that this tab took the decision for the call (see wonCallDecision). */
2
+ export declare const rememberCallDecision: (key: string | null | undefined) => void;
3
+ /** True when this tab took the accept or decline for `key` itself. */
4
+ export declare const wonCallDecision: (key: string | null | undefined) => boolean;
5
+ export declare const resetCallClaims: () => void;
6
+ /**
7
+ * Takes the per-call claim for accepting or declining `key`. A plain boolean
8
+ * without Web Locks (nothing to yield for), otherwise a promise. Both actions
9
+ * share the one lock, so an Accept here and a Decline in another tab cannot
10
+ * both go through either.
11
+ */
12
+ export declare const claimCallDecision: (key: string) => boolean | Promise<boolean>;
13
+ /**
14
+ * Runs `run` when this tab gets the claim, and not at all when another tab
15
+ * has it. Synchronous when the claim is (no Web Locks).
16
+ */
17
+ export declare const runIfCallClaimed: (key: string | null | undefined, run: () => void) => void;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Marks the end of the ring `key` as local-only: the next time this tab's ring
3
+ * for it ends, nothing is broadcast. For a timeout, and for an end that came
4
+ * from another tab (no echo).
5
+ */
6
+ export declare const silenceCallOutcome: (key: string | null | undefined) => void;
7
+ type CallLike = {
8
+ direction: string | null;
9
+ phase: string;
10
+ callId: string | null;
11
+ roomJid: string | null;
12
+ roomBareName: string | null;
13
+ };
14
+ export declare const incomingCallKey: (call: CallLike) => string | null;
15
+ interface StoreLike {
16
+ getState: () => {
17
+ call: CallLike;
18
+ };
19
+ subscribe: (listener: () => void) => () => void;
20
+ dispatch: (action: any) => unknown;
21
+ }
22
+ export declare function startCallOutcomeSync(store: StoreLike): () => void;
23
+ export {};
@@ -20,3 +20,26 @@ export interface ParsedCallPush {
20
20
  */
21
21
  export declare const isCallPush: (data: Record<string, any> | null | undefined) => boolean;
22
22
  export declare const parseCallPush: (data: Record<string, any> | null | undefined) => ParsedCallPush;
23
+ /**
24
+ * Decode the claims of a JWT without verifying it. Only non-sensitive claims
25
+ * are ever read from the result; the server (and LiveKit on connect) is the
26
+ * authority on validity. Returns null for anything that is not a JWT.
27
+ */
28
+ export declare const decodeJwtPayload: (token: string | null | undefined) => Record<string, any> | null;
29
+ /** Expiry of a JWT (`exp`, seconds) as epoch milliseconds, or null. */
30
+ export declare const jwtExpiresAtMs: (token: string | null | undefined) => number | null;
31
+ /** A call token with less than this left is treated as already expired. */
32
+ export declare const CALL_TOKEN_MIN_REMAINING_MS = 3000;
33
+ /**
34
+ * Whether a call push is still worth ringing for. The backend sets no push TTL,
35
+ * so a device that was offline can receive a call push long after the call.
36
+ * The LiveKit token lives 60 s, so its `exp` is the freshness clock.
37
+ *
38
+ * When no `exp` can be read (no token, malformed token) the push is treated
39
+ * as fresh: it cannot be proven stale, and the ring's own 45 s timeout bounds
40
+ * how long it can stay on screen.
41
+ */
42
+ export declare const getCallPushFreshness: (data: Record<string, any> | null | undefined, now?: number) => {
43
+ fresh: boolean;
44
+ expiresAt: number | null;
45
+ };
@@ -0,0 +1,89 @@
1
+ export interface CallPushContext {
2
+ dispatch: (action: any) => unknown;
3
+ getState: () => any;
4
+ normalizeRoomJid: (jid?: string) => string;
5
+ }
6
+ export type CallPushOutcome =
7
+ /** The ring is on (or already was) for this call. */
8
+ 'ringing'
9
+ /** Ringing and accepted in the same step (Answer action). */
10
+ | 'accepted'
11
+ /** This call is already answered / in progress; nothing to do. */
12
+ | 'active'
13
+ /** Another call is in progress; this one was ignored. */
14
+ | 'busy'
15
+ /** The push is stale; nothing rings. */
16
+ | 'expired'
17
+ /** Another tab already accepted, declined or ended this call; nothing to do. */
18
+ | 'handled'
19
+ /** Held until the chat config and the user are ready. */
20
+ | 'held'
21
+ /** The push carries no LiveKit token, so it cannot ring. */
22
+ | 'no-token';
23
+ export declare const markCallRaisedFromPush: (key: string | null | undefined) => void;
24
+ export declare const unmarkCallRaisedFromPush: (key: string | null | undefined) => void;
25
+ export declare const wasCallRaisedFromPush: (key: string | null | undefined) => boolean;
26
+ interface PendingCallPush {
27
+ data: Record<string, any>;
28
+ answer: boolean;
29
+ heldAt: number;
30
+ /** The worker is showing this call's notification (see raisedFromPush). */
31
+ swShows: boolean;
32
+ }
33
+ export declare const holdCallPush: (data: Record<string, any>, answer: boolean, swShows?: boolean) => void;
34
+ export declare const takePendingCallPush: (now?: number) => PendingCallPush | null;
35
+ export declare const dropPendingCallPush: (callId: string | null | undefined) => void;
36
+ export declare const resetCallPushState: () => void;
37
+ /**
38
+ * Everything the call push flow holds that belongs to the session: a call push
39
+ * held for the config, the pushed-ring marks, the decline dedupe, the click the
40
+ * worker keeps for the next page load, and the call notifications on screen.
41
+ * Logout (and an account switch) clears it, so the next user never replays or
42
+ * answers the previous one's call.
43
+ */
44
+ export declare const clearCallPushSession: (scope?: string) => Promise<void>;
45
+ /**
46
+ * Several tabs get the same tap or Answer from the worker. Only one may act on
47
+ * it: the first to take the lock for this call does, the rest leave it. This
48
+ * only routes the click. Whether THIS tab may then accept or decline the call
49
+ * is the per-call claim in callClaim (shared with the ring screen's buttons).
50
+ */
51
+ export declare const claimCallAction: (action: "click", key: string) => boolean | Promise<boolean>;
52
+ /**
53
+ * Puts the ring up from a call push (through the guarded reducer) and, for the
54
+ * Answer action, accepts it right away so LiveKit connects with the push's own
55
+ * token and no second click.
56
+ */
57
+ export declare const raiseIncomingCallFromPush: (ctx: CallPushContext, data: Record<string, any>, options?: {
58
+ answer?: boolean;
59
+ swShows?: boolean;
60
+ }) => CallPushOutcome;
61
+ export declare const flushPendingCallPush: (ctx: CallPushContext) => CallPushOutcome | null;
62
+ /**
63
+ * CALL_PUSH from the worker: ring (or hold) and tell the worker what this page
64
+ * did, so it knows whether to add an OS notification:
65
+ * - ring shown and this page visible: ack, the worker shows nothing;
66
+ * - this call is already connecting or in progress here: ack whether the page
67
+ * is visible or not (a duplicate push must not ring again, nor end as a
68
+ * "Missed call" for a call that was answered);
69
+ * - a DIFFERENT call is in progress: ack with `busy`, the worker shows a plain
70
+ * "Missed call" instead of a ring that Answer could not take;
71
+ * - anything else (hidden page, held, expired, no token): no ack, the worker
72
+ * notifies. The hidden or held ring is then the worker's to announce, so it
73
+ * is marked and the page does not notify a second time.
74
+ */
75
+ export declare const handleCallPushFromWorker: (ctx: CallPushContext, data: Record<string, any>) => CallPushOutcome;
76
+ /**
77
+ * Declines a call from a notification action. Both mounted hook instances get
78
+ * the worker's message, so a repeat for the same call is dropped. A call this
79
+ * page has already answered is left alone: a stale Decline must never hang up
80
+ * a live call.
81
+ *
82
+ * Tells the worker (CALL_PUSH_DECLINE_ACK) once the decline was actually
83
+ * handled, and only then: the worker waits for it and otherwise declines over
84
+ * REST itself. A page that cannot do the XMPP part (the chat config is not in
85
+ * Redux yet) still has the user token, so it does the REST decline and acks
86
+ * when the server took it.
87
+ */
88
+ export declare const declineIncomingCallFromPush: (ctx: CallPushContext, data: Record<string, any>) => Promise<void>;
89
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A push tap names the room the user wants. The address bar and the parked
3
+ * QR / deep-link id may still name another one: a host that redirects `/` to
4
+ * its saved last path lands the window on `/chat?chatId=<last room>`, and
5
+ * `useQRCodeChat` re-asserts that room for as long as it is parked, which
6
+ * used to undo the push a moment after it was applied.
7
+ *
8
+ * Call this right before opening the pushed room so every source of truth
9
+ * agrees: a `chatId` already in the url is rewritten to the pushed room (the
10
+ * way `useRoomUrl` writes it, without adding a history entry), and a parked
11
+ * id is dropped. A url with no `chatId` is left alone.
12
+ */
13
+ export declare const claimRoomForPush: (roomJid: string) => void;
@@ -8,4 +8,5 @@ export declare const useChatSettingState: () => {
8
8
  langSource: any;
9
9
  translateSendEnabled: any;
10
10
  translateMode: any;
11
+ blockedUserIds: any;
11
12
  };
@@ -28,6 +28,8 @@ interface UsePushNotificationsOptions {
28
28
  iconPath?: string;
29
29
  /** Custom badge URL/path for browser OS notifications. */
30
30
  badgePath?: string;
31
+ /** Same-origin path a cold-start push tap opens (default: the origin root). */
32
+ clickPath?: string;
31
33
  /**
32
34
  * Custom Firebase configuration object.
33
35
  * If provided, it overrides the environment variables.