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