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