@ethora/chat-component 26.10.6 → 26.10.8

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 (94) hide show
  1. package/README.md +102 -3
  2. package/dist/ChatProfileModal-83t5BRkI.js +2298 -0
  3. package/dist/{FilePreviewModal-DwNUEHei.js → FilePreviewModal-DxUGjSHe.js} +135 -135
  4. package/dist/{ManageDataModal-CaQ2VBPn.js → ManageDataModal-DFE_Wegj.js} +24 -24
  5. package/dist/{MarkdownBody-BeoG2cpo.js → MarkdownBody-uFITrPjT.js} +1 -1
  6. package/dist/{MessageSearchModal-DMw9o49-.js → MessageSearchModal-CsbTWgNm.js} +46 -46
  7. package/dist/{PublicChatsModal-CWdYILv_.js → PublicChatsModal-bDOp3IL9.js} +18 -18
  8. package/dist/{SideDrawer-Cl-vbuIG.js → SideDrawer-A_1ECqD2.js} +29 -29
  9. package/dist/UserProfileModal-Ca5wHYvr.js +639 -0
  10. package/dist/{UserSettingsModal-DgCAHmNh.js → UserSettingsModal-CAyyQGV6.js} +4 -4
  11. package/dist/{VideoCallOverlay-Cq2cECWj.js → VideoCallOverlay-BMiQh8kI.js} +6605 -4726
  12. package/dist/{VisibilityModal-D7vqGbrA.js → VisibilityModal-BXyIy7_J.js} +12 -12
  13. package/dist/assets/icons.d.ts +4 -0
  14. package/dist/calls/callDisplay.d.ts +22 -0
  15. package/dist/calls/callMode.d.ts +105 -0
  16. package/dist/calls/openScheduledCall.d.ts +20 -0
  17. package/dist/calls/p2p/P2PCallController.d.ts +160 -0
  18. package/dist/calls/p2p/icePolicy.d.ts +36 -0
  19. package/dist/calls/p2p/negotiator.d.ts +56 -0
  20. package/dist/calls/p2p/p2pRuntime.d.ts +35 -0
  21. package/dist/calls/p2p/signalInbox.d.ts +34 -0
  22. package/dist/calls/p2p/signalStanza.d.ts +51 -0
  23. package/dist/calls/placeCall.d.ts +20 -0
  24. package/dist/calls/scheduledCall.d.ts +101 -0
  25. package/dist/calls/scheduledCallActions.d.ts +12 -0
  26. package/dist/calls/scheduledCallFormat.d.ts +13 -0
  27. package/dist/calls/scheduledCallsConfig.d.ts +27 -0
  28. package/dist/calls/senderTrust.d.ts +7 -0
  29. package/dist/calls/startCall.d.ts +16 -0
  30. package/dist/components/MainComponents/ChatWrapper.d.ts +1 -0
  31. package/dist/components/MainComponents/LoginWrapper.d.ts +1 -0
  32. package/dist/components/MainComponents/ProfileImagePlaceholder.d.ts +1 -0
  33. package/dist/components/MainComponents/ReduxWrapper.d.ts +6 -0
  34. package/dist/components/MenuRoom/MenuRoom.d.ts +1 -0
  35. package/dist/components/Modals/NewChatModal/styledNewChatComponents.d.ts +27 -0
  36. package/dist/components/Modals/styledModalComponents.d.ts +25 -4
  37. package/dist/components/ScheduledCalls/ScheduleCallModal.d.ts +3 -0
  38. package/dist/components/ScheduledCalls/ScheduledCallCancelConfirm.d.ts +8 -0
  39. package/dist/components/ScheduledCalls/ScheduledCallCard.d.ts +7 -0
  40. package/dist/components/ScheduledCalls/ScheduledCallLayer.d.ts +15 -0
  41. package/dist/components/ScheduledCalls/ScheduledCallPreJoin.d.ts +3 -0
  42. package/dist/components/VideoCalls/P2PCallRunner.d.ts +1 -0
  43. package/dist/components/VideoCalls/P2PCallSession.d.ts +14 -0
  44. package/dist/components/VideoCalls/VideoCallSession.d.ts +39 -0
  45. package/dist/firebase-messaging-sw.js +918 -96
  46. package/dist/{handleCopyClick-Crn2jEEu.js → handleCopyClick-BX1fcFGN.js} +1 -1
  47. package/dist/helpers/callClaim.d.ts +17 -0
  48. package/dist/helpers/callOutcomeSync.d.ts +23 -0
  49. package/dist/helpers/callPush.d.ts +25 -0
  50. package/dist/helpers/canLeaveRoom.d.ts +3 -0
  51. package/dist/helpers/chatComponentConfigEvents.d.ts +16 -0
  52. package/dist/helpers/incomingCallPush.d.ts +89 -0
  53. package/dist/helpers/liveConfig.d.ts +46 -0
  54. package/dist/helpers/pushRoomHandoff.d.ts +13 -0
  55. package/dist/helpers/reportRoom.d.ts +18 -0
  56. package/dist/helpers/scheduledCallMessage.d.ts +23 -0
  57. package/dist/helpers/storeConsole.d.ts +1 -0
  58. package/dist/hooks/useChatSettingState.d.ts +1 -0
  59. package/dist/hooks/useNow.d.ts +6 -0
  60. package/dist/hooks/usePushNotifications.d.ts +2 -0
  61. package/dist/hooks/useRemoteAppearance.d.ts +21 -0
  62. package/dist/hooks/useTypography.d.ts +4 -0
  63. package/dist/{main-36gqdbJ8.js → main-B25iFKAC.js} +16623 -13399
  64. package/dist/main.d.ts +3 -1
  65. package/dist/main.js +25 -23
  66. package/dist/networking/api-requests/callState.api.d.ts +24 -0
  67. package/dist/networking/api-requests/remoteAppearance.api.d.ts +20 -0
  68. package/dist/networking/api-requests/rooms.api.d.ts +11 -1
  69. package/dist/networking/api-requests/scheduledCalls.api.d.ts +19 -0
  70. package/dist/networking/ethoraEvents.d.ts +14 -1
  71. package/dist/networking/xmpp/notifyXmppEvent.d.ts +6 -0
  72. package/dist/networking/xmpp/sendMessageReaction.xmpp.d.ts +13 -1
  73. package/dist/networking/xmppClient.d.ts +2 -1
  74. package/dist/roomStore/Middleware/blockedHydrationMiddleware.d.ts +2 -0
  75. package/dist/roomStore/callSlice.d.ts +23 -1
  76. package/dist/roomStore/chatSettingsSlice.d.ts +11 -2
  77. package/dist/roomStore/index.d.ts +4 -0
  78. package/dist/roomStore/scheduledCallSlice.d.ts +47 -0
  79. package/dist/types/models/config.model.d.ts +78 -1
  80. package/dist/types/models/message.model.d.ts +2 -0
  81. package/dist/types/models/room.model.d.ts +2 -0
  82. package/dist/types/models/scheduledCall.model.d.ts +116 -0
  83. package/dist/types/models/xmpp.model.d.ts +2 -1
  84. package/dist/utils/callAuthMirror.d.ts +1 -0
  85. package/dist/utils/callBroadcast.d.ts +12 -0
  86. package/dist/utils/callNotifications.d.ts +67 -0
  87. package/dist/utils/firebasePushNotifications.d.ts +14 -0
  88. package/dist/utils/handledCalls.d.ts +5 -0
  89. package/dist/utils/pushServiceWorkerBridge.d.ts +19 -0
  90. package/dist/utils/webLock.d.ts +13 -0
  91. package/package.json +1 -1
  92. package/public/firebase-messaging-sw.js +918 -96
  93. package/dist/ChatProfileModal-OJCKwdNp.js +0 -2168
  94. package/dist/UserProfileModal-B8KtGnwZ.js +0 -594
