@ethora/chat-component 26.8.1 → 26.9.0

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/README.md +1 -0
  2. package/dist/{ChatProfileModal-DZVi2WRb.js → ChatProfileModal-DfXEnzJf.js} +6 -3
  3. package/dist/{FilePreviewModal-BelSYN5e.js → FilePreviewModal-Cs1tij9R.js} +35 -35
  4. package/dist/{ManageDataModal-Bs_0SHBL.js → ManageDataModal-BBOui09n.js} +3 -3
  5. package/dist/{MarkdownBody-BYUK4GVM.js → MarkdownBody-DttRXyAK.js} +3 -3
  6. package/dist/{SideDrawer-C_nWZRwH.js → SideDrawer-DLqEOqAi.js} +35 -35
  7. package/dist/UserProfileModal-DEtLQxkJ.js +594 -0
  8. package/dist/{UserSettingsModal-J7uJfki1.js → UserSettingsModal-Ddht5fc0.js} +9 -9
  9. package/dist/{VideoCallOverlay-BXHNEhdX.js → VideoCallOverlay-BJMarThf.js} +2673 -2662
  10. package/dist/VisibilityModal-CckTnGKB.js +138 -0
  11. package/dist/assets/icons.d.ts +8 -0
  12. package/dist/components/MainComponents/AttachmentList.d.ts +5 -0
  13. package/dist/components/MainComponents/SealedAttachmentList.d.ts +14 -0
  14. package/dist/components/RoomComponents/styled/LastMessageSealed.d.ts +14 -0
  15. package/dist/components/styled/AudioMessage.d.ts +38 -0
  16. package/dist/components/styled/MessageImage.d.ts +10 -0
  17. package/dist/e2ee/crypto.d.ts +32 -0
  18. package/dist/e2ee/fileEnvelope.d.ts +48 -0
  19. package/dist/e2ee/index.d.ts +53 -0
  20. package/dist/e2ee/omemo.d.ts +130 -0
  21. package/dist/e2ee/protobuf.d.ts +25 -0
  22. package/dist/e2ee/ratchet.d.ts +54 -0
  23. package/dist/e2ee/stanza.d.ts +24 -0
  24. package/dist/e2ee/store.d.ts +12 -0
  25. package/dist/{handleCopyClick-Bj2V_brV.js → handleCopyClick-CWw4UAlT.js} +2 -2
  26. package/dist/helpers/findMessagesForFile.d.ts +25 -0
  27. package/dist/helpers/sealedAttachments.d.ts +25 -0
  28. package/dist/helpers/xmppIdShape.d.ts +9 -0
  29. package/dist/helpers/xmppUsername.d.ts +1 -1
  30. package/dist/hooks/useChatWrapperInit.d.ts +5 -1
  31. package/dist/{main-DmtEeYji.js → main-BHtKhpBZ.js} +21004 -16820
  32. package/dist/main.d.ts +2 -0
  33. package/dist/main.js +23 -20
  34. package/dist/networking/api-requests/auth.api.d.ts +10 -1
  35. package/dist/networking/api-requests/rooms.api.d.ts +1 -1
  36. package/dist/networking/authRefresh.d.ts +6 -0
  37. package/dist/networking/xmpp/sendMediaMessage.xmpp.d.ts +12 -1
  38. package/dist/networking/xmpp/sendTextMessage.xmpp.d.ts +1 -1
  39. package/dist/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts +1 -1
  40. package/dist/networking/xmppClient.d.ts +39 -0
  41. package/dist/roomStore/storage.d.ts +2 -1
  42. package/dist/styles/tokens.d.ts +14 -4
  43. package/dist/types/models/config.model.d.ts +33 -0
  44. package/dist/types/models/message.model.d.ts +27 -0
  45. package/dist/types/models/room.model.d.ts +10 -0
  46. package/package.json +4 -1
  47. package/dist/UserProfileModal-CD2IB5SD.js +0 -574
  48. package/dist/VisibilityModal-4QJnWpAL.js +0 -132
