@paramms/chat-widget 1.0.38 → 1.0.39

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