@paramms/chat-widget 1.0.44 → 1.0.46

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