@paramms/chat-widget 1.0.36 → 1.0.37

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