@@ -0,0 +1,639 @@
1
+ import { jsxs as g, Fragment as T, jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as Ce, useState as D, useCallback as b, useImperativeHandle as Se, useRef as ie, useMemo as J } from "react";
3
+ import { a as De, Z as G, a0 as Ie, a1 as ke, a2 as le, P as ce, a3 as W, a4 as I, a5 as Ue, a6 as Ne, a7 as Pe, a8 as de, a9 as Re, aa as Ae, ab as Fe, ac as je, u as O, ad as Be, ae as ze, af as Ee, ag as $e, ah as Oe, ai as re, _ as K, aj as Te, ak as Le, al as Me, d as Xe, am as He, an as Je, ao as We, ap as te, U as V, aq as Ke, ar as Ve, as as qe, at as ne, au as A, av as Ge, aw as _e, V as Ze, T as Qe, ax as Ye, ay as eo, az as oo, aA as ao } from "./main-B25iFKAC.js";
4
+ import { D as L, a as q, b as ro, e as to, f as no, S as so } from "./SideDrawer-A_1ECqD2.js";
5
+ import { P as pe, a as io, D as lo, b as co, h as po } from "./handleCopyClick-BX1fcFGN.js";
6
+ const mo = (p, t) => {
7
+ const l = atob(p.split(",")[1]), u = new ArrayBuffer(l.length), e = new Uint8Array(u);
8
+ for (let n = 0; n < l.length; n++)
9
+ e[n] = l.charCodeAt(n);
10
+ const i = new Blob([e], { type: "image/jpeg" });
11
+ return new File([i], t, { type: "image/jpeg" });
12
+ }, uo = I.div`
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: var(--ethora-space-4, 16px);
16
+ width: 100%;
17
+ `, me = Ce(
18
+ ({ setIsEditing: p, modalUser: t, config: l }, u) => {
19
+ const e = De(), i = G(), [n, a] = D(t?.firstName || ""), [h, F] = D(t?.lastName || ""), [y, k] = D(t?.description || ""), [v, C] = D(
20
+ t?.profileImage
21
+ ), S = b(async () => {
22
+ try {
23
+ let c = new FormData();
24
+ if (typeof v == "string" && v.startsWith("data:image/")) {
25
+ const N = mo(v, "profileImage.jpg");
26
+ c.append("file", N);
27
+ } else v instanceof File && c.append("file", v);
28
+ c.append("firstName", n), c.append("lastName", h), c.append("description", y);
29
+ const { user: U } = await Ie(c);
30
+ e(
31
+ ke({
32
+ updates: {
33
+ firstName: n,
34
+ lastName: h,
35
+ description: y,
36
+ profileImage: U?.profileImage
37
+ }
38
+ })
39
+ ), p(!1);
40
+ } catch (c) {
41
+ le.log("error", c);
42
+ }
43
+ }, [
44
+ e,
45
+ y,
46
+ n,
47
+ h,
48
+ v,
49
+ p
50
+ ]);
51
+ Se(u, () => ({ save: S }), [S]);
52
+ const x = (c) => {
53
+ C(c);
54
+ };
55
+ return /* @__PURE__ */ g(T, { children: [
56
+ /* @__PURE__ */ o(pe, { children: /* @__PURE__ */ o(
57
+ ce,
58
+ {
59
+ icon: v,
60
+ name: `${n} ${h}`,
61
+ size: 96,
62
+ upload: {
63
+ onUpload: x,
64
+ active: !0
65
+ }
66
+ }
67
+ ) }),
68
+ /* @__PURE__ */ o(L, { children: /* @__PURE__ */ g(uo, { children: [
69
+ /* @__PURE__ */ o(
70
+ W,
71
+ {
72
+ color: l?.colors?.primary,
73
+ colorBg: l?.colors?.colorInput,
74
+ placeholder: i("field.firstName"),
75
+ label: i("field.firstName"),
76
+ value: n,
77
+ onChange: (c) => a(c.target.value)
78
+ }
79
+ ),
80
+ /* @__PURE__ */ o(
81
+ W,
82
+ {
83
+ color: l?.colors?.primary,
84
+ colorBg: l?.colors?.colorInput,
85
+ placeholder: i("field.lastName"),
86
+ label: i("field.lastName"),
87
+ value: h,
88
+ onChange: (c) => F(c.target.value)
89
+ }
90
+ ),
91
+ /* @__PURE__ */ o(
92
+ W,
93
+ {
94
+ color: l?.colors?.primary,
95
+ colorBg: l?.colors?.colorInput,
96
+ placeholder: i("modal.profile.about"),
97
+ label: i("modal.profile.about"),
98
+ value: y,
99
+ onChange: (c) => k(c.target.value)
100
+ }
101
+ )
102
+ ] }) })
103
+ ] });
104
+ }
105
+ );
106
+ me.displayName = "EditUserModal";
107
+ const fo = de`
108
+ from {
109
+ transform: rotate(0deg);
110
+ }
111
+ to {
112
+ transform: rotate(180deg);
113
+ }
114
+ `, ho = de`
115
+ from {
116
+ transform: rotate(180deg);
117
+ }
118
+ to {
119
+ transform: rotate(0deg);
120
+ }
121
+ `, go = I.div`
122
+ position: relative;
123
+ width: 100%;
124
+ `, vo = I.div`
125
+ border: 1px solid
126
+ ${({ $borderColor: p, $isOpen: t }) => t ? p || "var(--ethora-color-primary, #0052cd)" : p || "var(--ethora-color-border, #e6e8ec)"};
127
+ padding: 0 16px;
128
+ height: 48px;
129
+ box-sizing: border-box;
130
+ display: flex;
131
+ justify-content: space-between;
132
+ align-items: center;
133
+ cursor: pointer;
134
+ background-color: var(--ethora-color-bg, #fff);
135
+ color: var(--ethora-color-text, #141414);
136
+ font-size: var(--ethora-font-size, 16px);
137
+ border-radius: var(--ethora-radius-md, 16px);
138
+ transition:
139
+ border-color var(--ethora-motion-fast, 150ms) var(--ethora-motion-ease, ease),
140
+ box-shadow var(--ethora-motion-fast, 150ms) var(--ethora-motion-ease, ease);
141
+
142
+ ${({ $isOpen: p }) => p && Ne`
143
+ outline: 2px solid var(--ethora-color-primary, #0052cd);
144
+ outline-offset: 1px;
145
+ `}
146
+
147
+ &:focus-visible {
148
+ outline: 2px solid var(--ethora-color-primary, #0052cd);
149
+ outline-offset: 1px;
150
+ }
151
+ `, bo = I.span`
152
+ color: var(--ethora-color-text-muted, #8c8c8c);
153
+ `, yo = I.span`
154
+ margin-left: 10px;
155
+ display: inline-block;
156
+ color: var(--ethora-color-text-muted, #8c8c8c);
157
+ font-size: 12px;
158
+ animation: ${(p) => p.$isOpen ? fo : ho} 0.3s ease
159
+ forwards;
160
+ `, wo = I.div`
161
+ position: absolute;
162
+ top: 100%;
163
+ left: 0;
164
+ right: 0;
165
+ border: 1px solid var(--ethora-color-border, #e6e8ec);
166
+ background-color: var(--ethora-color-bg, #fff);
167
+ max-height: 200px;
168
+ overflow-y: auto;
169
+ margin-top: 4px;
170
+ border-radius: var(--ethora-radius-md, 16px);
171
+ box-shadow: var(--ethora-shadow-md, 0 4px 12px rgba(16, 24, 40, 0.1));
172
+ z-index: 100;
173
+ ${Pe}
174
+ `, xo = I.input`
175
+ width: 100%;
176
+ padding: 12px 16px;
177
+ border: none;
178
+ border-bottom: 1px solid var(--ethora-color-border, #e6e8ec);
179
+ outline: none;
180
+ box-sizing: border-box;
181
+ font-size: var(--ethora-font-size-sm, 14px);
182
+ background: transparent;
183
+ color: var(--ethora-color-text, #141414);
184
+
185
+ &::placeholder {
186
+ color: var(--ethora-color-text-muted, #8c8c8c);
187
+ }
188
+ `, se = I.div`
189
+ padding: 12px 16px;
190
+ cursor: pointer;
191
+ font-size: var(--ethora-font-size-sm, 14px);
192
+ color: var(--ethora-color-text, #141414);
193
+ background-color: ${({ $selected: p }) => p ? "var(--ethora-color-primary-soft, #e7edf9)" : "transparent"};
194
+ transition: background-color var(--ethora-motion-fast, 150ms);
195
+
196
+ &:hover {
197
+ background-color: ${({ $selected: p }) => p ? "var(--ethora-color-primary-soft, #e7edf9)" : "var(--ethora-color-bg-hover, #f0f2f5)"};
198
+ }
199
+ `, Co = ({
200
+ options: p,
201
+ placeholder: t,
202
+ onSelect: l,
203
+ accentColor: u,
204
+ selectedValue: e
205
+ }) => {
206
+ const i = G(), [n, a] = D(!1), [h, F] = D(
207
+ e
208
+ ), [y, k] = D(""), v = ie(null), C = () => a((r) => !r), S = (r) => {
209
+ F(r), l(r), a(!1), k("");
210
+ }, x = p.filter(
211
+ (r) => r.name.toLowerCase().includes(y.toLowerCase())
212
+ ), c = b(() => a(!1), []);
213
+ Ue({
214
+ enabled: n,
215
+ onClose: c,
216
+ kind: "menu",
217
+ insideRefs: [v],
218
+ closeOnOutsidePress: !0
219
+ });
220
+ const U = (r) => {
221
+ r.key === "Enter" || r.key === " " ? (r.preventDefault(), C()) : r.key === "Escape" && n && a(!1);
222
+ }, N = (r, j) => {
223
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), S(j));
224
+ };
225
+ return /* @__PURE__ */ g(go, { ref: v, children: [
226
+ /* @__PURE__ */ g(
227
+ vo,
228
+ {
229
+ $isOpen: n,
230
+ onClick: C,
231
+ onKeyDown: U,
232
+ $borderColor: u,
233
+ role: "button",
234
+ tabIndex: 0,
235
+ "aria-haspopup": "listbox",
236
+ "aria-expanded": n,
237
+ children: [
238
+ h ? /* @__PURE__ */ o("span", { children: h.name }) : /* @__PURE__ */ o(bo, { children: t }),
239
+ /* @__PURE__ */ o(yo, { style: { color: u }, $isOpen: n, children: "▼" })
240
+ ]
241
+ }
242
+ ),
243
+ n && /* @__PURE__ */ g(wo, { role: "listbox", children: [
244
+ /* @__PURE__ */ o(
245
+ xo,
246
+ {
247
+ type: "text",
248
+ placeholder: i("search.placeholder"),
249
+ value: y,
250
+ onChange: (r) => k(r.target.value)
251
+ }
252
+ ),
253
+ x.length > 0 ? x.map((r) => /* @__PURE__ */ o(
254
+ se,
255
+ {
256
+ onClick: () => S(r),
257
+ onKeyDown: (j) => N(j, r),
258
+ role: "option",
259
+ tabIndex: 0,
260
+ "aria-selected": h?.id === r.id,
261
+ $selected: h?.id === r.id,
262
+ children: r.name
263
+ },
264
+ r.id
265
+ )) : /* @__PURE__ */ o(se, { children: i("select.noOptions") })
266
+ ] })
267
+ ] });
268
+ }, No = ({
269
+ handleCloseModal: p
270
+ }) => {
271
+ const t = Re(), { client: l } = Ae();
272
+ Fe();
273
+ const { showToast: u } = je(), e = G(), { config: i, user: n, selectedUser: a, langSource: h } = O(
274
+ (s) => s.chatSettingStore
275
+ ), F = O((s) => s.call.phase), y = O((s) => s.rooms.rooms), k = O(
276
+ (s) => s.rooms.activeRoomJID
277
+ ), [v, C] = D(!1), S = ie(null), x = i?.videoCalls, c = i?.e2ee?.enabled === !0, U = x?.enabled === !0 && !!x?.livekitUrl?.trim() && Be("private", x?.allowedRoomTypes), N = U && x?.enableAudioCalls === !0, r = F !== "idle", j = b(() => {
278
+ t(ze()), p();
279
+ }, []), _ = b(() => {
280
+ Ee.performLogout();
281
+ }, []), ue = J(
282
+ () => [
283
+ {
284
+ label: e("action.logOut"),
285
+ icon: /* @__PURE__ */ o($e, {}),
286
+ onClick: () => {
287
+ _();
288
+ },
289
+ styles: { color: "var(--ethora-color-danger, #D92D20)" }
290
+ }
291
+ ],
292
+ [_, e]
293
+ ), fe = (s) => {
294
+ t(ao(s.id));
295
+ }, he = b(() => {
296
+ C(!0);
297
+ }, []), ge = async (s, d) => {
298
+ try {
299
+ const m = eo(
300
+ s,
301
+ i?.xmppSettings?.conference,
302
+ d
303
+ );
304
+ if (!m || !m.jid)
305
+ return console.error(
306
+ "handleRoomCreation: failed to normalize new private room",
307
+ s
308
+ ), u({
309
+ id: Date.now().toString(),
310
+ title: e("toast.error"),
311
+ message: e("toast.couldNotOpenPrivateChat"),
312
+ type: "error",
313
+ duration: 4e3
314
+ }), null;
315
+ if (t(
316
+ oo({
317
+ room: m,
318
+ xmpp: l
319
+ })
320
+ ), l && m.jid) {
321
+ try {
322
+ await l.presenceInRoomStanza(m.jid);
323
+ } catch (w) {
324
+ console.warn("presenceInRoomStanza failed (non-fatal):", w);
325
+ }
326
+ try {
327
+ l.getHistoryStanza(m.jid, 10);
328
+ } catch (w) {
329
+ console.warn("getHistoryStanza failed (non-fatal):", w);
330
+ }
331
+ }
332
+ return t(te({ roomJID: m.jid })), u({
333
+ id: Date.now().toString(),
334
+ title: e("toast.success"),
335
+ message: e("toast.roomCreatedSuccess"),
336
+ type: "success",
337
+ duration: 3e3
338
+ }), { jid: m.jid };
339
+ } catch (m) {
340
+ return console.error("Error handling room creation:", m), null;
341
+ }
342
+ }, z = b(async (s = !1) => {
343
+ const d = String(
344
+ a?.name || `${a?.firstName || ""} ${a?.lastName || ""}`
345
+ ).trim() || "";
346
+ if (i?.newArch !== !1) {
347
+ const X = a?.xmppUsername || a?.userJID || a?.id;
348
+ if (!X)
349
+ return u({
350
+ id: Date.now().toString(),
351
+ title: e("toast.error"),
352
+ message: e("toast.couldNotResolveRecipient"),
353
+ type: "error",
354
+ duration: 4e3
355
+ }), null;
356
+ try {
357
+ const $ = await Oe(X, s), H = await ge($, 2);
358
+ return H?.jid ? {
359
+ jid: H.jid,
360
+ bareName: H.jid.split("@")[0],
361
+ peerXmppUsername: String(X).split("@")[0],
362
+ peerDisplay: d
363
+ } : null;
364
+ } catch ($) {
365
+ return console.error("postPrivateRoom failed:", $), u({
366
+ id: Date.now().toString(),
367
+ title: e("toast.error"),
368
+ message: $?.message || e("toast.failedToCreatePrivateChat"),
369
+ type: "error",
370
+ duration: 4e3
371
+ }), null;
372
+ }
373
+ }
374
+ const m = re(a.id), ae = [re(n.defaultWallet.walletAddress), m].sort().join(".").toLowerCase(), R = [n.firstName, a.name?.split(" ")?.[0]].sort().join(" and "), B = await l.createPrivateRoomStanza(
375
+ R,
376
+ `Private chat ${R}`,
377
+ ae
378
+ );
379
+ return B && (await l.inviteRoomRequestStanza(m, B), await l.getRoomsStanza()), B ? {
380
+ jid: B,
381
+ bareName: String(B).split("@")[0],
382
+ peerXmppUsername: m,
383
+ peerDisplay: d
384
+ } : null;
385
+ }, [a, i?.newArch, l, n]), E = b(
386
+ async (s) => {
387
+ u({
388
+ id: Date.now().toString(),
389
+ title: e("toast.roomCreationTitle"),
390
+ message: e("toast.roomCreating"),
391
+ type: "info",
392
+ duration: 3e3
393
+ }), await z(s), t(K());
394
+ },
395
+ [z, t, u, e]
396
+ ), Z = b(
397
+ () => E(!1),
398
+ [E]
399
+ ), Q = b(
400
+ () => E(!0),
401
+ [E]
402
+ ), M = b(
403
+ async (s) => {
404
+ const d = await z();
405
+ if (!d) return;
406
+ const m = d.peerDisplay || d.bareName;
407
+ t(
408
+ Te({
409
+ roomJid: d.jid,
410
+ roomName: m,
411
+ roomBareName: d.bareName,
412
+ kind: s,
413
+ peerXmppUsername: d.peerXmppUsername || null
414
+ })
415
+ ), d.peerXmppUsername && Le(s, {
416
+ peerXmppUsername: d.peerXmppUsername,
417
+ roomBareName: d.bareName
418
+ }), t(K());
419
+ try {
420
+ await Me({
421
+ chatName: d.bareName,
422
+ kind: s,
423
+ peerXmppUsername: d.peerXmppUsername || null
424
+ });
425
+ } catch (w) {
426
+ const P = w instanceof Error ? w.message : e("toast.failedToCreateCall");
427
+ t(Xe(P));
428
+ }
429
+ },
430
+ [z, t, e]
431
+ ), Y = !!a && i?.features?.userBlock === !0 && !i?.disableUserBlock, ee = b(async () => {
432
+ const s = a?.xmppUsername || a?.userJID || a?.id;
433
+ if (s)
434
+ try {
435
+ await He(s);
436
+ const d = String(s).split("@")[0];
437
+ t(Je(d));
438
+ const m = n?.xmppUsername || "";
439
+ let w = !1;
440
+ Object.values(y || {}).forEach((P) => {
441
+ P.type !== "private" || !(P.members || []).some(
442
+ (R) => R.xmppUsername && R.xmppUsername !== m && R.xmppUsername.split("@")[0] === d
443
+ ) || (t(We({ jid: P.jid })), P.jid === k && (w = !0));
444
+ }), w && (typeof window < "u" && window.history.pushState(null, "", window.location.pathname), t(te({ roomJID: null }))), t(K()), u({
445
+ id: Date.now().toString(),
446
+ title: e("toast.success"),
447
+ message: e("toast.blockedSuccess"),
448
+ type: "success"
449
+ });
450
+ } catch (d) {
451
+ le.log("Block user failed", d), u({
452
+ id: Date.now().toString(),
453
+ title: e("toast.error"),
454
+ message: e("toast.blockFailed"),
455
+ type: "error"
456
+ });
457
+ }
458
+ }, [a, t, u, e, n?.xmppUsername, y, k]), f = a ?? n, ve = () => {
459
+ if (h)
460
+ return ne.find((s) => s.id === h);
461
+ }, be = a ? void 0 : /* @__PURE__ */ g(T, { children: [
462
+ /* @__PURE__ */ o(V, { onClick: he, "aria-label": e("action.editProfile"), children: /* @__PURE__ */ o(Ke, { color: "var(--ethora-color-text-muted, #8C8C8C)" }) }),
463
+ /* @__PURE__ */ o(
464
+ Ve,
465
+ {
466
+ options: ue,
467
+ position: "left",
468
+ menuIcon: /* @__PURE__ */ o(qe, {})
469
+ }
470
+ )
471
+ ] }), ye = /* @__PURE__ */ g(T, { children: [
472
+ /* @__PURE__ */ o(
473
+ V,
474
+ {
475
+ variant: "ghost",
476
+ onClick: () => C(!1),
477
+ style: { width: "auto", padding: "0 var(--ethora-space-3, 12px)" },
478
+ children: e("action.cancel")
479
+ }
480
+ ),
481
+ /* @__PURE__ */ o(
482
+ V,
483
+ {
484
+ variant: "filled",
485
+ onClick: () => {
486
+ S.current?.save();
487
+ },
488
+ style: { width: "auto", padding: "0 var(--ethora-space-4, 16px)" },
489
+ children: e("action.save")
490
+ }
491
+ )
492
+ ] }), oe = a && a.xmppUsername !== n.xmppUsername && !i?.disableProfilesInteractions, we = J(
493
+ () => /* @__PURE__ */ g(T, { children: [
494
+ /* @__PURE__ */ g(pe, { children: [
495
+ /* @__PURE__ */ o(
496
+ ce,
497
+ {
498
+ icon: f?.profileImage ?? null,
499
+ name: f?.name ?? f?.firstName,
500
+ size: 96
501
+ }
502
+ ),
503
+ /* @__PURE__ */ o(io, { children: f?.name ? `${f?.name}` : `${f?.firstName} ${f?.lastName}` })
504
+ ] }),
505
+ /* @__PURE__ */ g(L, { children: [
506
+ /* @__PURE__ */ o(q, { children: e("modal.profile.about") }),
507
+ /* @__PURE__ */ o(
508
+ lo,
509
+ {
510
+ $empty: !(f?.description && f?.description?.length > 4),
511
+ children: f?.description && f?.description?.length > 4 ? f.description : e("modal.profile.noDescription")
512
+ }
513
+ )
514
+ ] }),
515
+ !a && i?.translates?.enabled && /* @__PURE__ */ g(L, { children: [
516
+ /* @__PURE__ */ o(q, { children: e("modal.profile.preferences") }),
517
+ /* @__PURE__ */ o(ro, { children: /* @__PURE__ */ g(to, { children: [
518
+ /* @__PURE__ */ o(no, { children: e("modal.profile.languageHint") }),
519
+ /* @__PURE__ */ o(
520
+ Co,
521
+ {
522
+ options: ne,
523
+ placeholder: e("language.select"),
524
+ onSelect: fe,
525
+ accentColor: i?.colors?.primary,
526
+ selectedValue: ve()
527
+ }
528
+ )
529
+ ] }) })
530
+ ] }),
531
+ oe && /* @__PURE__ */ g(L, { children: [
532
+ /* @__PURE__ */ o(q, { children: e("modal.profile.actions") }),
533
+ /* @__PURE__ */ g(co, { children: [
534
+ /* @__PURE__ */ o(
535
+ A,
536
+ {
537
+ StartIcon: /* @__PURE__ */ o(Ge, {}),
538
+ onClick: Z,
539
+ variant: "filled",
540
+ children: e("action.message")
541
+ }
542
+ ),
543
+ c && /* @__PURE__ */ o(
544
+ A,
545
+ {
546
+ StartIcon: /* @__PURE__ */ o(_e, { color: "var(--ethora-color-text-on-primary, #FFFFFF)" }),
547
+ onClick: Q,
548
+ variant: "filled",
549
+ children: e("action.encryptedMessage")
550
+ }
551
+ ),
552
+ U && /* @__PURE__ */ o(
553
+ A,
554
+ {
555
+ StartIcon: /* @__PURE__ */ o(Ze, { color: "var(--ethora-color-text-on-primary, #FFFFFF)" }),
556
+ onClick: () => {
557
+ M("video");
558
+ },
559
+ disabled: r,
560
+ variant: "filled",
561
+ children: e(N ? "action.videoCall" : "action.call")
562
+ }
563
+ ),
564
+ N && /* @__PURE__ */ o(
565
+ A,
566
+ {
567
+ StartIcon: /* @__PURE__ */ o(Qe, { color: "var(--ethora-color-text-on-primary, #FFFFFF)" }),
568
+ onClick: () => {
569
+ M("audio");
570
+ },
571
+ disabled: r,
572
+ variant: "filled",
573
+ children: e("action.audioCall")
574
+ }
575
+ ),
576
+ /* @__PURE__ */ o(
577
+ A,
578
+ {
579
+ onClick: () => po(a.id),
580
+ variant: "outlined",
581
+ children: e("action.copyUserId")
582
+ }
583
+ ),
584
+ Y && /* @__PURE__ */ o(
585
+ A,
586
+ {
587
+ StartIcon: /* @__PURE__ */ o(Ye, {}),
588
+ onClick: ee,
589
+ variant: "outlined",
590
+ style: { color: "var(--ethora-color-danger, #D92D20)", borderColor: "var(--ethora-color-danger, #D92D20)" },
591
+ children: e("action.block")
592
+ }
593
+ )
594
+ ] })
595
+ ] })
596
+ ] }),
597
+ [
598
+ f,
599
+ U,
600
+ Y,
601
+ N,
602
+ r,
603
+ M,
604
+ ee,
605
+ Z,
606
+ Q,
607
+ c,
608
+ a,
609
+ oe,
610
+ n,
611
+ i,
612
+ h,
613
+ e
614
+ ]
615
+ ), xe = J(
616
+ () => /* @__PURE__ */ o(
617
+ me,
618
+ {
619
+ ref: S,
620
+ setIsEditing: C,
621
+ modalUser: f,
622
+ config: i
623
+ }
624
+ ),
625
+ [f]
626
+ );
627
+ return /* @__PURE__ */ o(
628
+ so,
629
+ {
630
+ title: e("modal.profile.title"),
631
+ onClose: j,
632
+ headerActions: v ? ye : be,
633
+ children: v ? xe : we
634
+ }
635
+ );
636
+ };
637
+ export {
638
+ No as default
639
+ };
@@ -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-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";
3
+ import { Z as g, a as p, _ as w, $ as l } from "./main-B25iFKAC.js";
4
+ import { S as b, D as u, a as k, b as y, c as S, d as f } from "./SideDrawer-A_1ECqD2.js";
5
5
  const T = ({
6
6
  handleCloseModal: n
7
7
  }) => {
@@ -31,8 +31,8 @@ const T = ({
31
31
  [t]
32
32
  );
33
33
  return /* @__PURE__ */ i(b, { title: t("settings.menu.title"), onClose: n, children: c.map((e) => /* @__PURE__ */ r(u, { children: [
34
- /* @__PURE__ */ i(y, { children: e.title }),
35
- /* @__PURE__ */ i(k, { children: e.rows.map((a, d) => /* @__PURE__ */ r(m.Fragment, { children: [
34
+ /* @__PURE__ */ i(k, { children: e.title }),
35
+ /* @__PURE__ */ i(y, { children: e.rows.map((a, d) => /* @__PURE__ */ r(m.Fragment, { children: [
36
36
  d > 0 && /* @__PURE__ */ i(S, {}),
37
37
  /* @__PURE__ */ i(
38
38
  f,