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