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