@paramms/chat-widget 1.0.36 → 1.0.38

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/dist/react.js CHANGED
@@ -1,228 +1,282 @@
1
- import { jsxs as z, jsx as a, Fragment as F } from "react/jsx-runtime";
2
- import { useState as _, useRef as L, useEffect as k } from "react";
3
- import { mount as D } from "./index.js";
4
- function J({
5
- url: u,
6
- apiUrl: o,
7
- profileId: r,
8
- token: e,
1
+ import { jsxs as _, jsx as e, Fragment as A } from "react/jsx-runtime";
2
+ import { useState as D, useRef as S, useEffect as W } from "react";
3
+ import { mount as H } from "./index.js";
4
+ function O({ size: i = 26 }) {
5
+ return /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", width: i, height: i, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ e(
6
+ "path",
7
+ {
8
+ d: "M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",
9
+ fill: "currentColor",
10
+ stroke: "currentColor",
11
+ strokeWidth: "2",
12
+ strokeLinecap: "round",
13
+ strokeLinejoin: "round"
14
+ }
15
+ ) });
16
+ }
17
+ function G({ size: i = 22 }) {
18
+ return /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", width: i, height: i, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ e("path", { d: "M18 6 6 18M6 6l12 12", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }) });
19
+ }
20
+ function Q({
21
+ url: i,
22
+ apiUrl: r,
23
+ profileId: s,
24
+ token: o,
9
25
  refreshToken: l,
10
- userId: i,
11
- userName: c,
12
- userEmail: p,
13
- userAvatar: g,
26
+ userId: c,
27
+ userName: d,
28
+ userEmail: h,
29
+ userAvatar: v,
14
30
  contextTitle: m,
15
- contextSubtitle: b,
16
- contextStatus: w,
31
+ contextSubtitle: a,
32
+ contextStatus: u,
17
33
  subjectId: j,
18
- accent: M,
19
- launcher: v,
34
+ accent: C,
35
+ launcher: p,
20
36
  position: t,
21
- quickReplies: d,
22
- height: x = "100%",
23
- i18n: y,
24
- translateLang: f
37
+ quickReplies: f,
38
+ height: b = "100%",
39
+ i18n: R,
40
+ translateLang: x,
41
+ inbox: w,
42
+ inboxScope: g
25
43
  }) {
26
- const R = L(null), h = L(null);
27
- return k(() => {
28
- var n;
29
- if (R.current)
30
- return (n = h.current) == null || n.close(), h.current = D({
31
- el: R.current,
32
- url: u,
33
- ...o ? { apiUrl: o } : {},
34
- profileId: r,
44
+ const M = S(null), n = S(null), [y, $] = D(!1);
45
+ return W(() => {
46
+ var z;
47
+ if (!y && M.current)
48
+ return (z = n.current) == null || z.close(), n.current = H({
49
+ el: M.current,
50
+ url: i,
51
+ ...r ? { apiUrl: r } : {},
52
+ profileId: s,
35
53
  ...j ? { subjectId: j } : {},
36
- ...e ? { token: e } : {},
54
+ ...o ? { token: o } : {},
37
55
  ...l ? { refreshToken: l } : {},
38
- ...i ? { userId: i } : {},
39
- ...i || c || p || g ? {
56
+ ...c ? { userId: c } : {},
57
+ ...c || d || h || v ? {
40
58
  user: {
41
- ...c ? { name: c } : {},
42
- ...p ? { email: p } : {},
43
- ...g ? { avatar: g } : {}
59
+ ...d ? { name: d } : {},
60
+ ...h ? { email: h } : {},
61
+ ...v ? { avatar: v } : {}
44
62
  }
45
63
  } : {},
46
64
  ...m ? {
47
65
  subject: {
48
66
  title: m,
49
- ...b ? { subtitle: b } : {},
50
- ...w ? { status: w } : {}
67
+ ...a ? { subtitle: a } : {},
68
+ ...u ? { status: u } : {}
51
69
  }
52
70
  } : {},
53
- ...d ? { quickReplies: d } : {},
54
- ...M ? { accent: M } : {},
55
- ...f ? { translateLang: f } : {},
56
- ...y ? { i18n: y } : {},
57
- ...v ? { launcher: v, position: t ?? "bottom-right" } : {}
71
+ ...f ? { quickReplies: f } : {},
72
+ ...C ? { accent: C } : {},
73
+ ...x ? { translateLang: x } : {},
74
+ ...R ? { i18n: R } : {},
75
+ ...w && !p ? { onBack: () => $(!0) } : {},
76
+ ...p ? { launcher: p, position: t ?? "bottom-right" } : {}
58
77
  }), () => {
59
- var s;
60
- (s = h.current) == null || s.close(), h.current = null;
78
+ var B;
79
+ (B = n.current) == null || B.close(), n.current = null;
61
80
  };
62
- }, [u, o, r, j, e, i, c, p, M, v, t, f]), /* @__PURE__ */ a(
81
+ }, [i, r, s, j, o, c, d, h, C, p, t, x, w, y]), w && !p && y ? /* @__PURE__ */ e(
82
+ F,
83
+ {
84
+ url: i,
85
+ ...r ? { apiUrl: r } : {},
86
+ profileId: s,
87
+ ...o ? { token: o } : {},
88
+ ...l ? { refreshToken: l } : {},
89
+ ...c ? { userId: c } : {},
90
+ ...d ? { userName: d } : {},
91
+ ...h ? { userEmail: h } : {},
92
+ ...C ? { accent: C } : {},
93
+ scope: g ?? "tenant",
94
+ height: b,
95
+ onClose: () => $(!1)
96
+ }
97
+ ) : /* @__PURE__ */ e(
63
98
  "div",
64
99
  {
65
- ref: R,
66
- style: v ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: x, minHeight: x === "100%" ? "480px" : void 0 }
100
+ ref: M,
101
+ style: p ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: b, minHeight: b === "100%" ? "480px" : void 0 }
67
102
  }
68
103
  );
69
104
  }
70
- const O = [
105
+ const Y = [
71
106
  "Is this still available?",
72
107
  "Can I schedule a viewing?",
73
108
  "What is your best price?"
74
109
  ];
75
- function P({
76
- url: u,
77
- apiUrl: o,
78
- profileId: r,
79
- token: e,
110
+ function V({
111
+ url: i,
112
+ apiUrl: r,
113
+ profileId: s,
114
+ token: o,
80
115
  refreshToken: l,
81
- listingId: i,
82
- listingTitle: c,
83
- listingMeta: p,
84
- listingPrice: g,
116
+ listingId: c,
117
+ listingTitle: d,
118
+ listingMeta: h,
119
+ listingPrice: v,
85
120
  listingStatus: m,
86
- userId: b,
87
- userName: w,
121
+ userId: a,
122
+ userName: u,
88
123
  userEmail: j,
89
- userAvatar: M,
90
- accent: v,
124
+ userAvatar: C,
125
+ accent: p,
91
126
  launcher: t,
92
- position: d,
93
- quickReplies: x,
94
- height: y = "100%",
95
- i18n: f,
96
- translateLang: R
127
+ position: f,
128
+ quickReplies: b,
129
+ height: R = "100%",
130
+ i18n: x,
131
+ translateLang: w,
132
+ inbox: g,
133
+ inboxScope: M
97
134
  }) {
98
- const h = L(null), n = L(null);
99
- return k(() => {
100
- if (!h.current) return;
101
- let s = !1;
102
- const C = setTimeout(() => {
103
- var S;
104
- s || !h.current || ((S = n.current) == null || S.close(), n.current = D({
105
- el: h.current,
106
- url: u,
107
- ...o ? { apiUrl: o } : {},
108
- profileId: r,
109
- ...i ? { subjectId: `listing_${i}` } : {},
110
- ...e ? { token: e } : {},
135
+ const n = S(null), y = S(null), [$, z] = D(!1);
136
+ return W(() => {
137
+ if ($ || !n.current) return;
138
+ let B = !1;
139
+ const L = setTimeout(() => {
140
+ var k;
141
+ B || !n.current || ((k = y.current) == null || k.close(), y.current = H({
142
+ el: n.current,
143
+ url: i,
144
+ ...r ? { apiUrl: r } : {},
145
+ profileId: s,
146
+ ...c ? { subjectId: `listing_${c}` } : {},
147
+ ...o ? { token: o } : {},
111
148
  ...l ? { refreshToken: l } : {},
112
- ...b ? { userId: b } : {},
113
- ...b || w || j || M ? {
149
+ ...a ? { userId: a } : {},
150
+ ...a || u || j || C ? {
114
151
  user: {
115
- ...w ? { name: w } : {},
152
+ ...u ? { name: u } : {},
116
153
  ...j ? { email: j } : {},
117
- ...M ? { avatar: M } : {},
118
- ...i ? { meta: { listingId: i } } : {}
154
+ ...C ? { avatar: C } : {},
155
+ ...c ? { meta: { listingId: c } } : {}
119
156
  }
120
157
  } : {},
121
- ...c ? {
158
+ ...d ? {
122
159
  subject: {
123
- title: c,
124
- ...p ? { subtitle: p } : {},
125
- ...g ? { tags: [`$${g.toLocaleString()}`] } : {},
160
+ title: d,
161
+ ...h ? { subtitle: h } : {},
162
+ ...v ? { tags: [`$${v.toLocaleString()}`] } : {},
126
163
  ...m ? { status: m } : {}
127
164
  }
128
165
  } : {},
129
- quickReplies: x ?? O,
130
- ...v ? { accent: v } : {},
131
- ...R ? { translateLang: R } : {},
132
- ...f ? { i18n: f } : {},
133
- ...t ? { launcher: t, position: d ?? "bottom-right" } : {}
166
+ quickReplies: b ?? Y,
167
+ ...p ? { accent: p } : {},
168
+ ...w ? { translateLang: w } : {},
169
+ ...x ? { i18n: x } : {},
170
+ ...g && !t ? { onBack: () => z(!0) } : {},
171
+ ...t ? { launcher: t, position: f ?? "bottom-right" } : {}
134
172
  }));
135
173
  }, 0);
136
174
  return () => {
137
- var S;
138
- s = !0, clearTimeout(C), (S = n.current) == null || S.close(), n.current = null;
175
+ var k;
176
+ B = !0, clearTimeout(L), (k = y.current) == null || k.close(), y.current = null;
139
177
  };
140
- }, [u, o, r, i, e, b, v, t, d, R]), /* @__PURE__ */ a(
178
+ }, [i, r, s, c, o, a, p, t, f, w, g, $]), g && !t && $ ? /* @__PURE__ */ e(
179
+ F,
180
+ {
181
+ url: i,
182
+ ...r ? { apiUrl: r } : {},
183
+ profileId: s,
184
+ ...o ? { token: o } : {},
185
+ ...l ? { refreshToken: l } : {},
186
+ ...a ? { userId: a } : {},
187
+ ...u ? { userName: u } : {},
188
+ ...j ? { userEmail: j } : {},
189
+ ...p ? { accent: p } : {},
190
+ scope: M ?? "tenant",
191
+ height: R,
192
+ onClose: () => z(!1)
193
+ }
194
+ ) : /* @__PURE__ */ e(
141
195
  "div",
142
196
  {
143
- ref: h,
144
- style: t ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: y, minHeight: y === "100%" ? "480px" : void 0 }
197
+ ref: n,
198
+ style: t ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: R, minHeight: R === "100%" ? "480px" : void 0 }
145
199
  }
146
200
  );
147
201
  }
148
- function Y(u) {
149
- const [o, r] = _(
150
- typeof window < "u" && window.innerWidth <= u
202
+ function q(i) {
203
+ const [r, s] = D(
204
+ typeof window < "u" && window.innerWidth <= i
151
205
  );
152
- return k(() => {
206
+ return W(() => {
153
207
  if (typeof window > "u" || !window.matchMedia) return;
154
- const e = window.matchMedia(`(max-width: ${u}px)`), l = (i) => r(i.matches);
155
- return r(e.matches), e.addEventListener("change", l), () => e.removeEventListener("change", l);
156
- }, [u]), o;
208
+ const o = window.matchMedia(`(max-width: ${i}px)`), l = (c) => s(c.matches);
209
+ return s(o.matches), o.addEventListener("change", l), () => o.removeEventListener("change", l);
210
+ }, [i]), r;
157
211
  }
158
- function H({
159
- url: u,
160
- apiUrl: o,
161
- profileId: r,
162
- tenantId: e,
212
+ function F({
213
+ url: i,
214
+ apiUrl: r,
215
+ profileId: s,
216
+ tenantId: o,
163
217
  token: l,
164
- refreshToken: i,
165
- userId: c,
166
- userName: p,
167
- userEmail: g,
218
+ refreshToken: c,
219
+ userId: d,
220
+ userName: h,
221
+ userEmail: v,
168
222
  accent: m,
169
- height: b = "100%",
170
- i18n: w,
223
+ height: a = "100%",
224
+ i18n: u,
171
225
  onClose: j,
172
- scope: M = "tenant"
226
+ scope: C = "tenant"
173
227
  }) {
174
- const v = !r && !e, [t, d] = _(null), x = L(null), y = L(null), f = L(null), R = L(null);
175
- return k(() => {
176
- if (!x.current) return;
177
- let h = !1;
178
- return import("./chatlist.js").then(({ mountChatList: n }) => {
179
- h || !x.current || (f.current = n({
180
- el: x.current,
181
- url: u,
182
- ...o ? { apiUrl: o } : {},
183
- ...r ? { profileId: r } : {},
184
- ...e ? { tenantId: e } : {},
185
- scope: M,
186
- onSelect: (s) => d(s),
228
+ const p = !s && !o, [t, f] = D(null), b = S(null), R = S(null), x = S(null), w = S(null);
229
+ return W(() => {
230
+ if (!b.current) return;
231
+ let g = !1;
232
+ return import("./chatlist.js").then(({ mountChatList: M }) => {
233
+ g || !b.current || (x.current = M({
234
+ el: b.current,
235
+ url: i,
236
+ ...r ? { apiUrl: r } : {},
237
+ ...s ? { profileId: s } : {},
238
+ ...o ? { tenantId: o } : {},
239
+ scope: C,
240
+ onSelect: (n) => f(n),
187
241
  // Compose (✎) opens the chatroom's general support thread — without
188
242
  // this a user with no conversations yet had an empty list and no way
189
243
  // to ever start one, which is what made ChatApp feel broken.
190
244
  // Compose target: the configured chatroom, else the tenant's default
191
245
  // (oldest chatroom, reported by the server on the first list fetch).
192
246
  onNewChat: () => {
193
- var C;
194
- const s = (C = f.current) == null ? void 0 : C.defaultProfileId();
195
- s && d({ id: "__new__", profileId: s, state: "open", updatedAt: Date.now() });
247
+ var y;
248
+ const n = (y = x.current) == null ? void 0 : y.defaultProfileId();
249
+ n && f({ id: "__new__", profileId: n, state: "open", updatedAt: Date.now() });
196
250
  },
197
251
  ...l ? { token: l } : {},
198
- ...c ? { userId: c } : {},
252
+ ...d ? { userId: d } : {},
199
253
  ...m ? { accent: m } : {},
200
- ...w ? { i18n: w } : {}
254
+ ...u ? { i18n: u } : {}
201
255
  }));
202
256
  }), () => {
203
- var n;
204
- h = !0, (n = f.current) == null || n.close(), f.current = null;
257
+ var M;
258
+ g = !0, (M = x.current) == null || M.close(), x.current = null;
205
259
  };
206
- }, [u, o, r, e, l, c, M]), k(() => {
207
- var n;
208
- if (!y.current || !t) return;
209
- (n = R.current) == null || n.close(), R.current = D({
210
- el: y.current,
211
- url: u,
212
- ...o ? { apiUrl: o } : {},
213
- profileId: t.profileId ?? r,
260
+ }, [i, r, s, o, l, d, C]), W(() => {
261
+ var M;
262
+ if (!R.current || !t) return;
263
+ (M = w.current) == null || M.close(), w.current = H({
264
+ el: R.current,
265
+ url: i,
266
+ ...r ? { apiUrl: r } : {},
267
+ profileId: t.profileId ?? s,
214
268
  // rows always carry theirs; compose sets one explicitly
215
269
  // DM rows open as direct conversations (kind + peer). Opening them via
216
270
  // their dm:… subjectId only works for the participant that OWNS the
217
271
  // thread key — the other side would silently fork a duplicate.
218
272
  ...t.kind === "direct" && t.peerId ? { kind: "direct", peerId: t.peerId } : t.subjectId ? { subjectId: t.subjectId } : {},
219
273
  ...l ? { token: l } : {},
220
- ...i ? { refreshToken: i } : {},
221
- ...c ? { userId: c } : {},
222
- ...c || p || g ? {
274
+ ...c ? { refreshToken: c } : {},
275
+ ...d ? { userId: d } : {},
276
+ ...d || h || v ? {
223
277
  user: {
224
- ...p ? { name: p } : {},
225
- ...g ? { email: g } : {}
278
+ ...h ? { name: h } : {},
279
+ ...v ? { email: v } : {}
226
280
  }
227
281
  } : {},
228
282
  ...t.subjectTitle ? {
@@ -233,28 +287,28 @@ function H({
233
287
  } : {},
234
288
  ...m ? { accent: m } : {},
235
289
  // Stack navigation: the chatroom's back chevron returns to the list.
236
- onBack: () => d(null)
290
+ onBack: () => f(null)
237
291
  });
238
- const h = setInterval(() => {
239
- var s;
240
- return (s = f.current) == null ? void 0 : s.refresh();
292
+ const g = setInterval(() => {
293
+ var n;
294
+ return (n = x.current) == null ? void 0 : n.refresh();
241
295
  }, 2e4);
242
296
  return () => {
243
- var s, C;
244
- clearInterval(h), (s = R.current) == null || s.close(), R.current = null, (C = f.current) == null || C.refresh();
297
+ var n, y;
298
+ clearInterval(g), (n = w.current) == null || n.close(), w.current = null, (y = x.current) == null || y.refresh();
245
299
  };
246
- }, [t == null ? void 0 : t.id]), v ? /* @__PURE__ */ z("div", { style: { padding: 16, font: "13px system-ui", color: "#b91c1c", background: "#fef2f2", borderRadius: 8 }, children: [
300
+ }, [t == null ? void 0 : t.id]), p ? /* @__PURE__ */ _("div", { style: { padding: 16, font: "13px system-ui", color: "#b91c1c", background: "#fef2f2", borderRadius: 8 }, children: [
247
301
  "[relay] <ChatApp/> needs a ",
248
- /* @__PURE__ */ a("code", { children: "profileId" }),
302
+ /* @__PURE__ */ e("code", { children: "profileId" }),
249
303
  " or a ",
250
- /* @__PURE__ */ a("code", { children: "tenantId" }),
304
+ /* @__PURE__ */ e("code", { children: "tenantId" }),
251
305
  "."
252
- ] }) : /* @__PURE__ */ z("div", { style: { position: "relative", width: "100%", height: b, minHeight: "400px", overflow: "hidden", background: "#fff" }, children: [
253
- j && !t && /* @__PURE__ */ a(
306
+ ] }) : /* @__PURE__ */ _("div", { style: { position: "relative", width: "100%", height: a, minHeight: "400px", overflow: "hidden", background: "#fff" }, children: [
307
+ j && !t && /* @__PURE__ */ e(
254
308
  "button",
255
309
  {
256
310
  onClick: j,
257
- "aria-label": (w == null ? void 0 : w.close) ?? "Close",
311
+ "aria-label": (u == null ? void 0 : u.close) ?? "Close",
258
312
  style: {
259
313
  position: "absolute",
260
314
  top: 8,
@@ -273,55 +327,55 @@ function H({
273
327
  lineHeight: 1,
274
328
  cursor: "pointer"
275
329
  },
276
- children: "✕"
330
+ children: /* @__PURE__ */ e(G, { size: 18 })
277
331
  }
278
332
  ),
279
- /* @__PURE__ */ a("div", { style: {
333
+ /* @__PURE__ */ e("div", { style: {
280
334
  position: "absolute",
281
335
  inset: 0,
282
336
  display: t ? "none" : "flex",
283
337
  flexDirection: "column"
284
- }, children: /* @__PURE__ */ a("div", { ref: x, style: { width: "100%", height: "100%" } }) }),
285
- t && /* @__PURE__ */ a("div", { style: { position: "absolute", inset: 0, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ a("div", { ref: y, style: { width: "100%", height: "100%" } }) })
338
+ }, children: /* @__PURE__ */ e("div", { ref: b, style: { width: "100%", height: "100%" } }) }),
339
+ t && /* @__PURE__ */ e("div", { style: { position: "absolute", inset: 0, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ e("div", { ref: R, style: { width: "100%", height: "100%" } }) })
286
340
  ] });
287
341
  }
288
- function Q({
289
- url: u,
290
- apiUrl: o,
291
- profileId: r,
292
- tenantId: e,
342
+ function X({
343
+ url: i,
344
+ apiUrl: r,
345
+ profileId: s,
346
+ tenantId: o,
293
347
  token: l,
294
- refreshToken: i,
295
- userId: c,
296
- userName: p,
297
- userEmail: g,
348
+ refreshToken: c,
349
+ userId: d,
350
+ userName: h,
351
+ userEmail: v,
298
352
  scope: m,
299
- accent: b = "#4F63F5",
300
- floating: w = !0,
353
+ accent: a = "#4F63F5",
354
+ floating: u = !0,
301
355
  position: j = "bottom-right",
302
- label: M,
303
- panelWidth: v,
356
+ label: C,
357
+ panelWidth: p,
304
358
  panelHeight: t = "600px"
305
359
  }) {
306
- const [d, x] = _(!1), y = L(null), f = j === "bottom-right", h = M ?? (w ? "💬" : "Messages"), n = Y(479);
307
- if (k(() => {
308
- const $ = (E) => {
309
- E.key === "Escape" && x(!1);
360
+ const [f, b] = D(!1), R = S(null), x = j === "bottom-right", w = C ?? (u ? void 0 : "Messages"), g = q(479);
361
+ if (W(() => {
362
+ const L = (k) => {
363
+ k.key === "Escape" && b(!1);
310
364
  };
311
- return document.addEventListener("keydown", $), () => document.removeEventListener("keydown", $);
312
- }, []), w)
313
- return /* @__PURE__ */ z("div", { style: {
365
+ return document.addEventListener("keydown", L), () => document.removeEventListener("keydown", L);
366
+ }, []), u)
367
+ return /* @__PURE__ */ _("div", { style: {
314
368
  position: "fixed",
315
- [f ? "right" : "left"]: "20px",
369
+ [x ? "right" : "left"]: "20px",
316
370
  bottom: "20px",
317
371
  zIndex: 9999,
318
372
  display: "flex",
319
373
  flexDirection: "column",
320
- alignItems: f ? "flex-end" : "flex-start",
374
+ alignItems: x ? "flex-end" : "flex-start",
321
375
  gap: "12px"
322
376
  }, children: [
323
- /* @__PURE__ */ a("div", { style: {
324
- ...n ? {
377
+ /* @__PURE__ */ e("div", { style: {
378
+ ...g ? {
325
379
  position: "fixed",
326
380
  inset: 0,
327
381
  width: "100%",
@@ -329,147 +383,152 @@ function Q({
329
383
  borderRadius: "0",
330
384
  zIndex: 9998
331
385
  } : {
332
- width: `min(${v ?? "420px"}, calc(100vw - 40px))`,
386
+ width: `min(${p ?? "420px"}, calc(100vw - 40px))`,
333
387
  height: `min(${t}, calc(100dvh - 108px))`,
334
388
  borderRadius: "16px"
335
389
  },
336
390
  overflow: "hidden",
337
- boxShadow: n ? "none" : "0 8px 40px rgba(0,0,0,.18)",
391
+ boxShadow: g ? "none" : "0 8px 40px rgba(0,0,0,.18)",
338
392
  background: "#fff",
339
- display: d ? "flex" : "none",
393
+ display: f ? "flex" : "none",
340
394
  flexDirection: "column",
341
- transformOrigin: `bottom ${f ? "right" : "left"}`,
342
- animation: d ? "ocl-pop-in .18s ease" : "none"
343
- }, children: /* @__PURE__ */ a(
344
- H,
395
+ transformOrigin: `bottom ${x ? "right" : "left"}`,
396
+ animation: f ? "ocl-pop-in .18s ease" : "none"
397
+ }, children: /* @__PURE__ */ e(
398
+ F,
345
399
  {
346
- url: u,
347
- ...o ? { apiUrl: o } : {},
348
- ...r ? { profileId: r } : {},
349
- ...e ? { tenantId: e } : {},
400
+ url: i,
401
+ ...r ? { apiUrl: r } : {},
402
+ ...s ? { profileId: s } : {},
403
+ ...o ? { tenantId: o } : {},
350
404
  ...l ? { token: l } : {},
351
- ...i ? { refreshToken: i } : {},
352
- ...c ? { userId: c } : {},
353
- ...p ? { userName: p } : {},
354
- ...g ? { userEmail: g } : {},
405
+ ...c ? { refreshToken: c } : {},
406
+ ...d ? { userId: d } : {},
407
+ ...h ? { userName: h } : {},
408
+ ...v ? { userEmail: v } : {},
355
409
  ...m ? { scope: m } : {},
356
- accent: b,
410
+ accent: a,
357
411
  height: "100%",
358
- onClose: () => x(!1)
412
+ onClose: () => b(!1)
359
413
  }
360
414
  ) }),
361
- /* @__PURE__ */ a(
415
+ /* @__PURE__ */ e(
362
416
  "button",
363
417
  {
364
- ref: y,
365
- onClick: () => x(($) => !$),
418
+ ref: R,
419
+ onClick: () => b((L) => !L),
420
+ "aria-label": f ? "Close chat" : typeof w == "string" ? w : "Open chat",
421
+ "aria-expanded": f,
366
422
  style: {
367
423
  width: "56px",
368
424
  height: "56px",
369
425
  borderRadius: "50%",
370
- background: b,
426
+ background: a,
371
427
  color: "#fff",
372
428
  border: "none",
373
- fontSize: "24px",
429
+ fontSize: "20px",
374
430
  cursor: "pointer",
375
431
  flexShrink: 0,
376
432
  boxShadow: "0 4px 16px rgba(0,0,0,.25)",
377
433
  transition: "transform .15s",
378
- display: d && n ? "none" : "block"
434
+ alignItems: "center",
435
+ justifyContent: "center",
436
+ display: f && g ? "none" : "flex"
379
437
  },
380
- onMouseEnter: ($) => {
381
- $.target.style.transform = "scale(1.08)";
438
+ onMouseEnter: (L) => {
439
+ L.currentTarget.style.transform = "scale(1.08)";
382
440
  },
383
- onMouseLeave: ($) => {
384
- $.target.style.transform = "scale(1)";
441
+ onMouseLeave: (L) => {
442
+ L.currentTarget.style.transform = "scale(1)";
385
443
  },
386
- children: d ? "✕" : h
444
+ children: f ? /* @__PURE__ */ e(G, {}) : C ?? /* @__PURE__ */ e(O, {})
387
445
  }
388
446
  ),
389
- /* @__PURE__ */ a("style", { children: "@keyframes ocl-pop-in { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }" })
447
+ /* @__PURE__ */ e("style", { children: "@keyframes ocl-pop-in { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }" })
390
448
  ] });
391
- const s = `min(${v ?? "420px"}, calc(100vw - 16px))`, [C, S] = _(null), A = () => {
392
- !d && y.current && S(y.current.getBoundingClientRect()), x(($) => !$);
393
- }, B = C ? C.bottom + 8 : 0, W = C ? Math.max(8, window.innerWidth - C.right) : 0;
394
- return /* @__PURE__ */ z(F, { children: [
395
- /* @__PURE__ */ z(
449
+ const M = `min(${p ?? "420px"}, calc(100vw - 16px))`, [n, y] = D(null), $ = () => {
450
+ !f && R.current && y(R.current.getBoundingClientRect()), b((L) => !L);
451
+ }, z = n ? n.bottom + 8 : 0, B = n ? Math.max(8, window.innerWidth - n.right) : 0;
452
+ return /* @__PURE__ */ _(A, { children: [
453
+ /* @__PURE__ */ _(
396
454
  "button",
397
455
  {
398
- ref: y,
399
- onClick: A,
456
+ ref: R,
457
+ onClick: $,
400
458
  style: {
401
459
  display: "inline-flex",
402
460
  alignItems: "center",
403
461
  gap: "6px",
404
462
  padding: "8px 16px",
405
463
  borderRadius: "8px",
406
- background: d ? b : "transparent",
407
- color: d ? "#fff" : b,
408
- border: `2px solid ${b}`,
464
+ background: f ? a : "transparent",
465
+ color: f ? "#fff" : a,
466
+ border: `2px solid ${a}`,
409
467
  fontSize: "14px",
410
468
  fontWeight: 600,
411
469
  cursor: "pointer",
412
470
  transition: "background .15s, color .15s"
413
471
  },
414
472
  children: [
415
- "💬 ",
416
- h
473
+ /* @__PURE__ */ e(O, { size: 16 }),
474
+ " ",
475
+ w
417
476
  ]
418
477
  }
419
478
  ),
420
- d && C && /* @__PURE__ */ z(F, { children: [
421
- /* @__PURE__ */ a(
479
+ f && n && /* @__PURE__ */ _(A, { children: [
480
+ /* @__PURE__ */ e(
422
481
  "div",
423
482
  {
424
- onClick: () => x(!1),
483
+ onClick: () => b(!1),
425
484
  style: { position: "fixed", inset: 0, zIndex: 9998 }
426
485
  }
427
486
  ),
428
- /* @__PURE__ */ a("div", { style: {
487
+ /* @__PURE__ */ e("div", { style: {
429
488
  position: "fixed",
430
- ...n ? {
489
+ ...g ? {
431
490
  inset: 0,
432
491
  width: "100%",
433
492
  height: "100dvh",
434
493
  borderRadius: "0"
435
494
  } : {
436
- top: B,
437
- right: W,
438
- width: s,
439
- height: `min(${t}, calc(100dvh - ${B}px - 12px))`,
495
+ top: z,
496
+ right: B,
497
+ width: M,
498
+ height: `min(${t}, calc(100dvh - ${z}px - 12px))`,
440
499
  borderRadius: "16px"
441
500
  },
442
501
  overflow: "hidden",
443
- boxShadow: n ? "none" : "0 8px 40px rgba(0,0,0,.2)",
502
+ boxShadow: g ? "none" : "0 8px 40px rgba(0,0,0,.2)",
444
503
  background: "#fff",
445
504
  zIndex: 9999,
446
505
  animation: "ocl-slide-in .18s ease"
447
- }, children: /* @__PURE__ */ a(
448
- H,
506
+ }, children: /* @__PURE__ */ e(
507
+ F,
449
508
  {
450
- url: u,
451
- ...o ? { apiUrl: o } : {},
452
- ...r ? { profileId: r } : {},
453
- ...e ? { tenantId: e } : {},
509
+ url: i,
510
+ ...r ? { apiUrl: r } : {},
511
+ ...s ? { profileId: s } : {},
512
+ ...o ? { tenantId: o } : {},
454
513
  ...l ? { token: l } : {},
455
- ...i ? { refreshToken: i } : {},
456
- ...c ? { userId: c } : {},
457
- ...p ? { userName: p } : {},
458
- ...g ? { userEmail: g } : {},
514
+ ...c ? { refreshToken: c } : {},
515
+ ...d ? { userId: d } : {},
516
+ ...h ? { userName: h } : {},
517
+ ...v ? { userEmail: v } : {},
459
518
  ...m ? { scope: m } : {},
460
- accent: b,
519
+ accent: a,
461
520
  height: "100%",
462
- onClose: () => x(!1)
521
+ onClose: () => b(!1)
463
522
  }
464
523
  ) }),
465
- /* @__PURE__ */ a("style", { children: "@keyframes ocl-slide-in { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }" })
524
+ /* @__PURE__ */ e("style", { children: "@keyframes ocl-slide-in { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }" })
466
525
  ] })
467
526
  ] });
468
527
  }
469
528
  export {
470
- H as ChatApp,
471
- Q as ChatAppLauncher,
472
- J as ChatWidget,
473
- P as MarketplaceChat
529
+ F as ChatApp,
530
+ X as ChatAppLauncher,
531
+ Q as ChatWidget,
532
+ V as MarketplaceChat
474
533
  };
475
534
  //# sourceMappingURL=react.js.map