@paramms/chat-widget 1.0.41 → 1.0.42

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
22
  apiUrl: i,
23
- profileId: d,
23
+ profileId: s,
24
24
  token: n,
25
25
  refreshToken: r,
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,
31
+ contextSubtitle: p,
32
+ contextStatus: h,
33
33
  subjectId: L,
34
34
  accent: C,
35
- launcher: x,
35
+ launcher: b,
36
36
  position: t,
37
37
  launcherMessage: f,
38
- quickReplies: a,
39
- height: M = "100%",
40
- i18n: w,
41
- translateLang: R,
42
- inbox: p,
43
- inboxScope: j
38
+ quickReplies: R,
39
+ height: S = "100%",
40
+ i18n: j,
41
+ translateLang: M,
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
52
  ...i ? { apiUrl: i } : {},
53
- profileId: d,
53
+ profileId: s,
54
54
  ...L ? { subjectId: L } : {},
55
55
  ...n ? { token: n } : {},
56
56
  ...r ? { refreshToken: r } : {},
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 } : {},
72
+ ...R ? { quickReplies: R } : {},
73
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 } : {} } : {}
74
+ ...M ? { translateLang: M } : {},
75
+ ...j ? { i18n: j } : {},
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, i, s, L, n, l, d, u, C, b, t, f, M, a, x]), a && !b && x ? /* @__PURE__ */ e(
83
+ A,
84
84
  {
85
85
  url: o,
86
86
  ...i ? { apiUrl: i } : {},
87
- profileId: d,
87
+ profileId: s,
88
88
  ...n ? { token: n } : {},
89
89
  ...r ? { refreshToken: r } : {},
90
90
  ...l ? { userId: l } : {},
91
- ...s ? { userName: s } : {},
92
- ...h ? { userEmail: h } : {},
91
+ ...d ? { userName: d } : {},
92
+ ...u ? { userEmail: u } : {},
93
93
  ...C ? { accent: C } : {},
94
- scope: j ?? "tenant",
95
- height: M,
96
- onClose: () => $(!1)
94
+ scope: $ ?? "tenant",
95
+ height: S,
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: S, minHeight: S === "100%" ? "480px" : void 0 }
103
103
  }
104
104
  );
105
105
  }
@@ -108,165 +108,167 @@ 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
113
  apiUrl: i,
114
- profileId: d,
114
+ profileId: s,
115
115
  token: n,
116
116
  refreshToken: r,
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,
122
+ userId: p,
123
+ userName: h,
124
124
  userEmail: L,
125
125
  userAvatar: C,
126
- accent: x,
126
+ accent: b,
127
127
  launcher: t,
128
128
  position: f,
129
- launcherMessage: a,
130
- quickReplies: M,
131
- height: w = "100%",
132
- i18n: R,
133
- translateLang: p,
134
- inbox: j,
135
- inboxScope: c
129
+ launcherMessage: R,
130
+ quickReplies: S,
131
+ height: j = "100%",
132
+ i18n: M,
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
146
  ...i ? { apiUrl: i } : {},
147
- profileId: d,
147
+ profileId: s,
148
148
  ...l ? { subjectId: `listing_${l}` } : {},
149
149
  ...n ? { token: n } : {},
150
150
  ...r ? { refreshToken: r } : {},
151
- ...u ? { userId: u } : {},
152
- ...u || b || L || C ? {
151
+ ...p ? { userId: p } : {},
152
+ ...p || h || L || C ? {
153
153
  user: {
154
- ...b ? { name: b } : {},
154
+ ...h ? { name: h } : {},
155
155
  ...L ? { email: L } : {},
156
156
  ...C ? { avatar: C } : {},
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
- 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 } : {} } : {}
168
+ quickReplies: S ?? q,
169
+ ...b ? { accent: b } : {},
170
+ ...a ? { translateLang: a } : {},
171
+ ...M ? { i18n: M } : {},
172
+ ...$ && !t ? { onBack: () => z(!0) } : {},
173
+ ...t ? { launcher: t, position: f ?? "bottom-right", ...R ? { launcherMessage: R } : {} } : {}
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, i, s, l, n, p, b, t, f, R, a, $, g]), $ && !t && g ? /* @__PURE__ */ e(
181
+ A,
182
182
  {
183
183
  url: o,
184
184
  ...i ? { apiUrl: i } : {},
185
- profileId: d,
185
+ profileId: s,
186
186
  ...n ? { token: n } : {},
187
187
  ...r ? { refreshToken: r } : {},
188
- ...u ? { userId: u } : {},
189
- ...b ? { userName: b } : {},
188
+ ...p ? { userId: p } : {},
189
+ ...h ? { userName: h } : {},
190
190
  ...L ? { userEmail: L } : {},
191
- ...x ? { accent: x } : {},
192
- scope: c ?? "tenant",
193
- height: w,
194
- onClose: () => B(!1)
191
+ ...b ? { accent: b } : {},
192
+ scope: w ?? "tenant",
193
+ height: j,
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: j, minHeight: j === "100%" ? "480px" : void 0 }
201
201
  }
