@paramms/chat-widget 1.0.15 → 1.0.17

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.
@@ -80,6 +80,9 @@ export interface Conversation {
80
80
  sentimentScore?: number;
81
81
  /** Set once an SLA-breach escalation macro has fired, so it only fires once. */
82
82
  slaEscalatedAt?: number;
83
+ /** If set, the conversation is snoozed until this Unix ms timestamp.
84
+ * Hidden from the inbox until the timestamp passes, then resurfaces. */
85
+ snoozedUntil?: number;
83
86
  /** Page URL where the widget was open when the conversation started. */
84
87
  pageUrl?: string;
85
88
  /** Browser tab title at conversation start — gives agents context. */
@@ -110,3 +113,8 @@ export interface Subject {
110
113
  createdAt: number;
111
114
  updatedAt: number;
112
115
  }
116
+ /** States in which a conversation is no longer "open": it's done with, so inbox
117
+ * / proactive sweeps skip it and load balancing frees the assigned agent. The
118
+ * single source of truth for "is this conversation finished?". */
119
+ export declare const TERMINAL_STATES: ReadonlySet<string>;
120
+ export declare function isTerminalState(state: string): boolean;
@@ -155,6 +155,7 @@ export type ServerFrame = {
155
155
  conversationId: ConversationId;
156
156
  userId: UserId;
157
157
  isTyping: boolean;
158
+ preview?: string;
158
159
  } | {
159
160
  type: 'reaction';
160
161
  conversationId: ConversationId;
package/dist/react.d.ts CHANGED
@@ -2,6 +2,9 @@ import { type MountOptions } from './index.js';
2
2
  interface BaseProps {
3
3
  /** Relay WebSocket URL — set as NEXT_PUBLIC_RELAY_WS_URL in .env — required */
4
4
  url: string;
5
+ /** HTTP(S) base for REST calls (history, uploads). Set when your REST API is
6
+ * on a different host/path than the WebSocket. Defaults to the WS origin. */
7
+ apiUrl?: string;
5
8
  /** Your Relay profile ID — set as NEXT_PUBLIC_RELAY_PROFILE_ID in .env — required */
6
9
  profileId: string;
7
10
  /** Your logged-in user's stable ID. When omitted the widget automatically
@@ -64,7 +67,7 @@ export interface ChatWidgetProps extends BaseProps {
64
67
  * />
65
68
  * ```
66
69
  */
67
- export declare function ChatWidget({ url, profileId, userId, userName, userEmail, userAvatar, contextTitle, contextSubtitle, contextStatus, subjectId, accent, launcher, position, quickReplies, height, i18n, translateLang, }: ChatWidgetProps): JSX.Element;
70
+ export declare function ChatWidget({ url, apiUrl, profileId, userId, userName, userEmail, userAvatar, contextTitle, contextSubtitle, contextStatus, subjectId, accent, launcher, position, quickReplies, height, i18n, translateLang, }: ChatWidgetProps): JSX.Element;
68
71
  export interface MarketplaceChatProps extends BaseProps {
69
72
  /** Unique ID for this listing — each listing gets its own thread.
70
73
  * Omit for a general (non-item-specific) conversation. */
@@ -114,10 +117,12 @@ export interface MarketplaceChatProps extends BaseProps {
114
117
  *
115
118
  * Only `url` and `profileId` are required. All other props are optional.
116
119
  */
117
- export declare function MarketplaceChat({ url, profileId, listingId, listingTitle, listingMeta, listingPrice, listingStatus, userId, userName, userEmail, userAvatar, accent, launcher, position, quickReplies, height, i18n, translateLang, }: MarketplaceChatProps): JSX.Element;
120
+ export declare function MarketplaceChat({ url, apiUrl, profileId, listingId, listingTitle, listingMeta, listingPrice, listingStatus, userId, userName, userEmail, userAvatar, accent, launcher, position, quickReplies, height, i18n, translateLang, }: MarketplaceChatProps): JSX.Element;
118
121
  export interface ChatAppProps {
119
122
  /** Relay WebSocket URL — required */
120
123
  url: string;
124
+ /** HTTP(S) base for REST calls. Defaults to the WS origin. */
125
+ apiUrl?: string;
121
126
  /** Your Relay profile ID — required */
122
127
  profileId: string;
123
128
  /** Your logged-in user's stable ID. Omit for anonymous (uses localStorage UID) */
@@ -160,10 +165,12 @@ export interface ChatAppProps {
160
165
  * }
161
166
  * ```
162
167
  */
163
- export declare function ChatApp({ url, profileId, userId, userName, userEmail, accent, height, i18n, }: ChatAppProps): JSX.Element;
168
+ export declare function ChatApp({ url, apiUrl, profileId, userId, userName, userEmail, accent, height, i18n, }: ChatAppProps): JSX.Element;
164
169
  export interface ChatAppLauncherProps {
165
170
  /** Relay WebSocket URL — required */
166
171
  url: string;
172
+ /** HTTP(S) base for REST calls. Defaults to the WS origin. */
173
+ apiUrl?: string;
167
174
  /** Your Relay profile ID — required */
168
175
  profileId: string;
169
176
  /** Your logged-in user's stable ID */
@@ -215,5 +222,5 @@ export interface ChatAppLauncherProps {
215
222
  * />
216
223
  * ```
217
224
  */
218
- export declare function ChatAppLauncher({ url, profileId, userId, userName, userEmail, accent, floating, position, label, panelWidth, panelHeight, }: ChatAppLauncherProps): JSX.Element;
225
+ export declare function ChatAppLauncher({ url, apiUrl, profileId, userId, userName, userEmail, accent, floating, position, label, panelWidth, panelHeight, }: ChatAppLauncherProps): JSX.Element;
219
226
  export {};
package/dist/react.js CHANGED
@@ -1,174 +1,182 @@
1
- import { jsxs as C, jsx as s, Fragment as D } from "react/jsx-runtime";
2
- import { useState as M, useRef as v, useEffect as S } from "react";
3
- import { mount as L } from "./index.js";
4
- function Y({
5
- url: x,
6
- profileId: b,
1
+ import { jsxs as j, jsx as u, Fragment as $ } from "react/jsx-runtime";
2
+ import { useState as L, useRef as k, useEffect as W } from "react";
3
+ import { mount as D } from "./index.js";
4
+ function A({
5
+ url: b,
6
+ apiUrl: i,
7
+ profileId: a,
7
8
  userId: e,
8
- userName: i,
9
- userEmail: r,
9
+ userName: l,
10
+ userEmail: c,
10
11
  userAvatar: o,
11
- contextTitle: g,
12
+ contextTitle: m,
12
13
  contextSubtitle: y,
13
14
  contextStatus: t,
14
- subjectId: f,
15
- accent: h,
15
+ subjectId: p,
16
+ accent: s,
16
17
  launcher: n,
17
- position: l,
18
- quickReplies: c,
19
- height: d = "100%",
20
- i18n: p,
21
- translateLang: u
18
+ position: d,
19
+ quickReplies: f,
20
+ height: h = "100%",
21
+ i18n: g,
22
+ translateLang: r
22
23
  }) {
23
- const w = v(null), a = v(null);
24
- return S(() => {
25
- var m;
24
+ const w = k(null), x = k(null);
25
+ return W(() => {
26
+ var v;
26
27
  if (w.current)
27
- return (m = a.current) == null || m.close(), a.current = L({
28
+ return (v = x.current) == null || v.close(), x.current = D({
28
29
  el: w.current,
29
- url: x,
30
- profileId: b,
31
- ...f ? { subjectId: f } : {},
30
+ url: b,
31
+ ...i ? { apiUrl: i } : {},
32
+ profileId: a,
33
+ ...p ? { subjectId: p } : {},
32
34
  ...e ? { token: e } : {},
33
- ...e || i || r || o ? {
35
+ ...e || l || c || o ? {
34
36
  user: {
35
- ...i ? { name: i } : {},
36
- ...r ? { email: r } : {},
37
+ ...l ? { name: l } : {},
38
+ ...c ? { email: c } : {},
37
39
  ...o ? { avatar: o } : {}
38
40
  }
39
41
  } : {},
40
- ...g ? {
42
+ ...m ? {
41
43
  subject: {
42
- title: g,
44
+ title: m,
43
45
  ...y ? { subtitle: y } : {},
44
46
  ...t ? { status: t } : {}
45
47
  }
46
48
  } : {},
47
- ...c ? { quickReplies: c } : {},
48
- ...h ? { accent: h } : {},
49
- ...u ? { translateLang: u } : {},
50
- ...p ? { i18n: p } : {},
51
- ...n ? { launcher: n, position: l ?? "bottom-right" } : {}
49
+ ...f ? { quickReplies: f } : {},
50
+ ...s ? { accent: s } : {},
51
+ ...r ? { translateLang: r } : {},
52
+ ...g ? { i18n: g } : {},
53
+ ...n ? { launcher: n, position: d ?? "bottom-right" } : {}
52
54
  }), () => {
53
- var R;
54
- (R = a.current) == null || R.close(), a.current = null;
55
+ var C;
56
+ (C = x.current) == null || C.close(), x.current = null;
55
57
  };
56
- }, [x, b, f, e, i, r, h, n, l, u]), /* @__PURE__ */ s(
58
+ }, [b, i, a, p, e, l, c, s, n, d, r]), /* @__PURE__ */ u(
57
59
  "div",
58
60
  {
59
61
  ref: w,
60
- style: n ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: d, minHeight: d === "100%" ? "480px" : void 0 }
62
+ style: n ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: h, minHeight: h === "100%" ? "480px" : void 0 }
61
63
  }
62
64
  );
63
65
  }
64
- const B = [
66
+ const T = [
65
67
  "Is this still available?",
66
68
  "Can I schedule a viewing?",
67
69
  "What is your best price?"
68
70
  ];
69
- function A({
70
- url: x,
71
- profileId: b,
71
+ function K({
72
+ url: b,
73
+ apiUrl: i,
74
+ profileId: a,
72
75
  listingId: e,
73
- listingTitle: i,
74
- listingMeta: r,
76
+ listingTitle: l,
77
+ listingMeta: c,
75
78
  listingPrice: o,
76
- listingStatus: g,
79
+ listingStatus: m,
77
80
  userId: y,
78
81
  userName: t,
79
- userEmail: f,
80
- userAvatar: h,
82
+ userEmail: p,
83
+ userAvatar: s,
81
84
  accent: n,
82
- launcher: l,
83
- position: c,
84
- quickReplies: d,
85
- height: p = "100%",
86
- i18n: u,
85
+ launcher: d,
86
+ position: f,
87
+ quickReplies: h,
88
+ height: g = "100%",
89
+ i18n: r,
87
90
  translateLang: w
88
91
  }) {
89
- const a = v(null), m = v(null);
90
- return S(() => {
91
- var R;
92
- if (a.current)
93
- return (R = m.current) == null || R.close(), m.current = L({
94
- el: a.current,
95
- url: x,
96
- profileId: b,
92
+ const x = k(null), v = k(null);
93
+ return W(() => {
94
+ var C;
95
+ if (x.current)
96
+ return (C = v.current) == null || C.close(), v.current = D({
97
+ el: x.current,
98
+ url: b,
99
+ ...i ? { apiUrl: i } : {},
100
+ profileId: a,
97
101
  ...e ? { subjectId: `listing_${e}` } : {},
98
102
  ...y ? { token: y } : {},
99
- ...y || t || f || h ? {
103
+ ...y || t || p || s ? {
100
104
  user: {
101
105
  ...t ? { name: t } : {},
102
- ...f ? { email: f } : {},
103
- ...h ? { avatar: h } : {},
106
+ ...p ? { email: p } : {},
107
+ ...s ? { avatar: s } : {},
104
108
  ...e ? { meta: { listingId: e } } : {}
105
109
  }
106
110
  } : {},
107
- ...i ? {
111
+ ...l ? {
108
112
  subject: {
109
- title: i,
110
- ...r ? { subtitle: r } : {},
113
+ title: l,
114
+ ...c ? { subtitle: c } : {},
111
115
  ...o ? { tags: [`$${o.toLocaleString()}`] } : {},
112
- ...g ? { status: g } : {}
116
+ ...m ? { status: m } : {}
113
117
  }
114
118
  } : {},
115
- quickReplies: d ?? B,
119
+ quickReplies: h ?? T,
116
120
  ...n ? { accent: n } : {},
117
121
  ...w ? { translateLang: w } : {},
118
- ...u ? { i18n: u } : {},
119
- ...l ? { launcher: l, position: c ?? "bottom-right" } : {}
122
+ ...r ? { i18n: r } : {},
123
+ ...d ? { launcher: d, position: f ?? "bottom-right" } : {}
120
124
  }), () => {
121
- var W;
122
- (W = m.current) == null || W.close(), m.current = null;
125
+ var z;
126
+ (z = v.current) == null || z.close(), v.current = null;
123
127
  };
124
- }, [x, b, e, y, t, f, n, l, c, w]), /* @__PURE__ */ s(
128
+ }, [b, i, a, e, y, t, p, n, d, f, w]), /* @__PURE__ */ u(
125
129
  "div",
126
130
  {
127
- ref: a,
128
- style: l ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: p, minHeight: p === "100%" ? "480px" : void 0 }
131
+ ref: x,
132
+ style: d ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: g, minHeight: g === "100%" ? "480px" : void 0 }
129
133
  }
130
134
  );
131
135
  }
132
- function $({
133
- url: x,
134
- profileId: b,
136
+ function F({
137
+ url: b,
138
+ apiUrl: i,
139
+ profileId: a,
135
140
  userId: e,
136
- userName: i,
137
- userEmail: r,
141
+ userName: l,
142
+ userEmail: c,
138
143
  accent: o,
139
- height: g = "100%",
144
+ height: m = "100%",
140
145
  i18n: y
141
146
  }) {
142
- const [t, f] = M(null), h = v(null), n = v(null), l = v(null), c = v(null);
143
- S(() => {
144
- if (h.current)
145
- return import("./chatlist.js").then(({ mountChatList: p }) => {
146
- l.current = p({
147
- el: h.current,
148
- url: x,
149
- profileId: b,
150
- onSelect: (u) => f(u),
151
- ...e ? { userId: e } : {},
152
- ...o ? { accent: o } : {},
153
- ...y ? { i18n: y } : {}
154
- });
155
- }), () => {
156
- var p;
157
- (p = l.current) == null || p.close(), l.current = null;
158
- };
159
- }, [x, b, e]), S(() => {
160
- var p;
147
+ const [t, p] = L(null), s = k(null), n = k(null), d = k(null), f = k(null);
148
+ W(() => {
149
+ if (!s.current) return;
150
+ let g = !1;
151
+ return import("./chatlist.js").then(({ mountChatList: r }) => {
152
+ g || !s.current || (d.current = r({
153
+ el: s.current,
154
+ url: b,
155
+ ...i ? { apiUrl: i } : {},
156
+ profileId: a,
157
+ onSelect: (w) => p(w),
158
+ ...e ? { userId: e } : {},
159
+ ...o ? { accent: o } : {},
160
+ ...y ? { i18n: y } : {}
161
+ }));
162
+ }), () => {
163
+ var r;
164
+ g = !0, (r = d.current) == null || r.close(), d.current = null;
165
+ };
166
+ }, [b, a, e]), W(() => {
167
+ var g;
161
168
  if (!(!n.current || !t))
162
- return (p = c.current) == null || p.close(), c.current = L({
169
+ return (g = f.current) == null || g.close(), f.current = D({
163
170
  el: n.current,
164
- url: x,
165
- profileId: b,
171
+ url: b,
172
+ ...i ? { apiUrl: i } : {},
173
+ profileId: a,
166
174
  ...t.subjectId ? { subjectId: t.subjectId } : {},
167
175
  ...e ? { token: e } : {},
168
- ...e || i || r ? {
176
+ ...e || l || c ? {
169
177
  user: {
170
- ...i ? { name: i } : {},
171
- ...r ? { email: r } : {}
178
+ ...l ? { name: l } : {},
179
+ ...c ? { email: c } : {}
172
180
  }
173
181
  } : {},
174
182
  ...t.subjectTitle ? {
@@ -179,92 +187,94 @@ function $({
179
187
  } : {},
180
188
  ...o ? { accent: o } : {}
181
189
  }), () => {
182
- var u;
183
- (u = c.current) == null || u.close(), c.current = null;
190
+ var r;
191
+ (r = f.current) == null || r.close(), f.current = null;
184
192
  };
185
193
  }, [t == null ? void 0 : t.id]);
186
- const d = typeof window < "u" && window.innerWidth < 768;
187
- return /* @__PURE__ */ C("div", { style: { display: "flex", width: "100%", height: g, minHeight: "400px", overflow: "hidden" }, children: [
188
- /* @__PURE__ */ s("div", { style: {
189
- width: d ? "100%" : "360px",
190
- flex: d && t ? "none" : void 0,
191
- display: d && t ? "none" : "flex",
194
+ const h = typeof window < "u" && window.innerWidth < 768;
195
+ return /* @__PURE__ */ j("div", { style: { display: "flex", width: "100%", height: m, minHeight: "400px", overflow: "hidden" }, children: [
196
+ /* @__PURE__ */ u("div", { style: {
197
+ width: h ? "100%" : "360px",
198
+ flex: h && t ? "none" : void 0,
199
+ display: h && t ? "none" : "flex",
192
200
  flexDirection: "column",
193
- borderRight: d ? "none" : "1px solid #e8eaed",
201
+ borderRight: h ? "none" : "1px solid #e8eaed",
194
202
  minWidth: 0
195
- }, children: /* @__PURE__ */ s("div", { ref: h, style: { width: "100%", height: "100%" } }) }),
196
- t ? /* @__PURE__ */ C("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, position: "relative" }, children: [
197
- d && /* @__PURE__ */ s(
203
+ }, children: /* @__PURE__ */ u("div", { ref: s, style: { width: "100%", height: "100%" } }) }),
204
+ t ? /* @__PURE__ */ j("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, position: "relative" }, children: [
205
+ h && /* @__PURE__ */ u(
198
206
  "button",
199
207
  {
200
- onClick: () => f(null),
208
+ onClick: () => p(null),
201
209
  style: { position: "absolute", top: 12, left: 12, zIndex: 10, background: "none", border: "none", fontSize: 22, cursor: "pointer", color: "#1c1b1a" },
202
210
  children: "←"
203
211
  }
204
212
  ),
205
- /* @__PURE__ */ s("div", { ref: n, style: { width: "100%", height: "100%" } })
206
- ] }) : /* @__PURE__ */ s("div", { style: { flex: 1, display: d ? "none" : "flex", alignItems: "center", justifyContent: "center", color: "#9b9690", fontSize: 14 }, children: "Select a conversation" })
213
+ /* @__PURE__ */ u("div", { ref: n, style: { width: "100%", height: "100%" } })
214
+ ] }) : /* @__PURE__ */ u("div", { style: { flex: 1, display: h ? "none" : "flex", alignItems: "center", justifyContent: "center", color: "#9b9690", fontSize: 14 }, children: "Select a conversation" })
207
215
  ] });
208
216
  }
209
- function K({
210
- url: x,
211
- profileId: b,
217
+ function P({
218
+ url: b,
219
+ apiUrl: i,
220
+ profileId: a,
212
221
  userId: e,
213
- userName: i,
214
- userEmail: r,
222
+ userName: l,
223
+ userEmail: c,
215
224
  accent: o = "#4F63F5",
216
- floating: g = !0,
225
+ floating: m = !0,
217
226
  position: y = "bottom-right",
218
227
  label: t,
219
- panelWidth: f,
220
- panelHeight: h = "600px"
228
+ panelWidth: p,
229
+ panelHeight: s = "600px"
221
230
  }) {
222
- const [n, l] = M(!1), c = v(null), d = y === "bottom-right", u = t ?? (g ? "💬" : "Messages");
223
- if (S(() => {
224
- const k = (z) => {
225
- z.key === "Escape" && l(!1);
231
+ const [n, d] = L(!1), f = k(null), h = y === "bottom-right", r = t ?? (m ? "💬" : "Messages");
232
+ if (W(() => {
233
+ const R = (M) => {
234
+ M.key === "Escape" && d(!1);
226
235
  };
227
- return document.addEventListener("keydown", k), () => document.removeEventListener("keydown", k);
228
- }, []), g) {
229
- const k = typeof window < "u" && window.innerWidth < 480, z = k ? "100vw" : f ?? "420px", H = k ? "100dvh" : h;
230
- return /* @__PURE__ */ C("div", { style: {
236
+ return document.addEventListener("keydown", R), () => document.removeEventListener("keydown", R);
237
+ }, []), m) {
238
+ const R = typeof window < "u" && window.innerWidth < 480, M = R ? "100vw" : p ?? "420px", B = R ? "100dvh" : s;
239
+ return /* @__PURE__ */ j("div", { style: {
231
240
  position: "fixed",
232
- [d ? "right" : "left"]: "20px",
241
+ [h ? "right" : "left"]: "20px",
233
242
  bottom: "20px",
234
243
  zIndex: 9999,
235
244
  display: "flex",
236
245
  flexDirection: "column",
237
- alignItems: d ? "flex-end" : "flex-start",
246
+ alignItems: h ? "flex-end" : "flex-start",
238
247
  gap: "12px"
239
248
  }, children: [
240
- /* @__PURE__ */ s("div", { style: {
241
- width: z,
242
- height: H,
243
- borderRadius: k ? "0" : "16px",
249
+ /* @__PURE__ */ u("div", { style: {
250
+ width: M,
251
+ height: B,
252
+ borderRadius: R ? "0" : "16px",
244
253
  overflow: "hidden",
245
254
  boxShadow: "0 8px 40px rgba(0,0,0,.18)",
246
255
  background: "#fff",
247
256
  display: n ? "flex" : "none",
248
257
  flexDirection: "column",
249
- transformOrigin: `bottom ${d ? "right" : "left"}`,
258
+ transformOrigin: `bottom ${h ? "right" : "left"}`,
250
259
  animation: n ? "ocl-pop-in .18s ease" : "none"
251
- }, children: /* @__PURE__ */ s(
252
- $,
260
+ }, children: /* @__PURE__ */ u(
261
+ F,
253
262
  {
254
- url: x,
255
- profileId: b,
263
+ url: b,
264
+ ...i ? { apiUrl: i } : {},
265
+ profileId: a,
256
266
  ...e ? { userId: e } : {},
257
- ...i ? { userName: i } : {},
258
- ...r ? { userEmail: r } : {},
267
+ ...l ? { userName: l } : {},
268
+ ...c ? { userEmail: c } : {},
259
269
  accent: o,
260
270
  height: "100%"
261
271
  }
262
272
  ) }),
263
- /* @__PURE__ */ s(
273
+ /* @__PURE__ */ u(
264
274
  "button",
265
275
  {
266
- ref: c,
267
- onClick: () => l((j) => !j),
276
+ ref: f,
277
+ onClick: () => d((S) => !S),
268
278
  style: {
269
279
  width: "56px",
270
280
  height: "56px",
@@ -278,27 +288,27 @@ function K({
278
288
  boxShadow: "0 4px 16px rgba(0,0,0,.25)",
279
289
  transition: "transform .15s"
280
290
  },
281
- onMouseEnter: (j) => {
282
- j.target.style.transform = "scale(1.08)";
291
+ onMouseEnter: (S) => {
292
+ S.target.style.transform = "scale(1.08)";
283
293
  },
284
- onMouseLeave: (j) => {
285
- j.target.style.transform = "scale(1)";
294
+ onMouseLeave: (S) => {
295
+ S.target.style.transform = "scale(1)";
286
296
  },
287
- children: n ? "✕" : u
297
+ children: n ? "✕" : r
288
298
  }
289
299
  ),
290
- /* @__PURE__ */ s("style", { children: "@keyframes ocl-pop-in { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }" })
300
+ /* @__PURE__ */ u("style", { children: "@keyframes ocl-pop-in { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }" })
291
301
  ] });
292
302
  }
293
- const w = f ?? "420px", [a, m] = M(null), R = () => {
294
- !n && c.current && m(c.current.getBoundingClientRect()), l((k) => !k);
295
- }, W = a ? a.bottom + 8 : 0, F = a ? window.innerWidth - a.right : 0;
296
- return /* @__PURE__ */ C(D, { children: [
297
- /* @__PURE__ */ C(
303
+ const w = p ?? "420px", [x, v] = L(null), C = () => {
304
+ !n && f.current && v(f.current.getBoundingClientRect()), d((R) => !R);
305
+ }, z = x ? x.bottom + 8 : 0, H = x ? window.innerWidth - x.right : 0;
306
+ return /* @__PURE__ */ j($, { children: [
307
+ /* @__PURE__ */ j(
298
308
  "button",
299
309
  {
300
- ref: c,
301
- onClick: R,
310
+ ref: f,
311
+ onClick: C,
302
312
  style: {
303
313
  display: "inline-flex",
304
314
  alignItems: "center",
@@ -315,50 +325,51 @@ function K({
315
325
  },
316
326
  children: [
317
327
  "💬 ",
318
- u
328
+ r
319
329
  ]
320
330
  }
321
331
  ),
322
- n && a && /* @__PURE__ */ C(D, { children: [
323
- /* @__PURE__ */ s(
332
+ n && x && /* @__PURE__ */ j($, { children: [
333
+ /* @__PURE__ */ u(
324
334
  "div",
325
335
  {
326
- onClick: () => l(!1),
336
+ onClick: () => d(!1),
327
337
  style: { position: "fixed", inset: 0, zIndex: 9998 }
328
338
  }
329
339
  ),
330
- /* @__PURE__ */ s("div", { style: {
340
+ /* @__PURE__ */ u("div", { style: {
331
341
  position: "fixed",
332
- top: W,
333
- right: F,
342
+ top: z,
343
+ right: H,
334
344
  width: w,
335
- height: h,
345
+ height: s,
336
346
  borderRadius: "16px",
337
347
  overflow: "hidden",
338
348
  boxShadow: "0 8px 40px rgba(0,0,0,.2)",
339
349
  background: "#fff",
340
350
  zIndex: 9999,
341
351
  animation: "ocl-slide-in .18s ease"
342
- }, children: /* @__PURE__ */ s(
343
- $,
352
+ }, children: /* @__PURE__ */ u(
353
+ F,
344
354
  {
345
- url: x,
346
- profileId: b,
355
+ url: b,
356
+ ...i ? { apiUrl: i } : {},
357
+ profileId: a,
347
358
  ...e ? { userId: e } : {},
348
- ...i ? { userName: i } : {},
349
- ...r ? { userEmail: r } : {},
359
+ ...l ? { userName: l } : {},
360
+ ...c ? { userEmail: c } : {},
350
361
  accent: o,
351
362
  height: "100%"
352
363
  }
353
364
  ) }),
354
- /* @__PURE__ */ s("style", { children: "@keyframes ocl-slide-in { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }" })
365
+ /* @__PURE__ */ u("style", { children: "@keyframes ocl-slide-in { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }" })
355
366
  ] })
356
367
  ] });
357
368
  }
358
369
  export {
359
- $ as ChatApp,
360
- K as ChatAppLauncher,
361
- Y as ChatWidget,
362
- A as MarketplaceChat
370
+ F as ChatApp,
371
+ P as ChatAppLauncher,
372
+ A as ChatWidget,
373
+ K as MarketplaceChat
363
374
  };
364
375
  //# sourceMappingURL=react.js.map