@ethora/chat-component 26.10.5 → 26.10.6

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 CHANGED
@@ -363,7 +363,7 @@ Below is a grouped reference for all `config` options.
363
363
  | --- | --- | --- |
364
364
  | `disableHeader` | `boolean` | Hide chat header. |
365
365
  | `disableMedia` | `boolean` | Disable media sending/processing paths. |
366
- | `attachments` | `{ maxFiles?; maxFileSizeMb?; accept? }` | Composer attachment limits. `maxFiles` defaults to `10` (also the hard cap, set by the stanza payload size); `maxFileSizeMb` adds a client-side per-file check (omit for none); `accept` is passed straight to the file picker. Picking several files sends them as **one** message. |
366
+ | `attachments` | `{ maxFiles?; maxFileSizeMb?; accept?; captionMode? }` | Composer attachment limits. `maxFiles` defaults to `10` (also the hard cap, set by the stanza payload size); `maxFileSizeMb` adds a client-side per-file check (omit for none); `accept` is passed straight to the file picker. Picking several files sends them as **one** message. `captionMode` (`'inline' \| 'separate'`, default `'separate'`) sets where the text typed with the files goes: `'separate'` sends the media message without the caption and then the text as a normal text message once the media send settles (also in e2ee rooms); `'inline'` puts the caption on the media message (`<data caption>`, `captionMentions`). See Backend compatibility. |
367
367
  | `pdfPreview` | `{ enabled?; workerSrc?; libUrl?; maxFileSizeMb? }` | First-page PDF thumbnails inside bubbles and in the composer tray. On by default; `enabled: false` keeps the static document card. pdf.js is code-split and only fetched when a PDF actually shows up. By default it runs on the main thread, which needs no bundler asset wiring: set `workerSrc` to a pdf.js worker URL you host to move parsing off it. Set `libUrl` to the URL of a pdf.js ES module build to load it at runtime instead of the copy bundled with the component (pair it with `workerSrc`); useful when you ship the component as one self-contained script and do not want pdf.js (about 1.7 MB) inside it. `maxFileSizeMb` (default `25`) is the size past which a document is not auto-rendered. |
368
368
  | `disableRooms` | `boolean` | Hide/disable room list area. |
369
369
  | `disableRoomMenu` | `boolean` | Disable room menu controls. |
@@ -453,6 +453,23 @@ Below is a grouped reference for all `config` options.
453
453
  | `pushNotifications.softAsk` | `boolean` | Do not immediately trigger browser permission prompt. |
454
454
  | `pushNotifications.onClick` | `(params) => void \| Promise<void>` | Callback invoked when the user clicks an OS push notification (including cold start via URL marker). |
455
455
 
456
+ ### Backend compatibility
457
+
458
+ Some features call routes that not every backend deployment serves yet. Each
459
+ switch below keeps that client code off until your backend has the route. The
460
+ defaults are the safe choice for a backend that has not been updated.
461
+
462
+ | Option | Default | Why |
463
+ | --- | --- | --- |
464
+ | `features.userBlock` | `false` | `/v1/chats/blocked` is not served by the production backend yet (404), so the "Block user" item would always fail. Set `true` once your backend serves it. |
465
+ | `attachments.captionMode` | `'separate'` | The caption goes out as its own text message after the media (the 26.9.8 wire shape), which older web builds, React Native and server push all show. `'inline'` puts it on the media message as `<data caption>`, which those readers do not render yet. |
466
+ | `uploads.endpoint` | `'auto'` | `'auto'` tries `/v2/files/secure` and falls back to `/v1/files/`. Secure-files URLs can be unreadable on a backend that is not updated, so `'legacy'` posts straight to `/v1/files/`. `'secure'` never falls back. |
467
+
468
+ | Option | Type | Description |
469
+ | --- | --- | --- |
470
+ | `features` | `{ userBlock?: boolean }` | Opt-in backend features. `userBlock` (default `false`) shows the "Block user" item in 1-1 chat menus and enables the `/v1/chats/blocked` calls. `disableUserBlock: true` still hides the item. |
471
+ | `uploads` | `{ endpoint?: 'auto' \| 'secure' \| 'legacy' }` | Attachment upload route. `'auto'` (default) tries `POST /v2/files/secure` and falls back to `POST /v1/files/` when the backend rejects it. `'legacy'` always uses `/v1/files/` (no `chatName`); `'secure'` uses the secure route and never falls back. |
472
+
456
473
  ### Error handling and crash containment
457
474
 
458
475
  The SDK renders inside your application's React tree. Without a boundary, one
@@ -1,8 +1,8 @@
1
1
  import { jsx as T, jsxs as j, Fragment as Pt } from "react/jsx-runtime";
2
2
  import Ue, { useRef as xt, useState as ee, useMemo as se } from "react";
