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