202
202
  );
203
203
  }
204
204
  function K(o) {
205
- const [i, d] = _(
205
+ const [i, 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);
210
+ const n = window.matchMedia(`(max-width: ${o}px)`), r = (l) => s(l.matches);
211
+ return s(n.matches), n.addEventListener("change", r), () => n.removeEventListener("change", r);
212
212
  }, [o]), i;
213
213
  }
214
- function F({
214
+ function A({
215
215
  url: o,
216
216
  apiUrl: i,
217
- profileId: d,
217
+ profileId: s,
218
218
  tenantId: n,
219
219
  token: r,
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,
225
+ height: p = "100%",
226
+ i18n: h,
227
227
  onClose: L,
228
228
  scope: C = "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), [R, S] = k(!1), j = B(null), M = 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 (!j.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 || S(!0), null)).then((c) => {
235
+ if (!c) return;
236
+ const { mountChatList: x } = c;
237
+ w || !j.current || (a.current = x({
238
+ el: j.current,
237
239
  url: o,
238
240
  ...i ? { apiUrl: i } : {},
239
- ...d ? { profileId: d } : {},
241
+ ...s ? { profileId: s } : {},
240
242
  ...n ? { tenantId: n } : {},
241
243
  scope: C,
242
- onSelect: (c) => f(c),
244
+ onSelect: (g) => f(g),
243
245
  // Compose (✎) opens the chatroom's general support thread — without
244
246
  // this a user with no conversations yet had an empty list and no way
245
247
  // to ever start one, which is what made ChatApp feel broken.
246
248
  // Compose target: the configured chatroom, else the tenant's default
247
249
  // (oldest chatroom, reported by the server on the first list fetch).
248
250
  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() });
251
+ var z;
252
+ const g = (z = a.current) == null ? void 0 : z.defaultProfileId();
253
+ g && f({ id: "__new__", profileId: g, state: "open", updatedAt: Date.now() });
252
254
  },
253
255
  ...r ? { token: r } : {},
254
- ...s ? { userId: s } : {},
256
+ ...d ? { userId: d } : {},
255
257
  ...m ? { accent: m } : {},
256
- ...b ? { i18n: b } : {}
258
+ ...h ? { i18n: h } : {}
257
259
  }));
258
260
  }), () => {
259
- var j;
260
- p = !0, (j = w.current) == null || j.close(), w.current = null;
261
+ var c;
262
+ w = !0, (c = a.current) == null || c.close(), a.current = null;
261
263
  };