3
- import { w as nr, b as St, x as he, a9 as or, B as te, E as Y, a as qe, u as ue, aa as Fe, N as _t, F as Mt, ab as At, ac as Dt, ad as Ot, ae as ar, af as Ne, ag as ir, ah as sr, a7 as lr, Q as Lt, a2 as ur, ai as cr, aj as $e, ak as fr, al as be, am as It, an as Bt, P as kt, $ as Nt, D as dr, ao as hr, ap as pr, aq as vr, ar as mr, as as gr, at as yr, au as We, av as br, y as Te, aw as Er, ax as Tr, ay as Cr, az as wr, M as Ge, aA as Rr, aB as Pr, aC as xr, aD as Ke, aE as Sr, aF as _r, a0 as Mr, aG as Ar, aH as Xe, aI as Dr, R as Or, aJ as Je } from "./main-Cdwk7Rjj.js";
4
- import { S as $t, f as Lr, b as je, D as de, a as ve, d as Ir, e as Br, g as Ve, h as Ze, i as kr, j as Nr, k as $r, l as et } from "./SideDrawer-BzfNGNbq.js";
5
- import { h as jr, P as Ur, a as qr, c as Fr, D as zr, d as Qr, e as tt, f as rt } from "./handleCopyClick-C-w304_U.js";
3
+ import { w as nr, b as St, x as he, a9 as or, B as te, E as Y, a as qe, u as ue, aa as Fe, N as _t, F as Mt, ab as At, ac as Dt, ad as Ot, ae as ar, af as Ne, ag as ir, ah as sr, a7 as lr, Q as Lt, a2 as ur, ai as cr, aj as $e, ak as fr, al as be, am as It, an as Bt, P as kt, $ as Nt, D as dr, ao as hr, ap as pr, aq as vr, ar as mr, as as gr, at as yr, au as We, av as br, y as Te, aw as Er, ax as Tr, ay as Cr, az as wr, M as Ge, aA as Rr, aB as Pr, aC as xr, aD as Ke, aE as Sr, aF as _r, a0 as Mr, aG as Ar, aH as Xe, aI as Dr, R as Or, aJ as Je } from "./main-36gqdbJ8.js";
4
+ import { S as $t, f as Lr, b as je, D as de, a as ve, d as Ir, e as Br, g as Ve, h as Ze, i as kr, j as Nr, k as $r, l as et } from "./SideDrawer-Cl-vbuIG.js";
5
+ import { h as jr, P as Ur, a as qr, c as Fr, D as zr, d as Qr, e as tt, f as rt } from "./handleCopyClick-Crn2jEEu.js";
6
6
  var le = {}, me = { exports: {} }, ge = { exports: {} }, k = {};
7
7
  var nt;