@@ -1,574 +0,0 @@
1
- import { jsxs as f, Fragment as B, jsx as o } from "react/jsx-runtime";
2
- import { forwardRef as me, useState as D, useCallback as S, useImperativeHandle as he, useRef as ee, useMemo as H } from "react";
3
- import { a as fe, n as J, p as ue, q as ge, t as ve, P as oe, I as M, v as I, w as be, x as ye, y as xe, z as ae, C as we, D as Ce, E as Se, F as De, u as q, G as Ie, J as Ne, L as Ue, K as ke, N as _, o as Q, O as Ae, Q as Pe, R as Re, s as ze, B as X, S as je, T as Fe, U as Be, W as Y, X as F, Y as $e, V as Oe, A as Ee, Z as Te, _ as Le, $ as He, a0 as Me } from "./main-DmtEeYji.js";
4
- import { D as $, a as W, b as Xe, e as We, f as Je, S as Ke } from "./SideDrawer-C_nWZRwH.js";
5
- import { P as re, a as Ve, D as Ge, b as qe, h as _e } from "./handleCopyClick-Bj2V_brV.js";
6
- const Qe = (c, s) => {
7
- const i = atob(c.split(",")[1]), u = new ArrayBuffer(i.length), e = new Uint8Array(u);
8
- for (let r = 0; r < i.length; r++)
9
- e[r] = i.charCodeAt(r);
10
- const l = new Blob([e], { type: "image/jpeg" });
11
- return new File([l], s, { type: "image/jpeg" });
12
- }, Ye = I.div`
13
- display: flex;
14
- flex-direction: column;
15
- gap: var(--ethora-space-4, 16px);
16
- width: 100%;
17
- `, te = me(
18
- ({ setIsEditing: c, modalUser: s, config: i }, u) => {
19
- const e = fe(), l = J(), [r, t] = D(s?.firstName || ""), [h, k] = D(s?.lastName || ""), [b, w] = D(s?.description || ""), [g, y] = D(
20
- s?.profileImage
21
- ), x = S(async () => {
22
- try {
23
- let n = new FormData();
24
- if (typeof g == "string" && g.startsWith("data:image/")) {
25
- const U = Qe(g, "profileImage.jpg");
26
- n.append("file", U);
27
- } else g instanceof File && n.append("file", g);
28
- n.append("firstName", r), n.append("lastName", h), n.append("description", b);
29
- const { user: A } = await ue(n);
30
- e(
31
- ge({
32
- updates: {
33
- firstName: r,
34
- lastName: h,
35
- description: b,
36
- profileImage: A?.profileImage
37
- }
38
- })
39
- ), c(!1);
40
- } catch (n) {
41
- ve.log("error", n);
42
- }
43
- }, [
44
- e,
45
- b,
46
- r,
47
- h,
48
- g,
49
- c
50
- ]);
51
- he(u, () => ({ save: x }), [x]);
52
- const C = (n) => {
53
- y(n);
54
- };
55
- return /* @__PURE__ */ f(B, { children: [
56
- /* @__PURE__ */ o(re, { children: /* @__PURE__ */ o(
57
- oe,
58
- {
59
- icon: g,
60
- name: `${r} ${h}`,
61
- size: 96,
62
- upload: {
63
- onUpload: C,
64
- active: !0
65
- }
66
- }
67
- ) }),
68
- /* @__PURE__ */ o($, { children: /* @__PURE__ */ f(Ye, { children: [
69
- /* @__PURE__ */ o(
70
- M,
71
- {
72
- color: i?.colors?.primary,
73
- colorBg: i?.colors?.colorInput,
74
- placeholder: l("field.firstName"),
75
- label: l("field.firstName"),
76
- value: r,
77
- onChange: (n) => t(n.target.value)
78
- }
79
- ),
80
- /* @__PURE__ */ o(
81
- M,
82
- {
83
- color: i?.colors?.primary,
84
- colorBg: i?.colors?.colorInput,
85
- placeholder: l("field.lastName"),
86
- label: l("field.lastName"),
87
- value: h,
88
- onChange: (n) => k(n.target.value)
89
- }
90
- ),
91
- /* @__PURE__ */ o(
92
- M,
93
- {
94
- color: i?.colors?.primary,
95
- colorBg: i?.colors?.colorInput,
96
- placeholder: l("modal.profile.about"),
97
- label: l("modal.profile.about"),
98
- value: b,
99
- onChange: (n) => w(n.target.value)
100
- }
101
- )
102
- ] }) })
103
- ] });
104
- }
105
- );
106
- te.displayName = "EditUserModal";
107
- const Ze = ae`
108
- from {
109
- transform: rotate(0deg);
110
- }
111
- to {
112
- transform: rotate(180deg);
113
- }
114
- `, eo = ae`
115
- from {
116
- transform: rotate(180deg);
117
- }
118
- to {
119
- transform: rotate(0deg);
120
- }
121
- `, oo = I.div`
122
- position: relative;
123
- width: 100%;
124
- `, ao = I.div`
125
- border: 1px solid
126
- ${({ $borderColor: c, $isOpen: s }) => s ? c || "var(--ethora-color-primary, #0052cd)" : c || "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: c }) => c && ye`
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
- `, ro = I.span`
152
- color: var(--ethora-color-text-muted, #8c8c8c);
153
- `, to = I.span`
154
- margin-left: 10px;
155
- display: inline-block;
156
- color: var(--ethora-color-text-muted, #8c8c8c);
157
- font-size: 12px;
158
- animation: ${(c) => c.$isOpen ? Ze : eo} 0.3s ease
159
- forwards;
160
- `, no = 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
- ${xe}
174
- `, so = 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
- `, Z = 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: c }) => c ? "var(--ethora-color-primary-soft, #e7edf9)" : "transparent"};
194
- transition: background-color var(--ethora-motion-fast, 150ms);
195
-
196
- &:hover {
197
- background-color: ${({ $selected: c }) => c ? "var(--ethora-color-primary-soft, #e7edf9)" : "var(--ethora-color-bg-hover, #f0f2f5)"};
198
- }
199
- `, io = ({
200
- options: c,
201
- placeholder: s,
202
- onSelect: i,
203
- accentColor: u,
204
- selectedValue: e
205
- }) => {
206
- const l = J(), [r, t] = D(!1), [h, k] = D(
207
- e
208
- ), [b, w] = D(""), g = ee(null), y = () => t((a) => !a), x = (a) => {
209
- k(a), i(a), t(!1), w("");
210
- }, C = c.filter(
211
- (a) => a.name.toLowerCase().includes(b.toLowerCase())
212
- ), n = S(() => t(!1), []);
213
- be({
214
- enabled: r,
215
- onClose: n,
216
- kind: "menu",
217
- insideRefs: [g],
218
- closeOnOutsidePress: !0
219
- });
220
- const A = (a) => {
221
- a.key === "Enter" || a.key === " " ? (a.preventDefault(), y()) : a.key === "Escape" && r && t(!1);
222
- }, U = (a, P) => {
223
- (a.key === "Enter" || a.key === " ") && (a.preventDefault(), x(P));
224
- };
225
- return /* @__PURE__ */ f(oo, { ref: g, children: [
226
- /* @__PURE__ */ f(
227
- ao,
228
- {
229
- $isOpen: r,
230
- onClick: y,
231
- onKeyDown: A,
232
- $borderColor: u,
233
- role: "button",
234
- tabIndex: 0,
235
- "aria-haspopup": "listbox",
236
- "aria-expanded": r,
237
- children: [
238
- h ? /* @__PURE__ */ o("span", { children: h.name }) : /* @__PURE__ */ o(ro, { children: s }),
239
- /* @__PURE__ */ o(to, { style: { color: u }, $isOpen: r, children: "▼" })
240
- ]
241
- }
242
- ),
243
- r && /* @__PURE__ */ f(no, { role: "listbox", children: [
244
- /* @__PURE__ */ o(
245
- so,
246
- {
247
- type: "text",
248
- placeholder: l("search.placeholder"),
249
- value: b,
250
- onChange: (a) => w(a.target.value)
251
- }
252
- ),
253
- C.length > 0 ? C.map((a) => /* @__PURE__ */ o(
254
- Z,
255
- {
256
- onClick: () => x(a),
257
- onKeyDown: (P) => U(P, a),
258
- role: "option",
259
- tabIndex: 0,
260
- "aria-selected": h?.id === a.id,
261
- $selected: h?.id === a.id,
262
- children: a.name
263
- },
264
- a.id
265
- )) : /* @__PURE__ */ o(Z, { children: l("select.noOptions") })
266
- ] })
267
- ] });
268
- }, fo = ({
269
- handleCloseModal: c
270
- }) => {
271
- const s = we(), { client: i } = Ce();
272
- Se();
273
- const { showToast: u } = De(), e = J(), { config: l, user: r, selectedUser: t, langSource: h } = q(
274
- (d) => d.chatSettingStore
275
- ), k = q((d) => d.call.phase), [b, w] = D(!1), g = ee(null), y = l?.videoCalls, x = y?.enabled === !0 && !!y?.livekitUrl?.trim() && (y?.allowedRoomTypes || ["private"]).includes("private"), C = x && y?.enableAudioCalls === !0, n = k !== "idle", A = S(() => {
276
- s(Ie()), c();
277
- }, []), U = S(() => {
278
- Ne.performLogout();
279
- }, []), a = H(
280
- () => [
281
- {
282
- label: e("action.logOut"),
283
- icon: /* @__PURE__ */ o(Ue, {}),
284
- onClick: () => {
285
- U();
286
- },
287
- styles: { color: "var(--ethora-color-danger, #D92D20)" }
288
- }
289
- ],
290
- [U, e]
291
- ), P = (d) => {
292
- s(Me(d.id));
293
- }, ne = S(() => {
294
- w(!0);
295
- }, []), se = async (d, p) => {
296
- try {
297
- const v = Te(
298
- d,
299
- l?.xmppSettings?.conference,
300
- p
301
- );
302
- if (!v || !v.jid)
303
- return console.error(
304
- "handleRoomCreation: failed to normalize new private room",
305
- d
306
- ), u({
307
- id: Date.now().toString(),
308
- title: e("toast.error"),
309
- message: e("toast.couldNotOpenPrivateChat"),
310
- type: "error",
311
- duration: 4e3
312
- }), null;
313
- if (s(
314
- Le({
315
- room: v,
316
- xmpp: i
317
- })
318
- ), i && v.jid) {
319
- try {
320
- await i.presenceInRoomStanza(v.jid);
321
- } catch (N) {
322
- console.warn("presenceInRoomStanza failed (non-fatal):", N);
323
- }
324
- try {
325
- i.getHistoryStanza(v.jid, 10);
326
- } catch (N) {
327
- console.warn("getHistoryStanza failed (non-fatal):", N);
328
- }
329
- }
330
- return s(He({ roomJID: v.jid })), u({
331
- id: Date.now().toString(),
332
- title: e("toast.success"),
333
- message: e("toast.roomCreatedSuccess"),
334
- type: "success",
335
- duration: 3e3
336
- }), { jid: v.jid };
337
- } catch (v) {
338
- return console.error("Error handling room creation:", v), null;
339
- }
340
- }, z = S(async () => {
341
- const d = String(
342
- t?.name || `${t?.firstName || ""} ${t?.lastName || ""}`
343
- ).trim() || "";
344
- if (l?.newArch !== !1) {
345
- const T = t?.xmppUsername || t?.userJID || t?.id;
346
- if (!T)
347
- return u({
348
- id: Date.now().toString(),
349
- title: e("toast.error"),
350
- message: e("toast.couldNotResolveRecipient"),
351
- type: "error",
352
- duration: 4e3
353
- }), null;
354
- try {
355
- const j = await ke(T), L = await se(j, 2);
356
- return L?.jid ? {
357
- jid: L.jid,
358
- bareName: L.jid.split("@")[0],
359
- peerXmppUsername: String(T).split("@")[0],
360
- peerDisplay: d
361
- } : null;
362
- } catch (j) {
363
- return console.error("postPrivateRoom failed:", j), u({
364
- id: Date.now().toString(),
365
- title: e("toast.error"),
366
- message: j?.message || e("toast.failedToCreatePrivateChat"),
367
- type: "error",
368
- duration: 4e3
369
- }), null;
370
- }
371
- }
372
- const p = _(t.id), E = [_(r.defaultWallet.walletAddress), p].sort().join(".").toLowerCase(), G = [r.firstName, t.name?.split(" ")?.[0]].sort().join(" and "), R = await i.createPrivateRoomStanza(
373
- G,
374
- `Private chat ${G}`,
375
- E
376
- );
377
- return R && (await i.inviteRoomRequestStanza(p, R), await i.getRoomsStanza()), R ? {
378
- jid: R,
379
- bareName: String(R).split("@")[0],
380
- peerXmppUsername: p,
381
- peerDisplay: d
382
- } : null;
383
- }, [t, l?.newArch, i, r]), K = S(async () => {
384
- u({
385
- id: Date.now().toString(),
386
- title: e("toast.roomCreationTitle"),
387
- message: e("toast.roomCreating"),
388
- type: "info",
389
- duration: 3e3
390
- }), await z(), s(Q());
391
- }, [z, s, u, e]), O = S(
392
- async (d) => {
393
- const p = await z();
394
- if (!p) return;
395
- const v = p.peerDisplay || p.bareName;
396
- s(
397
- Ae({
398
- roomJid: p.jid,
399
- roomName: v,
400
- roomBareName: p.bareName,
401
- kind: d,
402
- peerXmppUsername: p.peerXmppUsername || null
403
- })
404
- ), p.peerXmppUsername && Pe(d, {
405
- peerXmppUsername: p.peerXmppUsername,
406
- roomBareName: p.bareName
407
- }), s(Q());
408
- try {
409
- await Re(p.bareName, { kind: d });
410
- } catch (N) {
411
- const E = N instanceof Error ? N.message : e("toast.failedToCreateCall");
412
- s(ze(E));
413
- }
414
- },
415
- [z, s, e]
416
- ), m = t ?? r, ie = () => {
417
- if (h)
418
- return Y.find((d) => d.id === h);
419
- }, le = t ? void 0 : /* @__PURE__ */ f(B, { children: [
420
- /* @__PURE__ */ o(X, { onClick: ne, "aria-label": e("action.editProfile"), children: /* @__PURE__ */ o(je, { color: "var(--ethora-color-text-muted, #8C8C8C)" }) }),
421
- /* @__PURE__ */ o(
422
- Fe,
423
- {
424
- options: a,
425
- position: "left",
426
- menuIcon: /* @__PURE__ */ o(Be, {})
427
- }
428
- )
429
- ] }), ce = /* @__PURE__ */ f(B, { children: [
430
- /* @__PURE__ */ o(
431
- X,
432
- {
433
- variant: "ghost",
434
- onClick: () => w(!1),
435
- style: { width: "auto", padding: "0 var(--ethora-space-3, 12px)" },
436
- children: e("action.cancel")
437
- }
438
- ),
439
- /* @__PURE__ */ o(
440
- X,
441
- {
442
- variant: "filled",
443
- onClick: () => {
444
- g.current?.save();
445
- },
446
- style: { width: "auto", padding: "0 var(--ethora-space-4, 16px)" },
447
- children: e("action.save")
448
- }
449
- )
450
- ] }), V = t && t.xmppUsername !== r.xmppUsername && !l?.disableProfilesInteractions, de = H(
451
- () => /* @__PURE__ */ f(B, { children: [
452
- /* @__PURE__ */ f(re, { children: [
453
- /* @__PURE__ */ o(
454
- oe,
455
- {
456
- icon: m?.profileImage ?? null,
457
- name: m?.name ?? m?.firstName,
458
- size: 96
459
- }
460
- ),
461
- /* @__PURE__ */ o(Ve, { children: m?.name ? `${m?.name}` : `${m?.firstName} ${m?.lastName}` })
462
- ] }),
463
- /* @__PURE__ */ f($, { children: [
464
- /* @__PURE__ */ o(W, { children: e("modal.profile.about") }),
465
- /* @__PURE__ */ o(
466
- Ge,
467
- {
468
- $empty: !(m?.description && m?.description?.length > 4),
469
- children: m?.description && m?.description?.length > 4 ? m.description : e("modal.profile.noDescription")
470
- }
471
- )
472
- ] }),
473
- !t && l?.translates?.enabled && /* @__PURE__ */ f($, { children: [
474
- /* @__PURE__ */ o(W, { children: e("modal.profile.preferences") }),
475
- /* @__PURE__ */ o(Xe, { children: /* @__PURE__ */ f(We, { children: [
476
- /* @__PURE__ */ o(Je, { children: e("modal.profile.languageHint") }),
477
- /* @__PURE__ */ o(
478
- io,
479
- {
480
- options: Y,
481
- placeholder: e("language.select"),
482
- onSelect: P,
483
- accentColor: l?.colors?.primary,
484
- selectedValue: ie()
485
- }
486
- )
487
- ] }) })
488
- ] }),
489
- V && /* @__PURE__ */ f($, { children: [
490
- /* @__PURE__ */ o(W, { children: e("modal.profile.actions") }),
491
- /* @__PURE__ */ f(qe, { children: [
492
- /* @__PURE__ */ o(
493
- F,
494
- {
495
- StartIcon: /* @__PURE__ */ o($e, {}),
496
- onClick: K,
497
- variant: "filled",
498
- children: e("action.message")
499
- }
500
- ),
501
- x && /* @__PURE__ */ o(
502
- F,
503
- {
504
- StartIcon: /* @__PURE__ */ o(Oe, { color: "var(--ethora-color-text-on-primary, #FFFFFF)" }),
505
- onClick: () => {
506
- O("video");
507
- },
508
- disabled: n,
509
- variant: "filled",
510
- children: e(C ? "action.videoCall" : "action.call")
511
- }
512
- ),
513
- C && /* @__PURE__ */ o(
514
- F,
515
- {
516
- StartIcon: /* @__PURE__ */ o(Ee, { color: "var(--ethora-color-text-on-primary, #FFFFFF)" }),
517
- onClick: () => {
518
- O("audio");
519
- },
520
- disabled: n,
521
- variant: "filled",
522
- children: e("action.audioCall")
523
- }
524
- ),
525
- /* @__PURE__ */ o(
526
- F,
527
- {
528
- onClick: () => _e(t.id),
529
- variant: "outlined",
530
- children: e("action.copyUserId")
531
- }
532
- )
533
- ] })
534
- ] })
535
- ] }),
536
- [
537
- m,
538
- x,
539
- C,
540
- n,
541
- O,
542
- K,
543
- t,
544
- V,
545
- r,
546
- l,
547
- h,
548
- e
549
- ]
550
- ), pe = H(
551
- () => /* @__PURE__ */ o(
552
- te,
553
- {
554
- ref: g,
555
- setIsEditing: w,
556
- modalUser: m,
557
- config: l
558
- }
559
- ),
560
- [m]
561
- );
562
- return /* @__PURE__ */ o(
563
- Ke,
564
- {
565
- title: e("modal.profile.title"),
566
- onClose: A,
567
- headerActions: b ? ce : le,
568
- children: b ? pe : de
569
- }
570
- );
571
- };
572
- export {
573
- fo as default
574
- };
@@ -1,132 +0,0 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { useState as b, useEffect as x } from "react";
3
- import { v as o, a as L, n as P, u as z, aD as D, aE as I } from "./main-DmtEeYji.js";
4
- import { S as N, D as C, a as w, b as O, e as S, f as p } from "./SideDrawer-C_nWZRwH.js";
5
- o.div``;
6
- o.div`
7
- font-size: 16px;
8
- font-weight: bold;
9
- color: var(--ethora-color-text, #141414);
10
- `;
11
- o.p`
12
- font-size: 14px;
13
- color: var(--ethora-color-text-muted, #6b7280);
14
- margin-bottom: 32px;
15
- `;
16
- const $ = o.div`
17
- display: flex;
18
- flex-direction: column;
19
- gap: 6px;
20
- `, h = o.label`
21
- display: flex;
22
- align-items: center;
23
- font-size: 14px;
24
- gap: 8px;
25
- `, f = o.input`
26
- accent-color: ${({ $radioColor: t }) => t || "var(--ethora-color-primary, #0052CD)"};
27
- margin: 0px;
28
- `, R = o.div`
29
- padding: 10px 15px;
30
- margin-top: 16px;
31
- color: ${({ type: t }) => t === "success" ? "#10b981" : "#ef4444"};
32
- background: ${({ type: t }) => t === "success" ? "#d1fae5" : "#fee2e2"};
33
- border: 1px solid
34
- ${({ type: t }) => t === "success" ? "#10b981" : "#ef4444"};
35
- border-radius: 4px;
36
- `, M = ({
37
- handleCloseModal: t
38
- }) => {
39
- const k = L(), i = P(), { user: c, config: l } = z(
40
- (s) => s.chatSettingStore
41
- ), y = (s) => k(I(s)), [n, m] = b(c?.isProfileOpen), [a, g] = b(c?.isAssetsOpen), [u, v] = b(null), d = (s, A) => {
42
- v({ message: s, type: A }), setTimeout(() => v(null), 3e3);
43
- };
44
- return x(() => {
45
- n !== c.isProfileOpen && D({ isProfileOpen: n }).then(({ data: s }) => {
46
- y(s.user), d(i("notification.saved"), "success");
47
- }).catch(() => d(i("toast.error"), "error"));
48
- }, [n]), x(() => {
49
- a !== c?.isAssetsOpen && D({ isAssetsOpen: a }).then(({ data: s }) => {
50
- y(s.user), d(i("notification.saved"), "success");
51
- }).catch(() => d(i("toast.error"), "error"));
52
- }, [a]), /* @__PURE__ */ r(
53
- N,
54
- {
55
- title: i("settings.visibility.title"),
56
- onClose: t,
57
- backLabel: i("action.back"),
58
- children: [
59
- /* @__PURE__ */ r(C, { children: [
60
- /* @__PURE__ */ e(w, { children: i("settings.visibility.profileLabel") }),
61
- /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(S, { children: /* @__PURE__ */ r($, { children: [
62
- /* @__PURE__ */ r(h, { children: [
63
- /* @__PURE__ */ e(
64
- f,
65
- {
66
- $radioColor: l?.colors?.primary,
67
- type: "radio",
68
- name: "ethora-profile-visibility",
69
- checked: n === !0,
70
- onChange: () => m(!0)
71
- }
72
- ),
73
- i("settings.visibility.open")
74
- ] }),
75
- /* @__PURE__ */ e(p, { children: i("settings.visibility.openDescription") }),
76
- /* @__PURE__ */ r(h, { children: [
77
- /* @__PURE__ */ e(
78
- f,
79
- {
80
- $radioColor: l?.colors?.primary,
81
- type: "radio",
82
- name: "ethora-profile-visibility",
83
- checked: n === !1,
84
- onChange: () => m(!1)
85
- }
86
- ),
87
- i("settings.visibility.restricted")
88
- ] }),
89
- /* @__PURE__ */ e(p, { children: i("settings.visibility.restrictedDescription") })
90
- ] }) }) })
91
- ] }),
92
- /* @__PURE__ */ r(C, { children: [
93
- /* @__PURE__ */ e(w, { children: i("settings.visibility.documentsLabel") }),
94
- /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(S, { children: /* @__PURE__ */ r($, { children: [
95
- /* @__PURE__ */ r(h, { children: [
96
- /* @__PURE__ */ e(
97
- f,
98
- {
99
- $radioColor: l?.colors?.primary,
100
- type: "radio",
101
- name: "ethora-documents-visibility",
102
- checked: a === !0,
103
- onChange: () => g(!0)
104
- }
105
- ),
106
- i("settings.visibility.full")
107
- ] }),
108
- /* @__PURE__ */ e(p, { children: i("settings.visibility.fullDescription") }),
109
- /* @__PURE__ */ r(h, { children: [
110
- /* @__PURE__ */ e(
111
- f,
112
- {
113
- $radioColor: l?.colors?.primary,
114
- type: "radio",
115
- name: "ethora-documents-visibility",
116
- checked: a === !1,
117
- onChange: () => g(!1)
118
- }
119
- ),
120
- i("settings.visibility.individual")
121
- ] }),
122
- /* @__PURE__ */ e(p, { children: i("settings.visibility.individualDescription") })
123
- ] }) }) })
124
- ] }),
125
- u && /* @__PURE__ */ e(R, { type: u.type, children: u.message })
126
- ]
127
- }
128
- );
129
- };
130
- export {
131
- M as default
132
- };