262
- }, [o, i, d, n, r, s, C]), D(() => {
263
- var j;
264
+ }, [o, i, s, n, r, d, C]), D(() => {
265
+ var c;
264
266
  if (!M.current || !t) return;
265
- (j = R.current) == null || j.close(), R.current = A({
267
+ (c = $.current) == null || c.close(), $.current = H({
266
268
  el: M.current,
267
269
  url: o,
268
270
  ...i ? { apiUrl: i } : {},
269
- profileId: t.profileId ?? d,
271
+ profileId: t.profileId ?? s,
270
272
  // rows always carry theirs; compose sets one explicitly
271
273
  // DM rows open as direct conversations (kind + peer). Opening them via
272
274
  // their dm:… subjectId only works for the participant that OWNS the
@@ -274,10 +276,10 @@ function F({
274
276
  ...t.kind === "direct" && t.peerId ? { kind: "direct", peerId: t.peerId } : t.subjectId ? { subjectId: t.subjectId } : {},
275
277
  ...r ? { token: r } : {},
276
278
  ...l ? { refreshToken: l } : {},
277
- ...s ? { userId: s } : {},
278
- ...s || h || v ? {
279
+ ...d ? { userId: d } : {},
280
+ ...d || u || v ? {
279
281
  user: {
280
- ...h ? { name: h } : {},
282
+ ...u ? { name: u } : {},
281
283
  ...v ? { email: v } : {}
282
284
  }
283
285
  } : {},
@@ -291,26 +293,26 @@ function F({
291
293
  // Stack navigation: the chatroom's back chevron returns to the list.
292
294
  onBack: () => f(null)
293
295
  });
294
- const p = setInterval(() => {
295
- var c;
296
- return (c = w.current) == null ? void 0 : c.refresh();
296
+ const w = setInterval(() => {
297
+ var x;
298
+ return (x = a.current) == null ? void 0 : x.refresh();
297
299
  }, 2e4);
298
300
  return () => {
299
- var c, g;
300
- clearInterval(p), (c = R.current) == null || c.close(), R.current = null, (g = w.current) == null || g.refresh();
301
+ var x, g;
302
+ clearInterval(w), (x = $.current) == null || x.close(), $.current = null, (g = a.current) == null || g.refresh();
301
303
  };
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: [
304
+ }, [t == null ? void 0 : t.id]), b ? /* @__PURE__ */ _("div", { style: { padding: 16, font: "13px system-ui", color: "#b91c1c", background: "#fef2f2", borderRadius: 8 }, children: [
303
305
  "[relay] <ChatApp/> needs a ",
304
306
  /* @__PURE__ */ e("code", { children: "profileId" }),
305
307
  " or a ",
306
308
  /* @__PURE__ */ e("code", { children: "tenantId" }),
307
309
  "."
308
- ] }) : /* @__PURE__ */ k("div", { style: { position: "relative", width: "100%", height: u, minHeight: "400px", overflow: "hidden", background: "#fff" }, children: [
310
+ ] }) : /* @__PURE__ */ _("div", { style: { position: "relative", width: "100%", height: p, minHeight: "400px", overflow: "hidden", background: "#fff" }, children: [
309
311
  L && !t && /* @__PURE__ */ e(
310
312
  "button",
311
313
  {
312
314
  onClick: L,
313
- "aria-label": (b == null ? void 0 : b.close) ?? "Close",
315
+ "aria-label": (h == null ? void 0 : h.close) ?? "Close",
314
316
  style: {
315
317
  position: "absolute",
316
318
  top: 8,
@@ -337,47 +339,47 @@ function F({
337
339
  inset: 0,
338
340
  display: t ? "none" : "flex",
339
341
  flexDirection: "column"
340
- }, children: /* @__PURE__ */ e("div", { ref: a, style: { width: "100%", height: "100%" } }) }),
342
+ }, children: R ? /* @__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: j, style: { width: "100%", height: "100%" } }) }),
341
343
  t && /* @__PURE__ */ e("div", { style: { position: "absolute", inset: 0, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ e("div", { ref: M, style: { width: "100%", height: "100%" } }) })
342
344
  ] });
343
345
  }
344
- function Z({
346
+ function X({
345
347
  url: o,
346
348
  apiUrl: i,
347
- profileId: d,
349
+ profileId: s,
348
350
  tenantId: n,
349
351
  token: r,
350
352
  refreshToken: l,
351
- userId: s,
352
- userName: h,
353
+ userId: d,
354
+ userName: u,
353
355
  userEmail: v,
354
356
  scope: m,
355
- accent: u = "#4F63F5",
356
- floating: b = !0,
357
+ accent: p = "#4F63F5",
358
+ floating: h = !0,
357
359
  position: L = "bottom-right",
358
360
  label: C,
359
- panelWidth: x,
361
+ panelWidth: b,
360
362
  panelHeight: t = "600px"
361
363
  }) {
362
- const [f, a] = _(!1), M = z(null), w = L === "bottom-right", R = C ?? (b ? void 0 : "Messages"), p = K(479);
364
+ const [f, R] = k(!1), S = B(null), j = L === "bottom-right", M = C ?? (h ? void 0 : "Messages"), a = K(479);
363
365
  if (D(() => {
364
- const y = (H) => {
365
- H.key === "Escape" && a(!1);
366
+ const y = (F) => {
367
+ F.key === "Escape" && R(!1);
366
368
  };
367
369
  return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
368
- }, []), b)
369
- return /* @__PURE__ */ k("div", { style: {
370
+ }, []), h)
371
+ return /* @__PURE__ */ _("div", { style: {
370
372
  position: "fixed",
371
- [w ? "right" : "left"]: "20px",
373
+ [j ? "right" : "left"]: "20px",
372
374
  bottom: "20px",
373
375
  zIndex: 9999,
374
376
  display: "flex",
375
377
  flexDirection: "column",
376
- alignItems: w ? "flex-end" : "flex-start",
378
+ alignItems: j ? "flex-end" : "flex-start",
377
379
  gap: "12px"
378
380
  }, children: [
379
381
  /* @__PURE__ */ e("div", { style: {
380
- ...p ? {
382
+ ...a ? {
381
383
  position: "fixed",
382
384
  inset: 0,
383
385
  width: "100%",
@@ -385,47 +387,47 @@ function Z({
385
387
  borderRadius: "0",
386
388
  zIndex: 9998
387
389
  } : {
388
- width: `min(${x ?? "420px"}, calc(100vw - 40px))`,
390
+ width: `min(${b ?? "420px"}, calc(100vw - 40px))`,
389
391
  height: `min(${t}, calc(100dvh - 108px))`,
390
392
  borderRadius: "16px"
391
393
  },
392
394
  overflow: "hidden",
393
- boxShadow: p ? "none" : "0 8px 40px rgba(0,0,0,.18)",
395
+ boxShadow: a ? "none" : "0 8px 40px rgba(0,0,0,.18)",
394
396
  background: "#fff",
395
397
  display: f ? "flex" : "none",
396
398
  flexDirection: "column",
397
- transformOrigin: `bottom ${w ? "right" : "left"}`,
399
+ transformOrigin: `bottom ${j ? "right" : "left"}`,
398
400
  animation: f ? "ocl-pop-in .18s ease" : "none"
399
401
  }, children: /* @__PURE__ */ e(
400
- F,
402
+ A,
401
403
  {
402
404
  url: o,
403
405
  ...i ? { apiUrl: i } : {},
404
- ...d ? { profileId: d } : {},
406
+ ...s ? { profileId: s } : {},
405
407
  ...n ? { tenantId: n } : {},
406
408
  ...r ? { token: r } : {},
407
409
  ...l ? { refreshToken: l } : {},
408
- ...s ? { userId: s } : {},
409
- ...h ? { userName: h } : {},
410
+ ...d ? { userId: d } : {},
411
+ ...u ? { userName: u } : {},
410
412
  ...v ? { userEmail: v } : {},
411
413
  ...m ? { scope: m } : {},
412
- accent: u,
414
+ accent: p,
413
415
  height: "100%",
414
- onClose: () => a(!1)
416
+ onClose: () => R(!1)
415
417
  }
416
418
  ) }),
417
419
  /* @__PURE__ */ e(
418
420
  "button",
419
421
  {
420
- ref: M,
421
- onClick: () => a((y) => !y),
422
- "aria-label": f ? "Close chat" : typeof R == "string" ? R : "Open chat",
422
+ ref: S,
423
+ onClick: () => R((y) => !y),
424
+ "aria-label": f ? "Close chat" : typeof M == "string" ? M : "Open chat",
423
425
  "aria-expanded": f,
424
426
  style: {
425
427
  width: "56px",
426
428
  height: "56px",
427
429
  borderRadius: "50%",
428
- background: u,
430
+ background: p,
429
431
  color: "#fff",
430
432
  border: "none",
431
433
  fontSize: "20px",
@@ -435,7 +437,7 @@ function Z({
435
437
  transition: "transform .15s",
436
438
  alignItems: "center",
437
439
  justifyContent: "center",
438
- display: f && p ? "none" : "flex"
440
+ display: f && a ? "none" : "flex"
439
441
  },
440
442
  onMouseEnter: (y) => {
441
443
  y.currentTarget.style.transform = "scale(1.08)";
@@ -448,24 +450,24 @@ function Z({
448
450
  ),
449
451
  /* @__PURE__ */ e("style", { children: "@keyframes ocl-pop-in { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }" })
450
452
  ] });
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(
453
+ const $ = `min(${b ?? "420px"}, calc(100vw - 16px))`, [w, c] = k(null), x = () => {
454
+ !f && S.current && c(S.current.getBoundingClientRect()), R((y) => !y);
455
+ }, g = w ? w.bottom + 8 : 0, z = w ? Math.max(8, window.innerWidth - w.right) : 0;
456
+ return /* @__PURE__ */ _(O, { children: [
457
+ /* @__PURE__ */ _(
456
458
  "button",
457
459
  {
458
- ref: M,
459
- onClick: S,
460
+ ref: S,
461
+ onClick: x,
460
462
  style: {
461
463
  display: "inline-flex",
462
464
  alignItems: "center",
463
465
  gap: "6px",
464
466
  padding: "8px 16px",
465
467
  borderRadius: "8px",
466
- background: f ? u : "transparent",
467
- color: f ? "#fff" : u,
468
- border: `2px solid ${u}`,
468
+ background: f ? p : "transparent",
469
+ color: f ? "#fff" : p,
470
+ border: `2px solid ${p}`,
469
471
  fontSize: "14px",
470
472
  fontWeight: 600,
471
473
  cursor: "pointer",
@@ -474,53 +476,53 @@ function Z({
474
476
  children: [
475
477
  /* @__PURE__ */ e(G, { size: 16 }),
476
478
  " ",
477
- R
479
+ M
478
480
  ]
479
481
  }
480
482
  ),
481
- f && c && /* @__PURE__ */ k(O, { children: [
483
+ f && w && /* @__PURE__ */ _(O, { children: [
482
484
  /* @__PURE__ */ e(
483
485
  "div",
484
486
  {
485
- onClick: () => a(!1),
487
+ onClick: () => R(!1),
486
488
  style: { position: "fixed", inset: 0, zIndex: 9998 }
487
489
  }
488
490
  ),
489
491
  /* @__PURE__ */ e("div", { style: {
490
492
  position: "fixed",
491
- ...p ? {
493
+ ...a ? {
492
494
  inset: 0,
493
495
  width: "100%",
494
496
  height: "100dvh",
495
497
  borderRadius: "0"
496
498
  } : {
497
- top: $,
498
- right: B,
499
- width: j,
500
- height: `min(${t}, calc(100dvh - ${$}px - 12px))`,
499
+ top: g,
500
+ right: z,
501
+ width: $,
502
+ height: `min(${t}, calc(100dvh - ${g}px - 12px))`,
501
503
  borderRadius: "16px"
502
504
  },
503
505
  overflow: "hidden",
504
- boxShadow: p ? "none" : "0 8px 40px rgba(0,0,0,.2)",
506
+ boxShadow: a ? "none" : "0 8px 40px rgba(0,0,0,.2)",
505
507
  background: "#fff",
506
508
  zIndex: 9999,
507
509
  animation: "ocl-slide-in .18s ease"
508
510
  }, children: /* @__PURE__ */ e(
509
- F,
511
+ A,
510
512
  {
511
513
  url: o,
512
514
  ...i ? { apiUrl: i } : {},
513
- ...d ? { profileId: d } : {},
515
+ ...s ? { profileId: s } : {},
514
516
  ...n ? { tenantId: n } : {},
515
517
  ...r ? { token: r } : {},
516
518
  ...l ? { refreshToken: l } : {},
517
- ...s ? { userId: s } : {},
518
- ...h ? { userName: h } : {},
519
+ ...d ? { userId: d } : {},
520
+ ...u ? { userName: u } : {},
519
521
  ...v ? { userEmail: v } : {},
520
522
  ...m ? { scope: m } : {},
521
- accent: u,
523
+ accent: p,
522
524
  height: "100%",
523
- onClose: () => a(!1)
525
+ onClose: () => R(!1)
524
526
  }
525
527
  ) }),
526
528
  /* @__PURE__ */ e("style", { children: "@keyframes ocl-slide-in { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }" })
@@ -528,9 +530,9 @@ function Z({
528
530
  ] });
529
531
  }
530
532
  export {
531
- F as ChatApp,
532
- Z as ChatAppLauncher,
533
- V as ChatWidget,
534
- X as MarketplaceChat
533
+ A as ChatApp,
534
+ X as ChatAppLauncher,
535
+ Q as ChatWidget,
536
+ V as MarketplaceChat
535
537
  };
536
538
  //# sourceMappingURL=react.js.map