8
8
  function Hr() {
@@ -1,5 +1,5 @@
1
1
  import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
- import { b3 as et, b4 as tt, E as f, b5 as yt, x as Pe, b as Et, b6 as kt, b7 as nt, b8 as rt, b9 as ot, ba as Le, bb as Te, bc as Ce, aK as $e, K as Ae, bd as Ue, be as Pt, G as ke, bf as St, bg as it, a as Rt, a$ as Lt, u as le, aa as _e, bh as Tt, bi as Ct, bj as Se, bk as Mt, ax as ue, bl as Be, bm as It, bn as $t, bo as At, bp as Dt, bq as Ot, aJ as Ne, D as zt, br as Ut } from "./main-Cdwk7Rjj.js";
2
+ import { b3 as et, b4 as tt, E as f, b5 as yt, x as Pe, b as Et, b6 as kt, b7 as nt, b8 as rt, b9 as ot, ba as Le, bb as Te, bc as Ce, aK as $e, K as Ae, bd as Ue, be as Pt, G as ke, bf as St, bg as it, a as Rt, a$ as Lt, u as le, aa as _e, bh as Tt, bi as Ct, bj as Se, bk as Mt, ax as ue, bl as Be, bm as It, bn as $t, bo as At, bp as Dt, bq as Ot, aJ as Ne, D as zt, br as Ut } from "./main-36gqdbJ8.js";
3
3
  import Me, { useState as F, useRef as U, useEffect as M, useMemo as te, useCallback as B, useLayoutEffect as _t } from "react";
4
4
  const at = (t, o, i) => {
5
5
  const g = document.createElement("a");
@@ -1,7 +1,7 @@
1
1
  import { jsxs as o, Fragment as M, jsx as a } from "react/jsx-runtime";
2
2
  import { useState as m, useCallback as T } from "react";
3
- import { aK as I, E as t, aL as j, aM as w, B, u as E, x as R, Q as z, aN as F, S as U, D as x, aO as O, aP as $, aQ as A, aR as P } from "./main-Cdwk7Rjj.js";
4
- import { S as Q, D as f, a as u, b as D, e as v, f as b } from "./SideDrawer-BzfNGNbq.js";
3
+ import { aK as I, E as t, aL as j, aM as w, B, u as E, x as R, Q as z, aN as F, S as U, D as x, aO as O, aP as $, aQ as A, aR as P } from "./main-36gqdbJ8.js";
4
+ import { S as Q, D as f, a as u, b as D, e as v, f as b } from "./SideDrawer-Cl-vbuIG.js";
5
5
  t(j)`
6
6
  display: flex;
7
7
  box-sizing: border-box;
@@ -1,6 +1,6 @@
1
1
  import { jsxs as fs, jsx as ie, Fragment as hs } from "react/jsx-runtime";
2
2
  import "react";
3
- import { w as ei } from "./main-Cdwk7Rjj.js";
3
+ import { w as ei } from "./main-36gqdbJ8.js";
4
4
  function zr(e) {
5
5
  const t = [], n = String(e || "");
6
6
  let r = n.indexOf(","), u = 0, i = !1;
@@ -1,7 +1,7 @@
1
1
  import { jsx as a, jsxs as i, Fragment as G } from "react/jsx-runtime";
2
2
  import { useRef as J, useState as h, useMemo as I, useEffect as V } from "react";
3
- import { x as Y, a as W, aU as X, u as z, at as Z, as as K, au as ee, aV as re, aW as te, aB as ae, aX as oe, aY as se, aZ as ne, E as c, y as ie } from "./main-Cdwk7Rjj.js";
4
- import { S as ce, i as le, j as de, f as S } from "./SideDrawer-BzfNGNbq.js";
3
+ import { x as Y, a as W, aU as X, u as z, at as Z, as as K, au as ee, aV as re, aW as te, aB as ae, aX as oe, aY as se, aZ as ne, E as c, y as ie } from "./main-36gqdbJ8.js";
4
+ import { S as ce, i as le, j as de, f as S } from "./SideDrawer-Cl-vbuIG.js";
5
5
  function he(t) {
6
6
  const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t || "");
7
7
  if (!e) return;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as d, jsx as a } from "react/jsx-runtime";
2
2
  import { useState as p, useRef as E, useCallback as N, useEffect as P, useMemo as z } from "react";
3
- import { l as T, a_ as U, x as _, a as F, aU as H, u as A, aB as J, E as c, a7 as q, y as G } from "./main-Cdwk7Rjj.js";
4
- import { S as V, i as Z, j as K, f as S } from "./SideDrawer-BzfNGNbq.js";
3
+ import { l as T, a_ as U, x as _, a as F, aU as H, u as A, aB as J, E as c, a7 as q, y as G } from "./main-36gqdbJ8.js";
4
+ import { S as V, i as Z, j as K, f as S } from "./SideDrawer-Cl-vbuIG.js";
5
5
  const I = 50;
6
6
  async function Q({
7
7
  offset: r = 0,
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
2
  import { useId as f, useRef as v } from "react";
3
- import { x as g, F as u, aU as m, a$ as w, B as b, b0 as y, E as e, b1 as D, b2 as k } from "./main-Cdwk7Rjj.js";
3
+ import { x as g, F as u, aU as m, a$ as w, B as b, b0 as y, E as e, b1 as D, b2 as k } from "./main-36gqdbJ8.js";
4
4
  const c = 767, R = `${c}px`, z = e.div`
5
5
  position: relative;
6
6
  pointer-events: auto;
@@ -1,8 +1,8 @@
1
1
  import { jsxs as u, Fragment as $, jsx as o } from "react/jsx-runtime";
2
2
  import { forwardRef as ge, useState as I, useCallback as y, useImperativeHandle as ve, useRef as ae, useMemo as M } from "react";
3
- import { a as be, x as J, z as ye, C as xe, D as we, P as re, I as H, E as D, F as Ce, G as Se, J as Ie, K as te, L as De, N as Ne, O as ke, Q as Ue, u as Q, R as Fe, S as Pe, T as Ae, U as Re, W as Y, y as Z, X as ze, Y as je, Z as Be, h as $e, B as X, _ as Ee, $ as Oe, a0 as Te, a1 as ee, a2 as R, a3 as Le, a4 as Me, V as He, A as Xe, a5 as We, a6 as Je, a7 as Ke, a8 as Ve } from "./main-Cdwk7Rjj.js";
4
- import { D as E, a as W, b as Ge, e as _e, f as qe, S as Qe } from "./SideDrawer-BzfNGNbq.js";
5
- import { P as ne, a as Ye, D as Ze, b as eo, h as oo } from "./handleCopyClick-C-w304_U.js";
3
+ import { a as be, x as J, z as ye, C as xe, D as we, P as re, I as H, E as D, F as Ce, G as Se, J as Ie, K as te, L as De, N as Ne, O as ke, Q as Ue, u as Q, R as Fe, S as Pe, T as Ae, U as Re, W as Y, y as Z, X as ze, Y as je, Z as Be, h as $e, B as X, _ as Ee, $ as Oe, a0 as Te, a1 as ee, a2 as R, a3 as Le, a4 as Me, V as He, A as Xe, a5 as We, a6 as Je, a7 as Ke, a8 as Ve } from "./main-36gqdbJ8.js";
4
+ import { D as E, a as W, b as Ge, e as _e, f as qe, S as Qe } from "./SideDrawer-Cl-vbuIG.js";
5
+ import { P as ne, a as Ye, D as Ze, b as eo, h as oo } from "./handleCopyClick-Crn2jEEu.js";
6
6
  const ao = (c, i) => {
7
7
  const l = atob(c.split(",")[1]), g = new ArrayBuffer(l.length), e = new Uint8Array(g);
8
8
  for (let r = 0; r < l.length; r++)
@@ -1,7 +1,7 @@
1
1
  import { jsx as i, jsxs as r } from "react/jsx-runtime";
2
2
  import m, { useCallback as D, useMemo as h } from "react";
3
- import { x as g, a as p, y as w, M as l } from "./main-Cdwk7Rjj.js";
4
- import { S as b, D as u, a as y, b as k, c as S, d as f } from "./SideDrawer-BzfNGNbq.js";
3
+ import { x as g, a as p, y as w, M as l } from "./main-36gqdbJ8.js";
4
+ import { S as b, D as u, a as y, b as k, c as S, d as f } from "./SideDrawer-Cl-vbuIG.js";
5
5
  const T = ({
6
6
  handleCloseModal: n
7
7
  }) => {
@@ -1,7 +1,7 @@
1
1
  import { jsxs as J, jsx as I, Fragment as zr } from "react/jsx-runtime";
2
2
  import * as F from "react";
3
3
  import { useState as $t, useRef as ye, useEffect as ae, useMemo as wt, useCallback as Un } from "react";
4
- import { u as Qi, P as Yn, H as Oi, a as Gd, b as Yd, i as gr, c as vr, g as $d, s as Xd, d as mo, e as Qd, f as Zd, h as go, j as eu, k as tu, l as vo, m as nu, n as iu, o as bo, p as ru, q as su, r as yo, t as ou, v as au, A as ko, V as To, B as cu } from "./main-Cdwk7Rjj.js";
4
+ import { u as Qi, P as Yn, H as Oi, a as Gd, b as Yd, i as gr, c as vr, g as $d, s as Xd, d as mo, e as Qd, f as Zd, h as go, j as eu, k as tu, l as vo, m as nu, n as iu, o as bo, p as ru, q as su, r as yo, t as ou, v as au, A as ko, V as To, B as cu } from "./main-36gqdbJ8.js";
5
5
  function lu(n, e) {
6
6
  return e.forEach(function(t) {
7
7
  t && typeof t != "string" && !Array.isArray(t) && Object.keys(t).forEach(function(i) {
@@ -1,7 +1,7 @@
1
1
  import { jsxs as r, jsx as s } from "react/jsx-runtime";
2
2
  import { useState as b, useEffect as x } from "react";
3
- import { E as o, a as L, x as P, u as T, aS as D, aT as z } from "./main-Cdwk7Rjj.js";
4
- import { S as I, D as C, a as $, b as k, e as S, f as p } from "./SideDrawer-BzfNGNbq.js";
3
+ import { E as o, a as L, x as P, u as T, aS as D, aT as z } from "./main-36gqdbJ8.js";
4
+ import { S as I, D as C, a as $, b as k, e as S, f as p } from "./SideDrawer-Cl-vbuIG.js";
5
5
  o.div``;
6
6
  o.div`
7
7
  font-size: 16px;
@@ -6,8 +6,9 @@ export interface SendInputProps {
6
6
  /**
7
7
  * Receives a `File[]` for picked attachments (one message, N files) and a
8
8
  * `Blob` for voice notes. Single files still arrive as a one-element array.
9
- * Text typed with the files arrives as `caption` and is sent inside that
10
- * same media message, so it can never land as a separate bubble.
9
+ * Text typed with the files arrives as `caption`; whether it rides on that
10
+ * media message or follows it as a text message depends on
11
+ * `config.attachments.captionMode`.
11
12
  */
12
13
  sendMedia: (data: File[] | File | Blob, type: string, caption?: CaptionInput) => void | boolean | Promise<void | boolean>;
13
14
  isLoading: boolean;
@@ -1,4 +1,4 @@
1
- import { E as e, G as t } from "./main-Cdwk7Rjj.js";
1
+ import { E as e, G as t } from "./main-36gqdbJ8.js";
2
2
  const i = e.div`
3
3
  display: flex;
4
4
  flex-direction: column;