@paramms/chat-widget 1.0.45 → 1.0.47

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