@paramms/chat-widget 1.0.41 → 1.0.43

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